Browse Source

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
Guðni Már Gilbert 3 years ago
parent
commit
66782e9c9d
2 changed files with 4 additions and 4 deletions
  1. 3 3
      Firmware/Marlin_main.cpp
  2. 1 1
      Firmware/temperature.h

+ 3 - 3
Firmware/Marlin_main.cpp

@@ -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)
 	{

+ 1 - 1
Firmware/temperature.h

@@ -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) {