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,6 +99,10 @@ bool Power::is_power_needed() {
99 99
   return false;
100 100
 }
101 101
 
102
+#ifndef POWER_TIMEOUT
103
+  #define POWER_TIMEOUT 0
104
+#endif
105
+
102 106
 void Power::check() {
103 107
   static millis_t nextPowerCheck = 0;
104 108
   millis_t ms = millis();
@@ -106,7 +110,7 @@ void Power::check() {
106 110
     nextPowerCheck = ms + 2500UL;
107 111
     if (is_power_needed())
108 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 114
       power_off();
111 115
   }
112 116
 }

Loading…
Cancel
Save