Pārlūkot izejas kodu

🚸 Retain power during Pause (#22227)

Cytown 4 gadus atpakaļ
vecāks
revīzija
61c48b8513

+ 1
- 1
Marlin/src/MarlinCore.cpp Parādīt failu

617
 
617
 
618
   TERN_(USE_CONTROLLER_FAN, controllerFan.update()); // Check if fan should be turned on to cool stepper drivers down
618
   TERN_(USE_CONTROLLER_FAN, controllerFan.update()); // Check if fan should be turned on to cool stepper drivers down
619
 
619
 
620
-  TERN_(AUTO_POWER_CONTROL, powerManager.check());
620
+  TERN_(AUTO_POWER_CONTROL, powerManager.check(!ui.on_status_screen() || printJobOngoing() || printingIsPaused()));
621
 
621
 
622
   TERN_(HOTEND_IDLE_TIMEOUT, hotend_idle.check());
622
   TERN_(HOTEND_IDLE_TIMEOUT, hotend_idle.check());
623
 
623
 

+ 5
- 1
Marlin/src/MarlinCore.h Parādīt failu

91
     #define PSU_OFF_SOON() powerManager.power_off_soon()
91
     #define PSU_OFF_SOON() powerManager.power_off_soon()
92
   #else
92
   #else
93
     #define PSU_ON()     PSU_PIN_ON()
93
     #define PSU_ON()     PSU_PIN_ON()
94
-    #define PSU_OFF()    PSU_PIN_OFF()
94
+    #if ENABLED(PS_OFF_SOUND)
95
+      #define PSU_OFF()  do{ BUZZ(1000, 659); PSU_PIN_OFF(); }while(0)
96
+    #else
97
+      #define PSU_OFF()  PSU_PIN_OFF()
98
+    #endif
95
     #define PSU_OFF_SOON PSU_OFF
99
     #define PSU_OFF_SOON PSU_OFF
96
   #endif
100
   #endif
97
 #endif
101
 #endif

+ 16
- 3
Marlin/src/feature/power.cpp Parādīt failu

50
 millis_t Power::lastPowerOn;
50
 millis_t Power::lastPowerOn;
51
 
51
 
52
 bool Power::is_power_needed() {
52
 bool Power::is_power_needed() {
53
+
54
+  if (printJobOngoing() || printingIsPaused()) return true;
55
+
53
   #if ENABLED(AUTO_POWER_FANS)
56
   #if ENABLED(AUTO_POWER_FANS)
54
     FANS_LOOP(i) if (thermalManager.fan_speed[i]) return true;
57
     FANS_LOOP(i) if (thermalManager.fan_speed[i]) return true;
55
   #endif
58
   #endif
110
   #define POWER_TIMEOUT 0
113
   #define POWER_TIMEOUT 0
111
 #endif
114
 #endif
112
 
115
 
113
-void Power::check() {
116
+void Power::check(const bool pause) {
117
+  static bool _pause = false;
114
   static millis_t nextPowerCheck = 0;
118
   static millis_t nextPowerCheck = 0;
115
-  millis_t now = millis();
119
+  const millis_t now = millis();
120
+  #if POWER_TIMEOUT > 0
121
+    if (pause != _pause) {
122
+      lastPowerOn = now + !now;
123
+      _pause = pause;
124
+    }
125
+    if (pause) return;
126
+  #endif
116
   if (ELAPSED(now, nextPowerCheck)) {
127
   if (ELAPSED(now, nextPowerCheck)) {
117
     nextPowerCheck = now + 2500UL;
128
     nextPowerCheck = now + 2500UL;
118
     if (is_power_needed())
129
     if (is_power_needed())
123
 }
134
 }
124
 
135
 
125
 void Power::power_on() {
136
 void Power::power_on() {
126
-  lastPowerOn = millis();
137
+  const millis_t now = millis();
138
+  lastPowerOn = now + !now;
127
   if (!powersupply_on) {
139
   if (!powersupply_on) {
128
     PSU_PIN_ON();
140
     PSU_PIN_ON();
129
     safe_delay(PSU_POWERUP_DELAY);
141
     safe_delay(PSU_POWERUP_DELAY);
152
 void Power::power_off_soon() {
164
 void Power::power_off_soon() {
153
   #if POWER_OFF_DELAY
165
   #if POWER_OFF_DELAY
154
     lastPowerOn = millis() - SEC_TO_MS(POWER_TIMEOUT) + SEC_TO_MS(POWER_OFF_DELAY);
166
     lastPowerOn = millis() - SEC_TO_MS(POWER_TIMEOUT) + SEC_TO_MS(POWER_OFF_DELAY);
167
+    //if (!lastPowerOn) ++lastPowerOn;
155
   #else
168
   #else
156
     power_off();
169
     power_off();
157
   #endif
170
   #endif

+ 1
- 1
Marlin/src/feature/power.h Parādīt failu

29
 
29
 
30
 class Power {
30
 class Power {
31
   public:
31
   public:
32
-    static void check();
32
+    static void check(const bool pause);
33
     static void power_on();
33
     static void power_on();
34
     static void power_off();
34
     static void power_off();
35
     static void power_off_soon();
35
     static void power_off_soon();

+ 5
- 2
Marlin/src/lcd/marlinui.h Parādīt failu

529
 
529
 
530
     static void draw_select_screen_prompt(PGM_P const pref, const char * const string=nullptr, PGM_P const suff=nullptr);
530
     static void draw_select_screen_prompt(PGM_P const pref, const char * const string=nullptr, PGM_P const suff=nullptr);
531
 
531
 
532
-  #elif HAS_WIRED_LCD
532
+  #else
533
 
533
 
534
     static constexpr bool on_status_screen() { return true; }
534
     static constexpr bool on_status_screen() { return true; }
535
-    FORCE_INLINE static void run_current_screen() { status_screen(); }
535
+
536
+    #if HAS_WIRED_LCD
537
+      FORCE_INLINE static void run_current_screen() { status_screen(); }
538
+    #endif
536
 
539
 
537
   #endif
540
   #endif
538
 
541
 

Notiek ielāde…
Atcelt
Saglabāt