🩹 Fix PRINTCOUNTER with EXTRUDERS 0 (#24063)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
parent
99252cf0cd
commit
be6535e5f7
|
@ -207,7 +207,7 @@ void GcodeSuite::get_destination_from_command() {
|
||||||
if (parser.floatval('F') > 0)
|
if (parser.floatval('F') > 0)
|
||||||
feedrate_mm_s = parser.value_feedrate();
|
feedrate_mm_s = parser.value_feedrate();
|
||||||
|
|
||||||
#if ENABLED(PRINTCOUNTER)
|
#if BOTH(PRINTCOUNTER, HAS_EXTRUDERS)
|
||||||
if (!DEBUGGING(DRYRUN) && !skip_move)
|
if (!DEBUGGING(DRYRUN) && !skip_move)
|
||||||
print_job_timer.incFilamentUsed(destination.e - current_position.e);
|
print_job_timer.incFilamentUsed(destination.e - current_position.e);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -80,30 +80,36 @@ millis_t PrintCounter::deltaDuration() {
|
||||||
return lastDuration - tmp;
|
return lastDuration - tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintCounter::incFilamentUsed(float const &amount) {
|
#if HAS_EXTRUDERS
|
||||||
TERN_(DEBUG_PRINTCOUNTER, debug(PSTR("incFilamentUsed")));
|
void PrintCounter::incFilamentUsed(float const &amount) {
|
||||||
|
TERN_(DEBUG_PRINTCOUNTER, debug(PSTR("incFilamentUsed")));
|
||||||
|
|
||||||
// Refuses to update data if object is not loaded
|
// Refuses to update data if object is not loaded
|
||||||
if (!isLoaded()) return;
|
if (!isLoaded()) return;
|
||||||
|
|
||||||
data.filamentUsed += amount; // mm
|
data.filamentUsed += amount; // mm
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void PrintCounter::initStats() {
|
void PrintCounter::initStats() {
|
||||||
TERN_(DEBUG_PRINTCOUNTER, debug(PSTR("initStats")));
|
TERN_(DEBUG_PRINTCOUNTER, debug(PSTR("initStats")));
|
||||||
|
|
||||||
loaded = true;
|
loaded = true;
|
||||||
data = { 0, 0, 0, 0, 0.0
|
|
||||||
#if HAS_SERVICE_INTERVALS
|
data = {
|
||||||
#if SERVICE_INTERVAL_1 > 0
|
.totalPrints = 0
|
||||||
, SERVICE_INTERVAL_SEC_1
|
, .finishedPrints = 0
|
||||||
#endif
|
, .printTime = 0
|
||||||
#if SERVICE_INTERVAL_2 > 0
|
, .longestPrint = 0
|
||||||
, SERVICE_INTERVAL_SEC_2
|
OPTARG(HAS_EXTRUDERS, .filamentUsed = 0.0)
|
||||||
#endif
|
#if SERVICE_INTERVAL_1 > 0
|
||||||
#if SERVICE_INTERVAL_3 > 0
|
, .nextService1 = SERVICE_INTERVAL_SEC_1
|
||||||
, SERVICE_INTERVAL_SEC_3
|
#endif
|
||||||
#endif
|
#if SERVICE_INTERVAL_2 > 0
|
||||||
|
, .nextService2 = SERVICE_INTERVAL_SEC_2
|
||||||
|
#endif
|
||||||
|
#if SERVICE_INTERVAL_3 > 0
|
||||||
|
, .nextService3 = SERVICE_INTERVAL_SEC_3
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -210,8 +216,11 @@ void PrintCounter::showStats() {
|
||||||
SERIAL_CHAR(')');
|
SERIAL_CHAR(')');
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SERIAL_ECHOPGM("\n" STR_STATS "Filament used: ", data.filamentUsed / 1000);
|
#if HAS_EXTRUDERS
|
||||||
SERIAL_CHAR('m');
|
SERIAL_ECHOPGM("\n" STR_STATS "Filament used: ", data.filamentUsed / 1000);
|
||||||
|
SERIAL_CHAR('m');
|
||||||
|
#endif
|
||||||
|
|
||||||
SERIAL_EOL();
|
SERIAL_EOL();
|
||||||
|
|
||||||
#if SERVICE_INTERVAL_1 > 0
|
#if SERVICE_INTERVAL_1 > 0
|
||||||
|
|
|
@ -37,7 +37,9 @@ struct printStatistics { // 16 bytes
|
||||||
uint16_t finishedPrints; // Number of complete prints
|
uint16_t finishedPrints; // Number of complete prints
|
||||||
uint32_t printTime; // Accumulated printing time
|
uint32_t printTime; // Accumulated printing time
|
||||||
uint32_t longestPrint; // Longest successful print job
|
uint32_t longestPrint; // Longest successful print job
|
||||||
float filamentUsed; // Accumulated filament consumed in mm
|
#if HAS_EXTRUDERS
|
||||||
|
float filamentUsed; // Accumulated filament consumed in mm
|
||||||
|
#endif
|
||||||
#if SERVICE_INTERVAL_1 > 0
|
#if SERVICE_INTERVAL_1 > 0
|
||||||
uint32_t nextService1; // Service intervals (or placeholders)
|
uint32_t nextService1; // Service intervals (or placeholders)
|
||||||
#endif
|
#endif
|
||||||
|
@ -52,12 +54,7 @@ struct printStatistics { // 16 bytes
|
||||||
class PrintCounter: public Stopwatch {
|
class PrintCounter: public Stopwatch {
|
||||||
private:
|
private:
|
||||||
typedef Stopwatch super;
|
typedef Stopwatch super;
|
||||||
|
typedef IF<EITHER(USE_WIRED_EEPROM, CPU_32_BIT), uint32_t, uint16_t>::type eeprom_address_t;
|
||||||
#if EITHER(USE_WIRED_EEPROM, CPU_32_BIT)
|
|
||||||
typedef uint32_t eeprom_address_t;
|
|
||||||
#else
|
|
||||||
typedef uint16_t eeprom_address_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static printStatistics data;
|
static printStatistics data;
|
||||||
|
|
||||||
|
@ -124,13 +121,15 @@ class PrintCounter: public Stopwatch {
|
||||||
*/
|
*/
|
||||||
FORCE_INLINE static bool isLoaded() { return loaded; }
|
FORCE_INLINE static bool isLoaded() { return loaded; }
|
||||||
|
|
||||||
/**
|
#if HAS_EXTRUDERS
|
||||||
* @brief Increment the total filament used
|
/**
|
||||||
* @details The total filament used counter will be incremented by "amount".
|
* @brief Increment the total filament used
|
||||||
*
|
* @details The total filament used counter will be incremented by "amount".
|
||||||
* @param amount The amount of filament used in mm
|
*
|
||||||
*/
|
* @param amount The amount of filament used in mm
|
||||||
static void incFilamentUsed(float const &amount);
|
*/
|
||||||
|
static void incFilamentUsed(float const &amount);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Reset the Print Statistics
|
* @brief Reset the Print Statistics
|
||||||
|
|
|
@ -194,7 +194,7 @@ opt_set MOTHERBOARD BOARD_RAMPS_14_EFB EXTRUDERS 0 LCD_LANGUAGE en TEMP_SENSOR_C
|
||||||
DEFAULT_MAX_ACCELERATION '{ 3000, 3000, 100 }' \
|
DEFAULT_MAX_ACCELERATION '{ 3000, 3000, 100 }' \
|
||||||
MANUAL_FEEDRATE '{ 50*60, 50*60, 4*60 }' \
|
MANUAL_FEEDRATE '{ 50*60, 50*60, 4*60 }' \
|
||||||
AXIS_RELATIVE_MODES '{ false, false, false }'
|
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
|
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"
|
exec_test $1 $2 "MEGA2560 RAMPS | Laser Feature | Air Evacuation | Air Assist | Cooler | Flowmeter | 44780 LCD " "$3"
|
||||||
|
|
Loading…
Reference in a new issue