Skip to content

Commit b28b2e2

Browse files
committed
add delay for power and suspend
1 parent 4007a26 commit b28b2e2

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

ZenTune/Assets/daemon/adaptive.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ def _adaptive_body(self, interval):
9595
log.debug("Adaptive loop waiting %.1fs post-resume before SMU apply...", wait_sec)
9696
if self._stop_adaptive_evt.wait(wait_sec):
9797
break
98+
continue
9899
sample = sensors.sample()
99100
merged = self._adaptive_tick_args(sample)
100101
if merged:

ZenTune/Assets/daemon/loops.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ def _monitor_body(self, args: str, mode: str) -> None:
161161
prev_state = "AC" if self._last_ac_state else "battery"
162162
new_state = "AC" if current_ac else "battery"
163163
self._last_ac_state = current_ac
164+
last_smu_apply = getattr(self, "_last_smu_apply_time", 0.0)
165+
if time.monotonic() - last_smu_apply < 3.0:
166+
log.debug("Power monitor skipped: SMU command applied %.1fs ago.", time.monotonic() - last_smu_apply)
167+
continue
164168
eff_mode, eff_args = self._effective_mode_args(
165169
mode, args, automation=True, on_ac=current_ac, keep_on_empty=True
166170
)
@@ -204,6 +208,11 @@ def _suspend_monitor_body(self) -> None:
204208
)
205209
if self._stop_suspend_evt.wait(_POST_SUSPEND_WAIT_S):
206210
break
211+
last_smu_apply = getattr(self, "_last_smu_apply_time", 0.0)
212+
if time.monotonic() - last_smu_apply < 3.0:
213+
log.debug("Suspend monitor skipped post-wake apply: SMU command applied %.1fs ago.", time.monotonic() - last_smu_apply)
214+
last_boottime_offset = current_boottime_offset
215+
continue
207216
cfg.load()
208217
preset_name = cfg.get("Automations", "OnResume", "")
209218
if preset_name:

0 commit comments

Comments
 (0)