Browse Source

Allow disable of POWER_TIMEOUT (#21771)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
Elton Law 4 years ago
parent
commit
661395a3b2
No account linked to committer's email address
1 changed files with 5 additions and 1 deletions
  1. 5
    1
      Marlin/src/feature/power.cpp

+ 5
- 1
Marlin/src/feature/power.cpp View File

99
   return false;
99
   return false;
100
 }
100
 }
101
 
101
 
102
+#ifndef POWER_TIMEOUT
103
+  #define POWER_TIMEOUT 0
104
+#endif
105
+
102
 void Power::check() {
106
 void Power::check() {
103
   static millis_t nextPowerCheck = 0;
107
   static millis_t nextPowerCheck = 0;
104
   millis_t ms = millis();
108
   millis_t ms = millis();
106
     nextPowerCheck = ms + 2500UL;
110
     nextPowerCheck = ms + 2500UL;
107
     if (is_power_needed())
111
     if (is_power_needed())
108
       power_on();
112
       power_on();
109
-    else if (!lastPowerOn || ELAPSED(ms, lastPowerOn + SEC_TO_MS(POWER_TIMEOUT)))
113
+    else if (!lastPowerOn || (POWER_TIMEOUT > 0 && ELAPSED(ms, lastPowerOn + SEC_TO_MS(POWER_TIMEOUT))))
110
       power_off();
114
       power_off();
111
   }
115
   }
112
 }
116
 }

Loading…
Cancel
Save