🎨 Macros for optional arguments (#21969)
This commit is contained in:
@@ -3335,11 +3335,8 @@ void Temperature::isr() {
|
||||
* Extruder: " T0:nnn.nn /nnn.nn"
|
||||
* With ADC: " T0:nnn.nn /nnn.nn (nnn.nn)"
|
||||
*/
|
||||
static void print_heater_state(const_celsius_float_t c, const_celsius_float_t t
|
||||
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
||||
, const float r
|
||||
#endif
|
||||
, const heater_id_t e=INDEX_NONE
|
||||
static void print_heater_state(const heater_id_t e, const_celsius_float_t c, const_celsius_float_t t
|
||||
OPTARG(SHOW_TEMP_ADC_VALUES, const float r)
|
||||
) {
|
||||
char k;
|
||||
switch (e) {
|
||||
@@ -3385,64 +3382,28 @@ void Temperature::isr() {
|
||||
}
|
||||
|
||||
void Temperature::print_heater_states(const uint8_t target_extruder
|
||||
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
|
||||
, const bool include_r/*=false*/
|
||||
#endif
|
||||
OPTARG(TEMP_SENSOR_1_AS_REDUNDANT, const bool include_r/*=false*/)
|
||||
) {
|
||||
#if HAS_TEMP_HOTEND
|
||||
print_heater_state(degHotend(target_extruder), degTargetHotend(target_extruder)
|
||||
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
||||
, rawHotendTemp(target_extruder)
|
||||
#endif
|
||||
);
|
||||
print_heater_state(H_NONE, degHotend(target_extruder), degTargetHotend(target_extruder) OPTARG(SHOW_TEMP_ADC_VALUES, rawHotendTemp(target_extruder)));
|
||||
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
|
||||
if (include_r) print_heater_state(degHotendRedundant(), degTargetHotend(0)
|
||||
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
||||
, rawHotendTempRedundant()
|
||||
#endif
|
||||
, H_REDUNDANT
|
||||
);
|
||||
if (include_r) print_heater_state(H_REDUNDANT, degHotendRedundant(), degTargetHotend(0) OPTARG(SHOW_TEMP_ADC_VALUES, rawHotendTempRedundant()));
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
print_heater_state(degBed(), degTargetBed()
|
||||
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
||||
, rawBedTemp()
|
||||
#endif
|
||||
, H_BED
|
||||
);
|
||||
print_heater_state(H_BED, degBed(), degTargetBed() OPTARG(SHOW_TEMP_ADC_VALUES, rawBedTemp()));
|
||||
#endif
|
||||
#if HAS_TEMP_CHAMBER
|
||||
print_heater_state(degChamber(), TERN0(HAS_HEATED_CHAMBER, degTargetChamber())
|
||||
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
||||
, rawChamberTemp()
|
||||
#endif
|
||||
, H_CHAMBER
|
||||
);
|
||||
#endif // HAS_TEMP_CHAMBER
|
||||
print_heater_state(H_CHAMBER, degChamber(), TERN0(HAS_HEATED_CHAMBER, degTargetChamber()) OPTARG(SHOW_TEMP_ADC_VALUES, rawChamberTemp()));
|
||||
#endif
|
||||
#if HAS_TEMP_COOLER
|
||||
print_heater_state(degCooler(), TERN0(HAS_COOLER, degTargetCooler())
|
||||
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
||||
, rawCoolerTemp()
|
||||
#endif
|
||||
, H_COOLER
|
||||
);
|
||||
#endif // HAS_TEMP_COOLER
|
||||
print_heater_state(H_COOLER, degCooler(), TERN0(HAS_COOLER, degTargetCooler()) OPTARG(SHOW_TEMP_ADC_VALUES, rawCoolerTemp()));
|
||||
#endif
|
||||
#if HAS_TEMP_PROBE
|
||||
print_heater_state(degProbe(), 0
|
||||
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
||||
, rawProbeTemp()
|
||||
#endif
|
||||
, H_PROBE
|
||||
);
|
||||
print_heater_state(H_PROBE, degProbe(), 0 OPTARG(SHOW_TEMP_ADC_VALUES, rawProbeTemp()) );
|
||||
#endif
|
||||
#if HAS_MULTI_HOTEND
|
||||
HOTEND_LOOP() print_heater_state(degHotend(e), degTargetHotend(e)
|
||||
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
||||
, rawHotendTemp(e)
|
||||
#endif
|
||||
, (heater_id_t)e
|
||||
);
|
||||
HOTEND_LOOP() print_heater_state((heater_id_t)e, degHotend(e), degTargetHotend(e) OPTARG(SHOW_TEMP_ADC_VALUES, rawHotendTemp(e)));
|
||||
#endif
|
||||
SERIAL_ECHOPAIR(" @:", getHeaterPower((heater_id_t)target_extruder));
|
||||
#if HAS_HEATED_BED
|
||||
@@ -3465,10 +3426,7 @@ void Temperature::isr() {
|
||||
|
||||
#if ENABLED(AUTO_REPORT_TEMPERATURES)
|
||||
AutoReporter<Temperature::AutoReportTemp> Temperature::auto_reporter;
|
||||
void Temperature::AutoReportTemp::report() {
|
||||
print_heater_states(active_extruder);
|
||||
SERIAL_EOL();
|
||||
}
|
||||
void Temperature::AutoReportTemp::report() { print_heater_states(active_extruder); SERIAL_EOL(); }
|
||||
#endif
|
||||
|
||||
#if HAS_HOTEND && HAS_STATUS_MESSAGE
|
||||
@@ -3495,11 +3453,8 @@ void Temperature::isr() {
|
||||
#endif
|
||||
|
||||
bool Temperature::wait_for_hotend(const uint8_t target_extruder, const bool no_wait_for_cooling/*=true*/
|
||||
#if G26_CLICK_CAN_CANCEL
|
||||
, const bool click_to_cancel/*=false*/
|
||||
#endif
|
||||
OPTARG(G26_CLICK_CAN_CANCEL, const bool click_to_cancel/*=false*/)
|
||||
) {
|
||||
|
||||
#if ENABLED(AUTOTEMP)
|
||||
REMEMBER(1, planner.autotemp_enabled, false);
|
||||
#endif
|
||||
@@ -3638,9 +3593,7 @@ void Temperature::isr() {
|
||||
#endif
|
||||
|
||||
bool Temperature::wait_for_bed(const bool no_wait_for_cooling/*=true*/
|
||||
#if G26_CLICK_CAN_CANCEL
|
||||
, const bool click_to_cancel/*=false*/
|
||||
#endif
|
||||
OPTARG(G26_CLICK_CAN_CANCEL, const bool click_to_cancel/*=false*/)
|
||||
) {
|
||||
#if TEMP_BED_RESIDENCY_TIME > 0
|
||||
millis_t residency_start_ms = 0;
|
||||
|
||||
Reference in New Issue
Block a user