Convert NcTime to ShortTimer

The variable is only used in ultralcd.cpp so I made it static there
and deleted it from Marlin_main.cpp

Saves 24 bytes of flash and 1 byte of SRAM
This commit is contained in:
Guðni Már Gilbert 2021-08-26 20:56:45 +00:00
parent a1abd094dd
commit 37fd9d1b11
3 changed files with 3 additions and 5 deletions

View File

@ -330,7 +330,6 @@ extern unsigned int status_number;
extern unsigned int heating_status_counter; extern unsigned int heating_status_counter;
extern char snmm_filaments_used; extern char snmm_filaments_used;
extern unsigned long PingTime; extern unsigned long PingTime;
extern unsigned long NcTime;
extern bool no_response; extern bool no_response;
extern uint8_t important_status; extern uint8_t important_status;
extern uint8_t saved_filament_type; extern uint8_t saved_filament_type;

View File

@ -161,7 +161,6 @@ CardReader card;
#endif #endif
unsigned long PingTime = _millis(); unsigned long PingTime = _millis();
unsigned long NcTime;
uint8_t mbl_z_probe_nr = 3; //numer of Z measurements for each point in mesh bed leveling calibration uint8_t mbl_z_probe_nr = 3; //numer of Z measurements for each point in mesh bed leveling calibration

View File

@ -55,7 +55,7 @@
int clock_interval = 0; int clock_interval = 0;
static ShortTimer NcTime;
static void lcd_sd_updir(); static void lcd_sd_updir();
static void lcd_mesh_bed_leveling_settings(); static void lcd_mesh_bed_leveling_settings();
#ifdef LCD_BL_PIN #ifdef LCD_BL_PIN
@ -8705,10 +8705,10 @@ void lcd_printer_connected() {
} }
static void lcd_send_status() { static void lcd_send_status() {
if (farm_mode && no_response && ((_millis() - NcTime) > (NC_TIME * 1000))) { if (farm_mode && no_response && (NcTime.expired(NC_TIME * 1000))) {
//send important status messages periodicaly //send important status messages periodicaly
prusa_statistics(important_status, saved_filament_type); prusa_statistics(important_status, saved_filament_type);
NcTime = _millis(); NcTime.start();
#ifdef FARM_CONNECT_MESSAGE #ifdef FARM_CONNECT_MESSAGE
lcd_connect_printer(); lcd_connect_printer();
#endif //FARM_CONNECT_MESSAGE #endif //FARM_CONNECT_MESSAGE