AutoReport class (Temperature, Cardreader) (#20913)
This commit is contained in:
parent
b44de74b91
commit
4b9f2f13b1
@ -687,8 +687,8 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
|
|||||||
// Auto-report Temperatures / SD Status
|
// Auto-report Temperatures / SD Status
|
||||||
#if HAS_AUTO_REPORTING
|
#if HAS_AUTO_REPORTING
|
||||||
if (!gcode.autoreport_paused) {
|
if (!gcode.autoreport_paused) {
|
||||||
TERN_(AUTO_REPORT_TEMPERATURES, thermalManager.auto_report_temperatures());
|
TERN_(AUTO_REPORT_TEMPERATURES, thermalManager.auto_reporter.tick());
|
||||||
TERN_(AUTO_REPORT_SD_STATUS, card.auto_report_sd_status());
|
TERN_(AUTO_REPORT_SD_STATUS, card.auto_reporter.tick());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ void GcodeSuite::G76() {
|
|||||||
|
|
||||||
say_waiting_for_probe_heating();
|
say_waiting_for_probe_heating();
|
||||||
SERIAL_ECHOLNPAIR(" Bed:", target_bed, " Probe:", target_probe);
|
SERIAL_ECHOLNPAIR(" Bed:", target_bed, " Probe:", target_probe);
|
||||||
const millis_t probe_timeout_ms = millis() + 900UL * 1000UL;
|
const millis_t probe_timeout_ms = millis() + SEC_TO_MS(900UL);
|
||||||
while (thermalManager.degProbe() < target_probe) {
|
while (thermalManager.degProbe() < target_probe) {
|
||||||
if (report_temps(next_temp_report, probe_timeout_ms)) {
|
if (report_temps(next_temp_report, probe_timeout_ms)) {
|
||||||
SERIAL_ECHOLNPGM("!Probe heating timed out.");
|
SERIAL_ECHOLNPGM("!Probe heating timed out.");
|
||||||
|
@ -92,7 +92,7 @@ void GcodeSuite::M1001() {
|
|||||||
printerEventLEDs.onPrintCompleted();
|
printerEventLEDs.onPrintCompleted();
|
||||||
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_PRINT_DONE)));
|
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_PRINT_DONE)));
|
||||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_PRINT_DONE), CONTINUE_STR));
|
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_PRINT_DONE), CONTINUE_STR));
|
||||||
wait_for_user_response(1000UL * TERN(HAS_LCD_MENU, PE_LEDS_COMPLETED_TIME, 30));
|
wait_for_user_response(SEC_TO_MS(TERN(HAS_LCD_MENU, PE_LEDS_COMPLETED_TIME, 30)));
|
||||||
printerEventLEDs.onResumeAfterWait();
|
printerEventLEDs.onResumeAfterWait();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -36,15 +36,17 @@ void GcodeSuite::M27() {
|
|||||||
if (parser.seen('C')) {
|
if (parser.seen('C')) {
|
||||||
SERIAL_ECHOPGM("Current file: ");
|
SERIAL_ECHOPGM("Current file: ");
|
||||||
card.printFilename();
|
card.printFilename();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLED(AUTO_REPORT_SD_STATUS)
|
#if ENABLED(AUTO_REPORT_SD_STATUS)
|
||||||
else if (parser.seenval('S'))
|
if (parser.seenval('S')) {
|
||||||
card.set_auto_report_interval(parser.value_byte());
|
card.auto_reporter.set_interval(parser.value_byte());
|
||||||
|
return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
else
|
card.report_status();
|
||||||
card.report_status();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // SDSUPPORT
|
#endif // SDSUPPORT
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
void GcodeSuite::M155() {
|
void GcodeSuite::M155() {
|
||||||
|
|
||||||
if (parser.seenval('S'))
|
if (parser.seenval('S'))
|
||||||
thermalManager.set_auto_report_interval(parser.value_byte());
|
thermalManager.auto_reporter.set_interval(parser.value_byte());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3553,7 +3553,7 @@ void EachMomentUpdate() {
|
|||||||
static millis_t next_remain_time_update = 0;
|
static millis_t next_remain_time_update = 0;
|
||||||
if (Percentrecord > 1 && ELAPSED(ms, next_remain_time_update) && !HMI_flag.heat_flag) {
|
if (Percentrecord > 1 && ELAPSED(ms, next_remain_time_update) && !HMI_flag.heat_flag) {
|
||||||
remain_time = (elapsed.value - dwin_heat_time) / (Percentrecord * 0.01f) - (elapsed.value - dwin_heat_time);
|
remain_time = (elapsed.value - dwin_heat_time) / (Percentrecord * 0.01f) - (elapsed.value - dwin_heat_time);
|
||||||
next_remain_time_update += 20 * 1000UL;
|
next_remain_time_update += SEC_TO_MS(20);
|
||||||
Draw_Print_ProgressRemain();
|
Draw_Print_ProgressRemain();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,8 +43,8 @@
|
|||||||
#define min(a,b) ((a)<(b)?(a):(b))
|
#define min(a,b) ((a)<(b)?(a):(b))
|
||||||
#else
|
#else
|
||||||
namespace UI {
|
namespace UI {
|
||||||
static inline uint32_t safe_millis() {return millis();};
|
static inline uint32_t safe_millis() { return millis(); }
|
||||||
static inline void yield() {};
|
static inline void yield() {}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -889,7 +889,7 @@ void GUI_RefreshPage() {
|
|||||||
lv_draw_wifi_tips();
|
lv_draw_wifi_tips();
|
||||||
|
|
||||||
}
|
}
|
||||||
if (tips_disp.timer_count >= 30 * 1000) {
|
if (tips_disp.timer_count >= SEC_TO_MS(30)) {
|
||||||
tips_disp.timer = TIPS_TIMER_STOP;
|
tips_disp.timer = TIPS_TIMER_STOP;
|
||||||
tips_disp.timer_count = 0;
|
tips_disp.timer_count = 0;
|
||||||
lv_clear_wifi_tips();
|
lv_clear_wifi_tips();
|
||||||
@ -898,7 +898,7 @@ void GUI_RefreshPage() {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TIPS_TYPE_TAILED_JOIN:
|
case TIPS_TYPE_TAILED_JOIN:
|
||||||
if (tips_disp.timer_count >= 3 * 1000) {
|
if (tips_disp.timer_count >= SEC_TO_MS(3)) {
|
||||||
tips_disp.timer = TIPS_TIMER_STOP;
|
tips_disp.timer = TIPS_TIMER_STOP;
|
||||||
tips_disp.timer_count = 0;
|
tips_disp.timer_count = 0;
|
||||||
|
|
||||||
@ -908,7 +908,7 @@ void GUI_RefreshPage() {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TIPS_TYPE_WIFI_CONECTED:
|
case TIPS_TYPE_WIFI_CONECTED:
|
||||||
if (tips_disp.timer_count >= 3 * 1000) {
|
if (tips_disp.timer_count >= SEC_TO_MS(3)) {
|
||||||
tips_disp.timer = TIPS_TIMER_STOP;
|
tips_disp.timer = TIPS_TIMER_STOP;
|
||||||
tips_disp.timer_count = 0;
|
tips_disp.timer_count = 0;
|
||||||
|
|
||||||
|
@ -89,8 +89,8 @@ void SysTick_Callback() {
|
|||||||
#endif
|
#endif
|
||||||
if (uiCfg.filament_loading_time_flg) {
|
if (uiCfg.filament_loading_time_flg) {
|
||||||
uiCfg.filament_loading_time_cnt++;
|
uiCfg.filament_loading_time_cnt++;
|
||||||
uiCfg.filament_rate = (uint32_t)(((uiCfg.filament_loading_time_cnt / (uiCfg.filament_loading_time * 1000.0)) * 100.0) + 0.5);
|
uiCfg.filament_rate = uint32_t(100.0f * uiCfg.filament_loading_time_cnt / SEC_TO_MS(uiCfg.filament_loading_time) + 0.5f);
|
||||||
if (uiCfg.filament_loading_time_cnt >= (uiCfg.filament_loading_time * 1000)) {
|
if (uiCfg.filament_loading_time_cnt >= SEC_TO_MS(uiCfg.filament_loading_time)) {
|
||||||
uiCfg.filament_loading_time_cnt = 0;
|
uiCfg.filament_loading_time_cnt = 0;
|
||||||
uiCfg.filament_loading_time_flg = false;
|
uiCfg.filament_loading_time_flg = false;
|
||||||
uiCfg.filament_loading_completed = true;
|
uiCfg.filament_loading_completed = true;
|
||||||
@ -98,8 +98,8 @@ void SysTick_Callback() {
|
|||||||
}
|
}
|
||||||
if (uiCfg.filament_unloading_time_flg) {
|
if (uiCfg.filament_unloading_time_flg) {
|
||||||
uiCfg.filament_unloading_time_cnt++;
|
uiCfg.filament_unloading_time_cnt++;
|
||||||
uiCfg.filament_rate = (uint32_t)(((uiCfg.filament_unloading_time_cnt / (uiCfg.filament_unloading_time * 1000.0)) * 100.0) + 0.5);
|
uiCfg.filament_rate = uint32_t(100.0f * uiCfg.filament_unloading_time_cnt / SEC_TO_MS(uiCfg.filament_unloading_time) + 0.5f);
|
||||||
if (uiCfg.filament_unloading_time_cnt >= (uiCfg.filament_unloading_time * 1000)) {
|
if (uiCfg.filament_unloading_time_cnt >= SEC_TO_MS(uiCfg.filament_unloading_time)) {
|
||||||
uiCfg.filament_unloading_time_cnt = 0;
|
uiCfg.filament_unloading_time_cnt = 0;
|
||||||
uiCfg.filament_unloading_time_flg = false;
|
uiCfg.filament_unloading_time_flg = false;
|
||||||
uiCfg.filament_unloading_completed = true;
|
uiCfg.filament_unloading_completed = true;
|
||||||
|
@ -123,7 +123,7 @@ namespace ExtUI {
|
|||||||
// Machine was killed, reinit SysTick so we are able to compute time without ISRs
|
// Machine was killed, reinit SysTick so we are able to compute time without ISRs
|
||||||
if (currTimeHI == 0) {
|
if (currTimeHI == 0) {
|
||||||
// Get the last time the Arduino time computed (from CMSIS) and convert it to SysTick
|
// Get the last time the Arduino time computed (from CMSIS) and convert it to SysTick
|
||||||
currTimeHI = (uint32_t)((GetTickCount() * (uint64_t)(F_CPU / 8000)) >> 24);
|
currTimeHI = uint32_t((GetTickCount() * uint64_t(F_CPU / 8000)) >> 24);
|
||||||
|
|
||||||
// Reinit the SysTick timer to maximize its period
|
// Reinit the SysTick timer to maximize its period
|
||||||
SysTick->LOAD = SysTick_LOAD_RELOAD_Msk; // get the full range for the systick timer
|
SysTick->LOAD = SysTick_LOAD_RELOAD_Msk; // get the full range for the systick timer
|
||||||
@ -148,9 +148,9 @@ namespace ExtUI {
|
|||||||
}
|
}
|
||||||
#endif // __SAM3X8E__
|
#endif // __SAM3X8E__
|
||||||
|
|
||||||
void delay_us(unsigned long us) { DELAY_US(us); }
|
void delay_us(uint32_t us) { DELAY_US(us); }
|
||||||
|
|
||||||
void delay_ms(unsigned long ms) {
|
void delay_ms(uint32_t ms) {
|
||||||
if (flags.printer_killed)
|
if (flags.printer_killed)
|
||||||
DELAY_US(ms * 1000);
|
DELAY_US(ms * 1000);
|
||||||
else
|
else
|
||||||
|
@ -155,7 +155,7 @@ namespace ExtUI {
|
|||||||
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval);
|
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval);
|
||||||
inline void onMeshUpdate(const xy_int8_t &pos, const float zval) { onMeshUpdate(pos.x, pos.y, zval); }
|
inline void onMeshUpdate(const xy_int8_t &pos, const float zval) { onMeshUpdate(pos.x, pos.y, zval); }
|
||||||
|
|
||||||
typedef enum : unsigned char {
|
typedef enum : uint8_t {
|
||||||
MESH_START, // Prior to start of probe
|
MESH_START, // Prior to start of probe
|
||||||
MESH_FINISH, // Following probe of all points
|
MESH_FINISH, // Following probe of all points
|
||||||
PROBE_START, // Beginning probe of grid location
|
PROBE_START, // Beginning probe of grid location
|
||||||
@ -302,8 +302,8 @@ namespace ExtUI {
|
|||||||
FORCE_INLINE uint32_t safe_millis() { return millis(); } // TODO: Implement for AVR
|
FORCE_INLINE uint32_t safe_millis() { return millis(); } // TODO: Implement for AVR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void delay_us(unsigned long us);
|
void delay_us(uint32_t us);
|
||||||
void delay_ms(unsigned long ms);
|
void delay_ms(uint32_t ms);
|
||||||
void yield();
|
void yield();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
49
Marlin/src/libs/autoreport.h
Normal file
49
Marlin/src/libs/autoreport.h
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/**
|
||||||
|
* Marlin 3D Printer Firmware
|
||||||
|
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||||
|
*
|
||||||
|
* Based on Sprinter and grbl.
|
||||||
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "../inc/MarlinConfig.h"
|
||||||
|
|
||||||
|
template<serial_index_t AR_PORT_INDEX>
|
||||||
|
class AutoReporter {
|
||||||
|
public:
|
||||||
|
millis_t next_report_ms;
|
||||||
|
uint8_t report_interval;
|
||||||
|
|
||||||
|
// Override this method
|
||||||
|
inline void auto_report() { }
|
||||||
|
|
||||||
|
inline void set_interval(uint8_t seconds, const uint8_t limit=60) {
|
||||||
|
report_interval = _MIN(seconds, limit);
|
||||||
|
next_report_ms = millis() + SEC_TO_MS(seconds);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void tick() {
|
||||||
|
if (!report_interval) return;
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
@ -1276,7 +1276,7 @@ void Temperature::manage_heater() {
|
|||||||
// temperature didn't drop at least MIN_COOLING_SLOPE_DEG_CHAMBER_VENT
|
// temperature didn't drop at least MIN_COOLING_SLOPE_DEG_CHAMBER_VENT
|
||||||
if (next_cool_check_ms_2 == 0 || ELAPSED(ms, next_cool_check_ms_2)) {
|
if (next_cool_check_ms_2 == 0 || ELAPSED(ms, next_cool_check_ms_2)) {
|
||||||
if (old_temp - temp_chamber.celsius < float(MIN_COOLING_SLOPE_DEG_CHAMBER_VENT)) flag_chamber_excess_heat = true; //the bed is heating the chamber too much
|
if (old_temp - temp_chamber.celsius < float(MIN_COOLING_SLOPE_DEG_CHAMBER_VENT)) flag_chamber_excess_heat = true; //the bed is heating the chamber too much
|
||||||
next_cool_check_ms_2 = ms + 1000UL * MIN_COOLING_SLOPE_TIME_CHAMBER_VENT;
|
next_cool_check_ms_2 = ms + SEC_TO_MS(MIN_COOLING_SLOPE_TIME_CHAMBER_VENT);
|
||||||
old_temp = temp_chamber.celsius;
|
old_temp = temp_chamber.celsius;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3123,20 +3123,12 @@ void Temperature::tick() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLED(AUTO_REPORT_TEMPERATURES)
|
#if ENABLED(AUTO_REPORT_TEMPERATURES)
|
||||||
|
Temperature::AutoReportTemp Temperature::auto_reporter;
|
||||||
uint8_t Temperature::auto_report_temp_interval;
|
void Temperature::AutoReportTemp::auto_report() {
|
||||||
millis_t Temperature::next_temp_report_ms;
|
print_heater_states(active_extruder);
|
||||||
|
SERIAL_EOL();
|
||||||
void Temperature::auto_report_temperatures() {
|
|
||||||
if (auto_report_temp_interval && ELAPSED(millis(), next_temp_report_ms)) {
|
|
||||||
next_temp_report_ms = millis() + 1000UL * auto_report_temp_interval;
|
|
||||||
PORT_REDIRECT(SERIAL_ALL);
|
|
||||||
print_heater_states(active_extruder);
|
|
||||||
SERIAL_EOL();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif // AUTO_REPORT_TEMPERATURES
|
|
||||||
|
|
||||||
#if HAS_HOTEND && HAS_DISPLAY
|
#if HAS_HOTEND && HAS_DISPLAY
|
||||||
void Temperature::set_heating_message(const uint8_t e) {
|
void Temperature::set_heating_message(const uint8_t e) {
|
||||||
@ -3252,7 +3244,7 @@ void Temperature::tick() {
|
|||||||
// if the temperature did not drop at least MIN_COOLING_SLOPE_DEG
|
// if the temperature did not drop at least MIN_COOLING_SLOPE_DEG
|
||||||
if (!next_cool_check_ms || ELAPSED(now, next_cool_check_ms)) {
|
if (!next_cool_check_ms || ELAPSED(now, next_cool_check_ms)) {
|
||||||
if (old_temp - temp < float(MIN_COOLING_SLOPE_DEG)) break;
|
if (old_temp - temp < float(MIN_COOLING_SLOPE_DEG)) break;
|
||||||
next_cool_check_ms = now + 1000UL * MIN_COOLING_SLOPE_TIME;
|
next_cool_check_ms = now + SEC_TO_MS(MIN_COOLING_SLOPE_TIME);
|
||||||
old_temp = temp;
|
old_temp = temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3377,7 +3369,7 @@ void Temperature::tick() {
|
|||||||
// if the temperature did not drop at least MIN_COOLING_SLOPE_DEG_BED
|
// if the temperature did not drop at least MIN_COOLING_SLOPE_DEG_BED
|
||||||
if (!next_cool_check_ms || ELAPSED(now, next_cool_check_ms)) {
|
if (!next_cool_check_ms || ELAPSED(now, next_cool_check_ms)) {
|
||||||
if (old_temp - temp < float(MIN_COOLING_SLOPE_DEG_BED)) break;
|
if (old_temp - temp < float(MIN_COOLING_SLOPE_DEG_BED)) break;
|
||||||
next_cool_check_ms = now + 1000UL * MIN_COOLING_SLOPE_TIME_BED;
|
next_cool_check_ms = now + SEC_TO_MS(MIN_COOLING_SLOPE_TIME_BED);
|
||||||
old_temp = temp;
|
old_temp = temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3461,7 +3453,7 @@ void Temperature::tick() {
|
|||||||
SERIAL_ECHOLNPGM("Timed out waiting for probe temperature.");
|
SERIAL_ECHOLNPGM("Timed out waiting for probe temperature.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
next_delta_check_ms = now + 1000UL * MIN_DELTA_SLOPE_TIME_PROBE;
|
next_delta_check_ms = now + SEC_TO_MS(MIN_DELTA_SLOPE_TIME_PROBE);
|
||||||
old_temp = temp;
|
old_temp = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3566,7 +3558,7 @@ void Temperature::tick() {
|
|||||||
// if the temperature did not drop at least MIN_COOLING_SLOPE_DEG_CHAMBER
|
// if the temperature did not drop at least MIN_COOLING_SLOPE_DEG_CHAMBER
|
||||||
if (!next_cool_check_ms || ELAPSED(now, next_cool_check_ms)) {
|
if (!next_cool_check_ms || ELAPSED(now, next_cool_check_ms)) {
|
||||||
if (old_temp - temp < float(MIN_COOLING_SLOPE_DEG_CHAMBER)) break;
|
if (old_temp - temp < float(MIN_COOLING_SLOPE_DEG_CHAMBER)) break;
|
||||||
next_cool_check_ms = now + 1000UL * MIN_COOLING_SLOPE_TIME_CHAMBER;
|
next_cool_check_ms = now + SEC_TO_MS(MIN_COOLING_SLOPE_TIME_CHAMBER);
|
||||||
old_temp = temp;
|
old_temp = temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,10 @@
|
|||||||
#include "../feature/power.h"
|
#include "../feature/power.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ENABLED(AUTO_REPORT_TEMPERATURES)
|
||||||
|
#include "../libs/autoreport.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef SOFT_PWM_SCALE
|
#ifndef SOFT_PWM_SCALE
|
||||||
#define SOFT_PWM_SCALE 0
|
#define SOFT_PWM_SCALE 0
|
||||||
#endif
|
#endif
|
||||||
@ -794,14 +798,8 @@ class Temperature {
|
|||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
#if ENABLED(AUTO_REPORT_TEMPERATURES)
|
#if ENABLED(AUTO_REPORT_TEMPERATURES)
|
||||||
static uint8_t auto_report_temp_interval;
|
class AutoReportTemp : public AutoReporter<SERIAL_ALL> { void auto_report(); };
|
||||||
static millis_t next_temp_report_ms;
|
static AutoReportTemp auto_reporter;
|
||||||
static void auto_report_temperatures();
|
|
||||||
static inline void set_auto_report_interval(uint8_t v) {
|
|
||||||
NOMORE(v, 60);
|
|
||||||
auto_report_temp_interval = v;
|
|
||||||
next_temp_report_ms = millis() + 1000UL * v;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1226,21 +1226,10 @@ void CardReader::fileHasFinished() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLED(AUTO_REPORT_SD_STATUS)
|
#if ENABLED(AUTO_REPORT_SD_STATUS)
|
||||||
uint8_t CardReader::auto_report_sd_interval = 0;
|
TERN_(HAS_MULTI_SERIAL, serial_index_t CardReader::auto_report_port);
|
||||||
millis_t CardReader::next_sd_report_ms;
|
CardReader::AutoReportSD CardReader::auto_reporter;
|
||||||
#if HAS_MULTI_SERIAL
|
void CardReader::AutoReportSD::auto_report() { report_status(); }
|
||||||
serial_index_t CardReader::auto_report_port;
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
void CardReader::auto_report_sd_status() {
|
|
||||||
millis_t current_ms = millis();
|
|
||||||
if (auto_report_sd_interval && ELAPSED(current_ms, next_sd_report_ms)) {
|
|
||||||
next_sd_report_ms = current_ms + 1000UL * auto_report_sd_interval;
|
|
||||||
PORT_REDIRECT(auto_report_port);
|
|
||||||
report_status();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // AUTO_REPORT_SD_STATUS
|
|
||||||
|
|
||||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||||
|
|
||||||
|
@ -59,6 +59,10 @@ typedef struct {
|
|||||||
;
|
;
|
||||||
} card_flags_t;
|
} card_flags_t;
|
||||||
|
|
||||||
|
#if ENABLED(AUTO_REPORT_SD_STATUS)
|
||||||
|
#include "../libs/autoreport.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class CardReader {
|
class CardReader {
|
||||||
public:
|
public:
|
||||||
static card_flags_t flag; // Flags (above)
|
static card_flags_t flag; // Flags (above)
|
||||||
@ -172,13 +176,16 @@ public:
|
|||||||
static Sd2Card& getSd2Card() { return sd2card; }
|
static Sd2Card& getSd2Card() { return sd2card; }
|
||||||
|
|
||||||
#if ENABLED(AUTO_REPORT_SD_STATUS)
|
#if ENABLED(AUTO_REPORT_SD_STATUS)
|
||||||
static void auto_report_sd_status();
|
//
|
||||||
static inline void set_auto_report_interval(uint8_t v) {
|
// SD Auto Reporting
|
||||||
TERN_(HAS_MULTI_SERIAL, auto_report_port = multiSerial.portMask);
|
//
|
||||||
NOMORE(v, 60);
|
#if HAS_MULTI_SERIAL
|
||||||
auto_report_sd_interval = v;
|
static serial_index_t auto_report_port;
|
||||||
next_sd_report_ms = millis() + 1000UL * v;
|
#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:
|
||||||
@ -260,17 +267,6 @@ private:
|
|||||||
static char proc_filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH];
|
static char proc_filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
|
||||||
// SD Auto Reporting
|
|
||||||
//
|
|
||||||
#if ENABLED(AUTO_REPORT_SD_STATUS)
|
|
||||||
static uint8_t auto_report_sd_interval;
|
|
||||||
static millis_t next_sd_report_ms;
|
|
||||||
#if HAS_MULTI_SERIAL
|
|
||||||
static serial_index_t auto_report_port;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Directory items
|
// Directory items
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user