Fix AutoReporter implementation (#20959)

2.0.x
X-Ryl669 4 years ago committed by GitHub
parent 27366197f3
commit 07b4cc145b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -23,14 +23,14 @@
#include "../inc/MarlinConfig.h"
template<serial_index_t AR_PORT_INDEX>
class AutoReporter {
public:
template <typename Helper>
struct AutoReporter {
millis_t next_report_ms;
uint8_t report_interval;
// Override this method
inline void auto_report() { }
#if HAS_MULTI_SERIAL
serial_index_t report_port_mask;
AutoReporter() : report_port_mask(SERIAL_ALL) {}
#endif
inline void set_interval(uint8_t seconds, const uint8_t limit=60) {
report_interval = _MIN(seconds, limit);
@ -42,8 +42,8 @@ public:
const millis_t ms = millis();
if (ELAPSED(ms, next_report_ms)) {
next_report_ms = ms + SEC_TO_MS(report_interval);
PORT_REDIRECT(AR_PORT_INDEX);
auto_report();
TERN_(HAS_MULTI_SERIAL, PORT_REDIRECT(report_port_mask));
Helper::report();
}
}
};

@ -3123,8 +3123,8 @@ void Temperature::tick() {
}
#if ENABLED(AUTO_REPORT_TEMPERATURES)
Temperature::AutoReportTemp Temperature::auto_reporter;
void Temperature::AutoReportTemp::auto_report() {
AutoReporter<Temperature::AutoReportTemp> Temperature::auto_reporter;
void Temperature::AutoReportTemp::report() {
print_heater_states(active_extruder);
SERIAL_EOL();
}

@ -798,8 +798,8 @@ class Temperature {
#endif
);
#if ENABLED(AUTO_REPORT_TEMPERATURES)
class AutoReportTemp : public AutoReporter<SERIAL_ALL> { void auto_report(); };
static AutoReportTemp auto_reporter;
struct AutoReportTemp { static void report(); };
static AutoReporter<AutoReportTemp> auto_reporter;
#endif
#endif

@ -1226,9 +1226,7 @@ void CardReader::fileHasFinished() {
}
#if ENABLED(AUTO_REPORT_SD_STATUS)
TERN_(HAS_MULTI_SERIAL, serial_index_t CardReader::auto_report_port);
CardReader::AutoReportSD CardReader::auto_reporter;
void CardReader::AutoReportSD::auto_report() { report_status(); }
AutoReporter<CardReader::AutoReportSD> CardReader::auto_reporter;
#endif
#if ENABLED(POWER_LOSS_RECOVERY)

@ -179,13 +179,8 @@ public:
//
// SD Auto Reporting
//
#if HAS_MULTI_SERIAL
static serial_index_t auto_report_port;
#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;
struct AutoReportSD { static void report() { report_status(); } };
static AutoReporter<AutoReportSD> auto_reporter;
#endif
private:

@ -37,14 +37,15 @@ opt_set MOTHERBOARD BOARD_RAMPS_14_RE_ARM_EEB
opt_set EXTRUDERS 2
opt_set TEMP_SENSOR_1 -1
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 \
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 \
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 \
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 NOZZLE_TO_PROBE_OFFSET "{ 0, 0, 0 }"
opt_set NOZZLE_CLEAN_MIN_TEMP 170

@ -27,7 +27,7 @@ opt_set TEMP_SENSOR_4 1000
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 \
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 \
MULTI_NOZZLE_DUPLICATION CLASSIC_JERK LIN_ADVANCE EXTRA_LIN_ADVANCE_K QUICK_HOME \
LCD_SET_PROGRESS_MANUALLY PRINT_PROGRESS_SHOW_DECIMALS SHOW_REMAINING_TIME \

Loading…
Cancel
Save