increased verbosity
This commit is contained in:
@@ -367,20 +367,33 @@ def main() -> None:
|
|||||||
if not os.path.isdir(THORDATA_PATH):
|
if not os.path.isdir(THORDATA_PATH):
|
||||||
print(f"[WARN] THORDATA_PATH does not exist: {THORDATA_PATH}", file=sys.stderr)
|
print(f"[WARN] THORDATA_PATH does not exist: {THORDATA_PATH}", file=sys.stderr)
|
||||||
|
|
||||||
|
loop_counter = 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
|
loop_counter += 1
|
||||||
|
print(f"\n[LOOP] Iteration {loop_counter} starting...", flush=True)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
unit_map = scan_thordata(THORDATA_PATH)
|
unit_map = scan_thordata(THORDATA_PATH)
|
||||||
|
debug(f"scan_thordata found {len(unit_map)} units")
|
||||||
print_heartbeat(unit_map)
|
print_heartbeat(unit_map)
|
||||||
emit_sfm_payload(unit_map)
|
emit_sfm_payload(unit_map)
|
||||||
|
print("[LOOP] Iteration complete, entering sleep...", flush=True)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# Catch-all so a single error doesn't kill the loop
|
# Catch-all so a single error doesn't kill the loop
|
||||||
print(f"[ERROR] Exception in main loop: {e}", file=sys.stderr)
|
print(f"[ERROR] Exception in main loop: {e}", file=sys.stderr)
|
||||||
|
sys.stderr.flush()
|
||||||
|
|
||||||
|
# Sleep in 1-second chunks to avoid VM time drift weirdness
|
||||||
|
for i in range(SCAN_INTERVAL):
|
||||||
|
time.sleep(1)
|
||||||
|
print("[LOOP] Woke up for next scan", flush=True)
|
||||||
|
|
||||||
time.sleep(SCAN_INTERVAL)
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("\nSeries 4 Emitter stopped by user.")
|
print("\nSeries 4 Emitter stopped by user.")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user