From 1e2d454eb76d3273b783f53e3fabcf1ccba34436 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 21 Apr 2022 00:48:18 -0500 Subject: [PATCH] misc. cleanup --- Marlin/src/gcode/gcode.cpp | 2 +- Marlin/src/module/printcounter.cpp | 28 ++++++++++++++-------------- Marlin/src/module/printcounter.h | 11 ++--------- buildroot/tests/mega2560 | 2 +- 4 files changed, 18 insertions(+), 25 deletions(-) diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 116bbdf5aa6d..b8668c74a856 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -210,7 +210,7 @@ void GcodeSuite::get_destination_from_command() { if (parser.floatval('F') > 0) feedrate_mm_s = parser.value_feedrate(); - #if (ENABLED(PRINTCOUNTER) && HAS_EXTRUDERS) + #if BOTH(PRINTCOUNTER, HAS_EXTRUDERS) if (!DEBUGGING(DRYRUN) && !skip_move) print_job_timer.incFilamentUsed(destination.e - current_position.e); #endif diff --git a/Marlin/src/module/printcounter.cpp b/Marlin/src/module/printcounter.cpp index bdda2247bd30..619fbc137ce4 100644 --- a/Marlin/src/module/printcounter.cpp +++ b/Marlin/src/module/printcounter.cpp @@ -95,21 +95,21 @@ void PrintCounter::initStats() { TERN_(DEBUG_PRINTCOUNTER, debug(PSTR("initStats"))); loaded = true; - data = { 0, 0, 0, 0 - #if HAS_EXTRUDERS - , 0.0 - #endif - #if HAS_SERVICE_INTERVALS - #if SERVICE_INTERVAL_1 > 0 - , SERVICE_INTERVAL_SEC_1 - #endif - #if SERVICE_INTERVAL_2 > 0 - , SERVICE_INTERVAL_SEC_2 - #endif - #if SERVICE_INTERVAL_3 > 0 - , SERVICE_INTERVAL_SEC_3 - #endif + data = { + .totalPrints = 0 + , .finishedPrints = 0 + , .printTime = 0 + , .longestPrint = 0 + OPTARG(HAS_EXTRUDERS, .filamentUsed = 0.0) + #if SERVICE_INTERVAL_1 > 0 + , .nextService1 = SERVICE_INTERVAL_SEC_1 + #endif + #if SERVICE_INTERVAL_2 > 0 + , .nextService2 = SERVICE_INTERVAL_SEC_2 + #endif + #if SERVICE_INTERVAL_3 > 0 + , .nextService3 = SERVICE_INTERVAL_SEC_3 #endif }; diff --git a/Marlin/src/module/printcounter.h b/Marlin/src/module/printcounter.h index bdd8dcd5a0f7..63cc1da158e8 100644 --- a/Marlin/src/module/printcounter.h +++ b/Marlin/src/module/printcounter.h @@ -37,11 +37,9 @@ struct printStatistics { // 16 bytes uint16_t finishedPrints; // Number of complete prints uint32_t printTime; // Accumulated printing time uint32_t longestPrint; // Longest successful print job - #if HAS_EXTRUDERS - float filamentUsed; // Accumulated filament consumed in mm + float filamentUsed; // Accumulated filament consumed in mm #endif - #if SERVICE_INTERVAL_1 > 0 uint32_t nextService1; // Service intervals (or placeholders) #endif @@ -56,12 +54,7 @@ struct printStatistics { // 16 bytes class PrintCounter: public Stopwatch { private: typedef Stopwatch super; - - #if EITHER(USE_WIRED_EEPROM, CPU_32_BIT) - typedef uint32_t eeprom_address_t; - #else - typedef uint16_t eeprom_address_t; - #endif + typedef IF::type eeprom_address_t; static printStatistics data; diff --git a/buildroot/tests/mega2560 b/buildroot/tests/mega2560 index a9ac15ecda9e..3677abf60ef0 100755 --- a/buildroot/tests/mega2560 +++ b/buildroot/tests/mega2560 @@ -193,7 +193,7 @@ opt_set MOTHERBOARD BOARD_RAMPS_14_EFB EXTRUDERS 0 LCD_LANGUAGE en TEMP_SENSOR_C DEFAULT_MAX_ACCELERATION '{ 3000, 3000, 100 }' \ MANUAL_FEEDRATE '{ 50*60, 50*60, 4*60 }' \ AXIS_RELATIVE_MODES '{ false, false, false }' -opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT EEPROM_SETTINGS EEPROM_BOOT_SILENT EEPROM_AUTO_INIT \ +opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT EEPROM_SETTINGS EEPROM_BOOT_SILENT EEPROM_AUTO_INIT PRINTCOUNTER \ LASER_FEATURE AIR_EVACUATION AIR_EVACUATION_PIN AIR_ASSIST AIR_ASSIST_PIN LASER_COOLANT_FLOW_METER I2C_AMMETER exec_test $1 $2 "MEGA2560 RAMPS | Laser Feature | Air Evacuation | Air Assist | Cooler | Flowmeter | 44780 LCD " "$3"