MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / run

Method run

headlessRagnar.py:46–73  ·  view source on GitHub ↗

Main loop for Ragnar. Starts Wi-Fi manager and orchestrator as needed.

(self)

Source from the content-addressed store, hash-verified

44 self.wifi_manager = WiFiManager(self.shared_data)
45
46 # Expose this instance to other modules
47 self.shared_data.ragnar_instance = self
48 self.shared_data.headless_mode = True
49
50 # ---------------------------------------------------------------------
51 # Main loop
52 # ---------------------------------------------------------------------
53 def run(self):
54 """Main loop for Ragnar. Starts Wi-Fi manager and orchestrator as needed."""
55 logger.info("=" * 70)
56 logger.info("RAGNAR MAIN THREAD STARTING (no EPD display)")
57 logger.info("=" * 70)
58
59 # Initialize Wi-Fi management system
60 logger.info("Starting Wi-Fi management system...")
61 self.wifi_manager.start()
62 logger.info("Wi-Fi management system started")
63
64 # Main loop to keep Ragnar running
65 logger.info("Entering main Ragnar loop...")
66 loop_count = 0
67 while not self.shared_data.should_exit:
68 loop_count += 1
69 if loop_count % 6 == 1: # roughly every 60 seconds if sleep(10)
70 logger.info(
71 f"Ragnar main loop iteration {loop_count}, "
72 f"manual_mode={self.shared_data.manual_mode}"
73 )
74
75 if not self.shared_data.manual_mode:
76 self.check_and_start_orchestrator()

Callers

nothing calls this directly

Calls 4

infoMethod · 0.80
startMethod · 0.45
sleepMethod · 0.45

Tested by

no test coverage detected