From 26be5410e35c312fce29fb329757fc8734070775 Mon Sep 17 00:00:00 2001 From: serversdwn Date: Mon, 8 Dec 2025 16:05:07 -0500 Subject: [PATCH] increased verbosity --- series4_emitter.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/series4_emitter.py b/series4_emitter.py index 3cbfdcd..4ebd21b 100644 --- a/series4_emitter.py +++ b/series4_emitter.py @@ -367,20 +367,33 @@ def main() -> None: if not os.path.isdir(THORDATA_PATH): print(f"[WARN] THORDATA_PATH does not exist: {THORDATA_PATH}", file=sys.stderr) + loop_counter = 0 + try: while True: + loop_counter += 1 + print(f"\n[LOOP] Iteration {loop_counter} starting...", flush=True) + try: unit_map = scan_thordata(THORDATA_PATH) + debug(f"scan_thordata found {len(unit_map)} units") print_heartbeat(unit_map) emit_sfm_payload(unit_map) + print("[LOOP] Iteration complete, entering sleep...", flush=True) except Exception as e: # Catch-all so a single error doesn't kill the loop 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: print("\nSeries 4 Emitter stopped by user.") + if __name__ == "__main__": main()