Reduce size of heater state print code
This commit is contained in:
parent
dde8bb7c8b
commit
da8e946efb
@ -5889,7 +5889,7 @@ inline void gcode_M17() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool pause_print(const float &retract, const float &z_lift, const float &x_pos, const float &y_pos,
|
static bool pause_print(const float &retract, const float &z_lift, const float &x_pos, const float &y_pos,
|
||||||
const float &unload_length = 0 , int8_t max_beep_count = 0, bool show_lcd = false
|
const float &unload_length = 0 , const int8_t max_beep_count = 0, const bool show_lcd = false
|
||||||
) {
|
) {
|
||||||
if (move_away_flag) return false; // already paused
|
if (move_away_flag) return false; // already paused
|
||||||
|
|
||||||
@ -5989,7 +5989,7 @@ inline void gcode_M17() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wait_for_filament_reload(int8_t max_beep_count = 0) {
|
static void wait_for_filament_reload(const int8_t max_beep_count = 0) {
|
||||||
bool nozzle_timed_out = false;
|
bool nozzle_timed_out = false;
|
||||||
|
|
||||||
// Wait for filament insert by user and press button
|
// Wait for filament insert by user and press button
|
||||||
@ -6014,7 +6014,7 @@ inline void gcode_M17() {
|
|||||||
KEEPALIVE_STATE(IN_HANDLER);
|
KEEPALIVE_STATE(IN_HANDLER);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void resume_print(const float &load_length = 0, const float &initial_extrude_length = 0, int8_t max_beep_count = 0) {
|
static void resume_print(const float &load_length = 0, const float &initial_extrude_length = 0, const int8_t max_beep_count = 0) {
|
||||||
bool nozzle_timed_out = false;
|
bool nozzle_timed_out = false;
|
||||||
|
|
||||||
if (!move_away_flag) return;
|
if (!move_away_flag) return;
|
||||||
@ -6974,39 +6974,57 @@ inline void gcode_M104() {
|
|||||||
|
|
||||||
#if HAS_TEMP_HOTEND || HAS_TEMP_BED
|
#if HAS_TEMP_HOTEND || HAS_TEMP_BED
|
||||||
|
|
||||||
|
void print_heater_state(const float &c, const float &t,
|
||||||
|
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
||||||
|
const float r,
|
||||||
|
#endif
|
||||||
|
const int8_t e=-2
|
||||||
|
) {
|
||||||
|
SERIAL_PROTOCOLCHAR(' ');
|
||||||
|
SERIAL_PROTOCOLCHAR(
|
||||||
|
#if HAS_TEMP_BED && HAS_TEMP_HOTEND
|
||||||
|
e == -1 ? 'B' : 'T'
|
||||||
|
#elif HAS_TEMP_HOTEND
|
||||||
|
'T'
|
||||||
|
#else
|
||||||
|
'B'
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
#if HOTENDS > 1
|
||||||
|
if (e >= 0) SERIAL_PROTOCOLCHAR('0' + e);
|
||||||
|
#endif
|
||||||
|
SERIAL_PROTOCOLCHAR(':');
|
||||||
|
SERIAL_PROTOCOL(c);
|
||||||
|
SERIAL_PROTOCOLPAIR(" /" , t);
|
||||||
|
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
||||||
|
SERIAL_PROTOCOLPAIR(" (", r / OVERSAMPLENR);
|
||||||
|
SERIAL_PROTOCOLCHAR(')');
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void print_heaterstates() {
|
void print_heaterstates() {
|
||||||
#if HAS_TEMP_HOTEND
|
#if HAS_TEMP_HOTEND
|
||||||
SERIAL_PROTOCOLPGM(" T:");
|
print_heater_state(thermalManager.degHotend(target_extruder), thermalManager.degTargetHotend(target_extruder)
|
||||||
SERIAL_PROTOCOL(thermalManager.degHotend(target_extruder));
|
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
||||||
SERIAL_PROTOCOLPGM(" /");
|
, thermalManager.rawHotendTemp(target_extruder)
|
||||||
SERIAL_PROTOCOL(thermalManager.degTargetHotend(target_extruder));
|
#endif
|
||||||
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
);
|
||||||
SERIAL_PROTOCOLPAIR(" (", thermalManager.rawHotendTemp(target_extruder) / OVERSAMPLENR);
|
|
||||||
SERIAL_PROTOCOLCHAR(')');
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
#if HAS_TEMP_BED
|
#if HAS_TEMP_BED
|
||||||
SERIAL_PROTOCOLPGM(" B:");
|
print_heater_state(thermalManager.degBed(), thermalManager.degTargetBed(),
|
||||||
SERIAL_PROTOCOL(thermalManager.degBed());
|
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
||||||
SERIAL_PROTOCOLPGM(" /");
|
thermalManager.rawBedTemp(),
|
||||||
SERIAL_PROTOCOL(thermalManager.degTargetBed());
|
#endif
|
||||||
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
-1 // BED
|
||||||
SERIAL_PROTOCOLPAIR(" (", thermalManager.rawBedTemp() / OVERSAMPLENR);
|
);
|
||||||
SERIAL_PROTOCOLCHAR(')');
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
#if HOTENDS > 1
|
#if HOTENDS > 1
|
||||||
HOTEND_LOOP() {
|
HOTEND_LOOP() print_heater_state(thermalManager.degHotend(e), thermalManager.degTargetHotend(e),
|
||||||
SERIAL_PROTOCOLPAIR(" T", e);
|
|
||||||
SERIAL_PROTOCOLCHAR(':');
|
|
||||||
SERIAL_PROTOCOL(thermalManager.degHotend(e));
|
|
||||||
SERIAL_PROTOCOLPGM(" /");
|
|
||||||
SERIAL_PROTOCOL(thermalManager.degTargetHotend(e));
|
|
||||||
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
||||||
SERIAL_PROTOCOLPAIR(" (", thermalManager.rawHotendTemp(e) / OVERSAMPLENR);
|
thermalManager.rawHotendTemp(e),
|
||||||
SERIAL_PROTOCOLCHAR(')');
|
|
||||||
#endif
|
#endif
|
||||||
}
|
e
|
||||||
|
);
|
||||||
#endif
|
#endif
|
||||||
SERIAL_PROTOCOLPGM(" @:");
|
SERIAL_PROTOCOLPGM(" @:");
|
||||||
SERIAL_PROTOCOL(thermalManager.getHeaterPower(target_extruder));
|
SERIAL_PROTOCOL(thermalManager.getHeaterPower(target_extruder));
|
||||||
@ -7206,16 +7224,12 @@ inline void gcode_M109() {
|
|||||||
print_heaterstates();
|
print_heaterstates();
|
||||||
#if TEMP_RESIDENCY_TIME > 0
|
#if TEMP_RESIDENCY_TIME > 0
|
||||||
SERIAL_PROTOCOLPGM(" W:");
|
SERIAL_PROTOCOLPGM(" W:");
|
||||||
if (residency_start_ms) {
|
if (residency_start_ms)
|
||||||
long rem = (((TEMP_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL;
|
SERIAL_PROTOCOL(long((((TEMP_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL));
|
||||||
SERIAL_PROTOCOLLN(rem);
|
else
|
||||||
}
|
SERIAL_PROTOCOLCHAR('?');
|
||||||
else {
|
|
||||||
SERIAL_PROTOCOLLNPGM("?");
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
SERIAL_EOL();
|
|
||||||
#endif
|
#endif
|
||||||
|
SERIAL_EOL();
|
||||||
}
|
}
|
||||||
|
|
||||||
idle();
|
idle();
|
||||||
@ -7339,16 +7353,12 @@ inline void gcode_M109() {
|
|||||||
print_heaterstates();
|
print_heaterstates();
|
||||||
#if TEMP_BED_RESIDENCY_TIME > 0
|
#if TEMP_BED_RESIDENCY_TIME > 0
|
||||||
SERIAL_PROTOCOLPGM(" W:");
|
SERIAL_PROTOCOLPGM(" W:");
|
||||||
if (residency_start_ms) {
|
if (residency_start_ms)
|
||||||
long rem = (((TEMP_BED_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL;
|
SERIAL_PROTOCOL(long((((TEMP_BED_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL));
|
||||||
SERIAL_PROTOCOLLN(rem);
|
else
|
||||||
}
|
SERIAL_PROTOCOLCHAR('?');
|
||||||
else {
|
|
||||||
SERIAL_PROTOCOLLNPGM("?");
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
SERIAL_EOL();
|
|
||||||
#endif
|
#endif
|
||||||
|
SERIAL_EOL();
|
||||||
}
|
}
|
||||||
|
|
||||||
idle();
|
idle();
|
||||||
|
Loading…
Reference in New Issue
Block a user