Fix AutoReporter implementation (#20959)
This commit is contained in:
parent
27366197f3
commit
07b4cc145b
@ -23,14 +23,14 @@
|
|||||||
|
|
||||||
#include "../inc/MarlinConfig.h"
|
#include "../inc/MarlinConfig.h"
|
||||||
|
|
||||||
template<serial_index_t AR_PORT_INDEX>
|
template <typename Helper>
|
||||||
class AutoReporter {
|
struct AutoReporter {
|
||||||
public:
|
|
||||||
millis_t next_report_ms;
|
millis_t next_report_ms;
|
||||||
uint8_t report_interval;
|
uint8_t report_interval;
|
||||||
|
#if HAS_MULTI_SERIAL
|
||||||
// Override this method
|
serial_index_t report_port_mask;
|
||||||
inline void auto_report() { }
|
AutoReporter() : report_port_mask(SERIAL_ALL) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
inline void set_interval(uint8_t seconds, const uint8_t limit=60) {
|
inline void set_interval(uint8_t seconds, const uint8_t limit=60) {
|
||||||
report_interval = _MIN(seconds, limit);
|
report_interval = _MIN(seconds, limit);
|
||||||
@ -42,8 +42,8 @@ public:
|
|||||||
const millis_t ms = millis();
|
const millis_t ms = millis();
|
||||||
if (ELAPSED(ms, next_report_ms)) {
|
if (ELAPSED(ms, next_report_ms)) {
|
||||||
next_report_ms = ms + SEC_TO_MS(report_interval);
|
next_report_ms = ms + SEC_TO_MS(report_interval);
|
||||||
PORT_REDIRECT(AR_PORT_INDEX);
|
TERN_(HAS_MULTI_SERIAL, PORT_REDIRECT(report_port_mask));
|
||||||
auto_report();
|
Helper::report();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -3123,8 +3123,8 @@ void Temperature::tick() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLED(AUTO_REPORT_TEMPERATURES)
|
#if ENABLED(AUTO_REPORT_TEMPERATURES)
|
||||||
Temperature::AutoReportTemp Temperature::auto_reporter;
|
AutoReporter<Temperature::AutoReportTemp> Temperature::auto_reporter;
|
||||||
void Temperature::AutoReportTemp::auto_report() {
|
void Temperature::AutoReportTemp::report() {
|
||||||
print_heater_states(active_extruder);
|
print_heater_states(active_extruder);
|
||||||
SERIAL_EOL();
|
SERIAL_EOL();
|
||||||
}
|
}
|
||||||
|
@ -798,8 +798,8 @@ class Temperature {
|
|||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
#if ENABLED(AUTO_REPORT_TEMPERATURES)
|
#if ENABLED(AUTO_REPORT_TEMPERATURES)
|
||||||
class AutoReportTemp : public AutoReporter<SERIAL_ALL> { void auto_report(); };
|
struct AutoReportTemp { static void report(); };
|
||||||
static AutoReportTemp auto_reporter;
|
static AutoReporter<AutoReportTemp> auto_reporter;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1226,9 +1226,7 @@ void CardReader::fileHasFinished() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLED(AUTO_REPORT_SD_STATUS)
|
#if ENABLED(AUTO_REPORT_SD_STATUS)
|
||||||
TERN_(HAS_MULTI_SERIAL, serial_index_t CardReader::auto_report_port);
|
AutoReporter<CardReader::AutoReportSD> CardReader::auto_reporter;
|
||||||
CardReader::AutoReportSD CardReader::auto_reporter;
|
|
||||||
void CardReader::AutoReportSD::auto_report() { report_status(); }
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||||
|
@ -179,13 +179,8 @@ public:
|
|||||||
//
|
//
|
||||||
// SD Auto Reporting
|
// SD Auto Reporting
|
||||||
//
|
//
|
||||||
#if HAS_MULTI_SERIAL
|
struct AutoReportSD { static void report() { report_status(); } };
|
||||||
static serial_index_t auto_report_port;
|
static AutoReporter<AutoReportSD> auto_reporter;
|
||||||
#else
|
|
||||||
static constexpr serial_index_t auto_report_port = 0;
|
|
||||||
#endif
|
|
||||||
class AutoReportSD : public AutoReporter<auto_report_port> { void auto_report(); };
|
|
||||||
static AutoReportSD auto_reporter;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -37,14 +37,15 @@ opt_set MOTHERBOARD BOARD_RAMPS_14_RE_ARM_EEB
|
|||||||
opt_set EXTRUDERS 2
|
opt_set EXTRUDERS 2
|
||||||
opt_set TEMP_SENSOR_1 -1
|
opt_set TEMP_SENSOR_1 -1
|
||||||
opt_set TEMP_SENSOR_BED 5
|
opt_set TEMP_SENSOR_BED 5
|
||||||
opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER SDSUPPORT ADAPTIVE_FAN_SLOWING NO_FAN_SLOWING_IN_PID_TUNING \
|
opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER ADAPTIVE_FAN_SLOWING NO_FAN_SLOWING_IN_PID_TUNING \
|
||||||
FILAMENT_WIDTH_SENSOR FILAMENT_LCD_DISPLAY PID_EXTRUSION_SCALING SOUND_MENU_ITEM \
|
FILAMENT_WIDTH_SENSOR FILAMENT_LCD_DISPLAY PID_EXTRUSION_SCALING SOUND_MENU_ITEM \
|
||||||
NOZZLE_AS_PROBE AUTO_BED_LEVELING_BILINEAR PREHEAT_BEFORE_LEVELING G29_RETRY_AND_RECOVER Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \
|
NOZZLE_AS_PROBE AUTO_BED_LEVELING_BILINEAR PREHEAT_BEFORE_LEVELING G29_RETRY_AND_RECOVER Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \
|
||||||
BABYSTEPPING BABYSTEP_XY BABYSTEP_ZPROBE_OFFSET BABYSTEP_ZPROBE_GFX_OVERLAY \
|
BABYSTEPPING BABYSTEP_XY BABYSTEP_ZPROBE_OFFSET BABYSTEP_ZPROBE_GFX_OVERLAY \
|
||||||
PRINTCOUNTER NOZZLE_PARK_FEATURE NOZZLE_CLEAN_FEATURE SLOW_PWM_HEATERS PIDTEMPBED EEPROM_SETTINGS INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT \
|
PRINTCOUNTER NOZZLE_PARK_FEATURE NOZZLE_CLEAN_FEATURE SLOW_PWM_HEATERS PIDTEMPBED EEPROM_SETTINGS INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT \
|
||||||
Z_SAFE_HOMING ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE \
|
Z_SAFE_HOMING ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE \
|
||||||
HOST_KEEPALIVE_FEATURE HOST_ACTION_COMMANDS HOST_PROMPT_SUPPORT \
|
HOST_KEEPALIVE_FEATURE HOST_ACTION_COMMANDS HOST_PROMPT_SUPPORT \
|
||||||
LCD_INFO_MENU ARC_SUPPORT BEZIER_CURVE_SUPPORT EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES SDCARD_SORT_ALPHA EMERGENCY_PARSER
|
LCD_INFO_MENU ARC_SUPPORT BEZIER_CURVE_SUPPORT EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES \
|
||||||
|
SDSUPPORT SDCARD_SORT_ALPHA AUTO_REPORT_SD_STATUS EMERGENCY_PARSER
|
||||||
opt_set GRID_MAX_POINTS_X 16
|
opt_set GRID_MAX_POINTS_X 16
|
||||||
opt_set NOZZLE_TO_PROBE_OFFSET "{ 0, 0, 0 }"
|
opt_set NOZZLE_TO_PROBE_OFFSET "{ 0, 0, 0 }"
|
||||||
opt_set NOZZLE_CLEAN_MIN_TEMP 170
|
opt_set NOZZLE_CLEAN_MIN_TEMP 170
|
||||||
|
@ -27,7 +27,7 @@ opt_set TEMP_SENSOR_4 1000
|
|||||||
opt_set TEMP_SENSOR_BED 1
|
opt_set TEMP_SENSOR_BED 1
|
||||||
opt_enable AUTO_BED_LEVELING_UBL RESTORE_LEVELING_AFTER_G28 DEBUG_LEVELING_FEATURE G26_MESH_VALIDATION ENABLE_LEVELING_FADE_HEIGHT SKEW_CORRECTION \
|
opt_enable AUTO_BED_LEVELING_UBL RESTORE_LEVELING_AFTER_G28 DEBUG_LEVELING_FEATURE G26_MESH_VALIDATION ENABLE_LEVELING_FADE_HEIGHT SKEW_CORRECTION \
|
||||||
REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER LIGHTWEIGHT_UI STATUS_MESSAGE_SCROLLING BOOT_MARLIN_LOGO_SMALL \
|
REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER LIGHTWEIGHT_UI STATUS_MESSAGE_SCROLLING BOOT_MARLIN_LOGO_SMALL \
|
||||||
SDSUPPORT SDCARD_SORT_ALPHA USB_FLASH_DRIVE_SUPPORT SCROLL_LONG_FILENAMES CANCEL_OBJECTS SOUND_MENU_ITEM \
|
SDSUPPORT SDCARD_SORT_ALPHA USB_FLASH_DRIVE_SUPPORT AUTO_REPORT_SD_STATUS SCROLL_LONG_FILENAMES CANCEL_OBJECTS SOUND_MENU_ITEM \
|
||||||
EEPROM_SETTINGS EEPROM_CHITCHAT GCODE_MACROS CUSTOM_USER_MENUS \
|
EEPROM_SETTINGS EEPROM_CHITCHAT GCODE_MACROS CUSTOM_USER_MENUS \
|
||||||
MULTI_NOZZLE_DUPLICATION CLASSIC_JERK LIN_ADVANCE EXTRA_LIN_ADVANCE_K QUICK_HOME \
|
MULTI_NOZZLE_DUPLICATION CLASSIC_JERK LIN_ADVANCE EXTRA_LIN_ADVANCE_K QUICK_HOME \
|
||||||
LCD_SET_PROGRESS_MANUALLY PRINT_PROGRESS_SHOW_DECIMALS SHOW_REMAINING_TIME \
|
LCD_SET_PROGRESS_MANUALLY PRINT_PROGRESS_SHOW_DECIMALS SHOW_REMAINING_TIME \
|
||||||
|
Loading…
Reference in New Issue
Block a user