feat: nodes should die entirely if no MCU found

This should allow anchor to restart automatically if it's being run as a service
This commit is contained in:
Tristan McGinnis
2025-04-15 20:35:49 -05:00
committed by David
parent f12daff861
commit 8c4f75f75e
4 changed files with 17 additions and 10 deletions

View File

@@ -7,6 +7,7 @@ import time
import atexit
import serial
import os
import sys
import threading
import glob
@@ -61,8 +62,9 @@ class SerialRelay(Node):
if self.port is None:
self.get_logger().info("Unable to find MCU...")
time.sleep(1)
sys.exit(1)
#kill the node/process entirely
os.kill(os.getpid(), signal.SIGKILL)
sys.exit(0)
self.ser = serial.Serial(self.port, 115200)
atexit.register(self.cleanup)