fix: confirm OLED alert count updates
This commit is contained in:
+2
-2
@@ -4,9 +4,9 @@ cd6bb5137dd5922e48866f6daf4b949a16f8fad321e77addd5b4f75181bc4248 uninstall.sh
|
|||||||
1c7836f80b0845fbc5c4b8570b12d736e2a3c442b1ceb5d35d48cdd518e4ad50 app/drivers/yahboom.py
|
1c7836f80b0845fbc5c4b8570b12d736e2a3c442b1ceb5d35d48cdd518e4ad50 app/drivers/yahboom.py
|
||||||
215a62acc0a5c87303d6c52c0a2585b87dfb5cdbafbe9e9e733523d48a6a9812 app/migrate.py
|
215a62acc0a5c87303d6c52c0a2585b87dfb5cdbafbe9e9e733523d48a6a9812 app/migrate.py
|
||||||
72c46162c33f9587c6ccb01ad53fbaaf4ecec8cd21014b909e87e8707e253e36 app/oled_font_5x7.bin
|
72c46162c33f9587c6ccb01ad53fbaaf4ecec8cd21014b909e87e8707e253e36 app/oled_font_5x7.bin
|
||||||
1803eebf7917291587204db85f74e2009e87f3a7b27a194b1aba245aa49b442b app/runtime.py
|
48755a51a15fd6a02098b185d1b17c6746502bd07dc74ac54ac76b4f8581b4db app/runtime.py
|
||||||
af4a97339c805b5471149da29699d465cb76b20a8f1da7ad8af8e32d4a2fc827 app/service.py
|
af4a97339c805b5471149da29699d465cb76b20a8f1da7ad8af8e32d4a2fc827 app/service.py
|
||||||
413548a4b38ac3ad32712c92df5e7cd4e9ef2603872ca201d3e4df8c50dbad4a app/settings.py
|
4855303e4cd358635d4ba3877513e98042809f1ca9eaa14885ded8acadd20638 app/settings.py
|
||||||
9bcac51c4e3a3d409885a3041ac121a20a48596bc47ee769c7af0b8f3772fa8d config/pigway-cooling-hat.conf
|
9bcac51c4e3a3d409885a3041ac121a20a48596bc47ee769c7af0b8f3772fa8d config/pigway-cooling-hat.conf
|
||||||
c373cdde2b937bbc58d4b227f3a1d2923f0816c13f1e34548ed1f3b26c101ed5 systemd/pigway-cooling-hat.service
|
c373cdde2b937bbc58d4b227f3a1d2923f0816c13f1e34548ed1f3b26c101ed5 systemd/pigway-cooling-hat.service
|
||||||
e3bf3e7070ea62c0526791bed922688c3fb49fee36ca9c375d080119968feb72 docs/HARDWARE_PLUGIN_API.md
|
e3bf3e7070ea62c0526791bed922688c3fb49fee36ca9c375d080119968feb72 docs/HARDWARE_PLUGIN_API.md
|
||||||
|
|||||||
+14
-2
@@ -167,10 +167,11 @@ class Controller:
|
|||||||
self.stop_event.wait(1)
|
self.stop_event.wait(1)
|
||||||
|
|
||||||
def oled_loop(self):
|
def oled_loop(self):
|
||||||
last=None;last_time=0
|
last=None;last_time=0;last_alert_ids=None
|
||||||
while not self.stop_event.is_set():
|
while not self.stop_event.is_set():
|
||||||
try:
|
try:
|
||||||
v=self.view();page=v['page'];system=v['system'];network=v['network'];home=False
|
v=self.view();page=v['page'];system=v['system'];network=v['network'];home=False
|
||||||
|
alert_ids=tuple(a['id'] for a in v['alerts'])
|
||||||
if page=='NORMAL_HOME':
|
if page=='NORMAL_HOME':
|
||||||
home=True
|
home=True
|
||||||
ip=network.get('ip','NO IP');label=network.get('ip_label','IP4')
|
ip=network.get('ip','NO IP');label=network.get('ip_label','IP4')
|
||||||
@@ -189,7 +190,18 @@ class Controller:
|
|||||||
lines=[(a['title'],f"{index}/{len(v['alerts'])}"),(a['l2'],''),(a['l3'],''),(a['l4'],'')]
|
lines=[(a['title'],f"{index}/{len(v['alerts'])}"),(a['l2'],''),(a['l3'],''),(a['l4'],'')]
|
||||||
state=(lines,home)
|
state=(lines,home)
|
||||||
if state!=last or self.clock()-last_time>=v['config']['oled']['refresh_seconds']:
|
if state!=last or self.clock()-last_time>=v['config']['oled']['refresh_seconds']:
|
||||||
self.driver.oled(lines,home);last=state;last_time=self.clock()
|
self.driver.oled(lines,home)
|
||||||
|
# Alert recovery changes only a few header pixels (for
|
||||||
|
# example 1/2 -> 1/1). Confirm that rare topology change
|
||||||
|
# with a second complete frame: during undervoltage an
|
||||||
|
# OLED transfer can be only partly applied without an
|
||||||
|
# I2C exception being reported by the controller.
|
||||||
|
if last_alert_ids is not None and alert_ids!=last_alert_ids:
|
||||||
|
self.stop_event.wait(.05)
|
||||||
|
if not self.stop_event.is_set():self.driver.oled(lines,home)
|
||||||
|
last=state
|
||||||
|
last_time=self.clock()
|
||||||
|
last_alert_ids=alert_ids
|
||||||
self.recovered('oled')
|
self.recovered('oled')
|
||||||
except Exception as exc:self.error('oled',exc)
|
except Exception as exc:self.error('oled',exc)
|
||||||
self.stop_event.wait(.1)
|
self.stop_event.wait(.1)
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ import configparser
|
|||||||
import math
|
import math
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
VERSION = "1.0.0"
|
VERSION = "1.0.1"
|
||||||
PLUGIN_ID = "yahboom-cooling-hat"
|
PLUGIN_ID = "yahboom-cooling-hat"
|
||||||
COLORS = {"red":0,"green":1,"blue":2,"yellow":3,"purple":4,"cyan":5,"white":6}
|
COLORS = {"red":0,"green":1,"blue":2,"yellow":3,"purple":4,"cyan":5,"white":6}
|
||||||
EFFECTS = {"flow":0,"breathe":1,"marquee":2,"rainbow":3,"colorful":4}
|
EFFECTS = {"flow":0,"breathe":1,"marquee":2,"rainbow":3,"colorful":4}
|
||||||
|
|||||||
Reference in New Issue
Block a user