sync
This commit is contained in:
23
tool/core/cmd/reboot.py
Normal file
23
tool/core/cmd/reboot.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import serial
|
||||
from core.utils import console, console_err
|
||||
from core.protocol import COMMANDS
|
||||
|
||||
class reboot:
|
||||
def __init__(self, bus):
|
||||
self.bus = bus
|
||||
|
||||
def get(self):
|
||||
self.bus.send_request(COMMANDS['reboot'])
|
||||
try:
|
||||
data = self.bus.receive_ack()
|
||||
return data is not None and data.get('type') == 'ack'
|
||||
except serial.SerialException:
|
||||
# SerialException MUSS hier ignoriert werden, da der Controller
|
||||
# den USB-Port beim Reboot hart schließt
|
||||
return True
|
||||
|
||||
def print(self, result):
|
||||
if result:
|
||||
console.print("🔄 Neustart-Befehl erfolgreich gesendet. Controller [info]bootet neu...[/info]")
|
||||
else:
|
||||
console_err.print("❌ Fehler beim Senden des Neustart-Befehls.")
|
||||
Reference in New Issue
Block a user