setTargetHotend expect an uint8_t, not int for second parameter

also change _usb_timer to ShortTimer

Saves 28 bytes of Flash and 1 byte of SRAM
This commit is contained in:
Guðni Már Gilbert 2021-08-25 12:17:54 +00:00
parent 77cce1fc05
commit 66782e9c9d
2 changed files with 4 additions and 4 deletions

View File

@ -364,7 +364,7 @@ static unsigned long safetytimer_inactive_time = DEFAULT_SAFETYTIMER_TIME_MINS*6
unsigned long starttime=0;
unsigned long stoptime=0;
unsigned long _usb_timer = 0;
ShortTimer _usb_timer;
bool Stopped=false;
@ -1894,11 +1894,11 @@ void loop()
{
KEEPALIVE_STATE(NOT_BUSY);
if ((usb_printing_counter > 0) && ((_millis()-_usb_timer) > 1000))
if ((usb_printing_counter > 0) && _usb_timer.expired(1000))
{
is_usb_printing = true;
usb_printing_counter--;
_usb_timer = _millis();
_usb_timer.start(); // reset timer
}
if (usb_printing_counter == 0)
{

View File

@ -168,7 +168,7 @@ static inline void setTargetHotendSafe(const float &celsius, uint8_t extruder)
// Doesn't save FLASH when not inlined.
static inline void setAllTargetHotends(const float &celsius)
{
for(int i=0;i<EXTRUDERS;i++) setTargetHotend(celsius,i);
for(uint8_t i = 0; i < EXTRUDERS; i++) setTargetHotend(celsius, i);
}
FORCE_INLINE void setTargetBed(const float &celsius) {