Skip to content

Commit d5e59b6

Browse files
committed
Bugfix cpu throttled notifications
1 parent 37b7865 commit d5e59b6

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

BlocksScreen/lib/panels/mainWindow.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,24 @@ def _handle_notify_cpu_throttled_message(self, method, data, metadata) -> None:
746746
"""Handle websocket cpu throttled messages"""
747747
if self._popup_toggle:
748748
return
749-
self.show_notifications.emit("mainwindow", data, 2, False)
749+
try:
750+
flags = {
751+
"Under-Voltage Detected": 1 << 0,
752+
"Frequency Capped": 1 << 1,
753+
"Currently Throttled": 1 << 2,
754+
"Temperature Limit Active": 1 << 3,
755+
}
756+
_bits = data.get("bits", None)
757+
if not _bits:
758+
self.show_notifications.emit(
759+
"mainWindow", "Cpu throttled unknown reason", 2, False
760+
)
761+
return
762+
_active_flags = [name for name, mask in flags.items() if _bits & mask]
763+
self.show_notifications.emit("mainwindow", str(_active_flags), 2, False)
764+
except Exception:
765+
logging.debug("Error emitting notification for cpu throttled notification.")
766+
return
750767

751768
@api_handler
752769
def _handle_notify_status_update_message(self, method, data, metadata) -> None:

0 commit comments

Comments
 (0)