23 lines
927 B
Python
23 lines
927 B
Python
from core.utils import console, console_err
|
|
from core.protocol import COMMANDS
|
|
|
|
class fw_confirm:
|
|
def __init__(self, bus):
|
|
self.bus = bus
|
|
|
|
def get(self):
|
|
# Fehler 1: Der Key in COMMANDS heißt 'confirm_fw'
|
|
self.bus.send_request(COMMANDS['confirm_fw'])
|
|
|
|
# Fehler 2: Try-Except entfernt, damit der ControllerError (z.B. bei nicht-pending Image)
|
|
# sauber nach buzz.py durchschlägt.
|
|
data = self.bus.receive_ack()
|
|
return data is not None and data.get('type') == 'ack'
|
|
|
|
def print(self, result):
|
|
if result:
|
|
console.print("✓ Laufende Firmware wurde [info]erfolgreich bestätigt[/info] (Permanent).")
|
|
else:
|
|
# Wird im Fehlerfall eigentlich nicht mehr erreicht, da buzz.py abbricht,
|
|
# bleibt aber als Fallback für leere Antworten.
|
|
console_err.print("❌ Fehler beim Bestätigen der Firmware.") |