Преглед изворни кода

help residency not overflow

Michael Moon пре 12 година
родитељ
комит
2ae2ead97b
1 измењених фајлова са 3 додато и 3 уклоњено
  1. 3
    3
      Marlin/Marlin.pde

+ 3
- 3
Marlin/Marlin.pde Прегледај датотеку

@@ -843,11 +843,11 @@ FORCE_INLINE void process_commands()
843 843
         /* continue to loop until we have reached the target temp   
844 844
           _and_ until TEMP_RESIDENCY_TIME hasn't passed since we reached it */
845 845
         while((residencyStart == -1) ||
846
-              (residencyStart > -1 && (millis() - residencyStart) < TEMP_RESIDENCY_TIME*1000) ) {
846
+              (residencyStart >= 0 && (((unsigned int) (millis() - residencyStart)) < (TEMP_RESIDENCY_TIME * 1000UL))) ) {
847 847
       #else
848 848
         while ( target_direction ? (isHeatingHotend(tmp_extruder)) : (isCoolingHotend(tmp_extruder)&&(CooldownNoWait==false)) ) {
849 849
       #endif //TEMP_RESIDENCY_TIME
850
-          if( (millis() - codenum) > 1000 ) 
850
+          if( (millis() - codenum) > 1000UL )
851 851
           { //Print Temp Reading and remaining time every 1 second while heating up/cooling down
852 852
             SERIAL_PROTOCOLPGM("T:");
853 853
             SERIAL_PROTOCOL( degHotend(tmp_extruder) ); 
@@ -857,7 +857,7 @@ FORCE_INLINE void process_commands()
857 857
               SERIAL_PROTOCOLPGM(" W:");
858 858
               if(residencyStart > -1)
859 859
               {
860
-                 codenum = TEMP_RESIDENCY_TIME - ((millis() - residencyStart) / 1000);
860
+                 codenum = ((TEMP_RESIDENCY_TIME * 1000UL) - (millis() - residencyStart)) / 1000UL;
861 861
                  SERIAL_PROTOCOLLN( codenum );
862 862
               }
863 863
               else 

Loading…
Откажи
Сачувај