AutoReport class (Temperature, Cardreader) (#20913)

This commit is contained in:
Scott Lahteine
2021-01-28 20:40:20 -06:00
committed by GitHub
parent 9e004a9496
commit 9d0e64a725
16 changed files with 110 additions and 84 deletions

View File

@ -3553,7 +3553,7 @@ void EachMomentUpdate() {
static millis_t next_remain_time_update = 0;
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);
next_remain_time_update += 20 * 1000UL;
next_remain_time_update += SEC_TO_MS(20);
Draw_Print_ProgressRemain();
}
}

View File

@ -43,8 +43,8 @@
#define min(a,b) ((a)<(b)?(a):(b))
#else
namespace UI {
static inline uint32_t safe_millis() {return millis();};
static inline void yield() {};
static inline uint32_t safe_millis() { return millis(); }
static inline void yield() {}
};
#endif

View File

@ -889,7 +889,7 @@ void GUI_RefreshPage() {
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_count = 0;
lv_clear_wifi_tips();
@ -898,7 +898,7 @@ void GUI_RefreshPage() {
}
break;
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_count = 0;
@ -908,7 +908,7 @@ void GUI_RefreshPage() {
}
break;
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_count = 0;

View File

@ -89,8 +89,8 @@ void SysTick_Callback() {
#endif
if (uiCfg.filament_loading_time_flg) {
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);
if (uiCfg.filament_loading_time_cnt >= (uiCfg.filament_loading_time * 1000)) {
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 >= SEC_TO_MS(uiCfg.filament_loading_time)) {
uiCfg.filament_loading_time_cnt = 0;
uiCfg.filament_loading_time_flg = false;
uiCfg.filament_loading_completed = true;
@ -98,8 +98,8 @@ void SysTick_Callback() {
}
if (uiCfg.filament_unloading_time_flg) {
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);
if (uiCfg.filament_unloading_time_cnt >= (uiCfg.filament_unloading_time * 1000)) {
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 >= SEC_TO_MS(uiCfg.filament_unloading_time)) {
uiCfg.filament_unloading_time_cnt = 0;
uiCfg.filament_unloading_time_flg = false;
uiCfg.filament_unloading_completed = true;

View File

@ -123,7 +123,7 @@ namespace ExtUI {
// Machine was killed, reinit SysTick so we are able to compute time without ISRs
if (currTimeHI == 0) {
// 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
SysTick->LOAD = SysTick_LOAD_RELOAD_Msk; // get the full range for the systick timer
@ -148,9 +148,9 @@ namespace ExtUI {
}
#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)
DELAY_US(ms * 1000);
else

View File

@ -155,7 +155,7 @@ namespace ExtUI {
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); }
typedef enum : unsigned char {
typedef enum : uint8_t {
MESH_START, // Prior to start of probe
MESH_FINISH, // Following probe of all points
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
#endif
void delay_us(unsigned long us);
void delay_ms(unsigned long ms);
void delay_us(uint32_t us);
void delay_ms(uint32_t ms);
void yield();
/**