Shared data between the different modules.
| 191 | # the panel — same approach as the 4.26" e-paper. |
| 192 | "ili9486": {"ref_width": DESIGN_REF_WIDTH, "ref_height": DESIGN_REF_HEIGHT, "default_flip": False}, |
| 193 | "ili9488": {"ref_width": DESIGN_REF_WIDTH, "ref_height": DESIGN_REF_HEIGHT, "default_flip": False}, |
| 194 | # GC9A01 1.28" 240x240 round colour TFT LCD |
| 195 | "gc9a01": {"ref_width": DESIGN_REF_WIDTH, "ref_height": DESIGN_REF_WIDTH, "default_flip": False}, |
| 196 | # Waveshare 1.44" LCD HAT — ST7735S 128x128 square colour TFT (with keys + |
| 197 | # joystick). Square panel: use a square reference so the layout isn't |
| 198 | # stretched; the on-screen frame/stat pages scale to fit 128x128. |
| 199 | "st7735s": {"ref_width": 128, "ref_height": 128, "default_flip": False}, |
| 200 | # M5Stack CardputerZero built-in 1.9" ST7789V2, used landscape as 320x170. |
| 201 | # Landscape reference so the layout reflows to the wide panel (same "ref = |
| 202 | # panel size" approach as st7735s) instead of being stretched from portrait. |
| 203 | # mounted_flipped: the panel sits upside down relative to the image its |
| 204 | # driver shows, so the first start on it turns the screen 180 degrees. |
| 205 | "st7789v2": {"ref_width": 320, "ref_height": 170, "default_flip": True, "mounted_flipped": True}, |
| 206 | # Whisplay HAT 1.69" ST7789 240x280 colour TFT LCD (ref height keeps the |
| 207 | # 240:280 aspect so the layout isn't stretched: 122 * 280/240 = 142) |
| 208 | "whisplay": {"ref_width": DESIGN_REF_WIDTH, "ref_height": 142, "default_flip": False}, |
| 209 | # SSD1306 0.96" 128x64 monochrome OLED |
| 210 | "ssd1306": {"ref_width": 128, "ref_height": 64, "default_flip": False}, |
| 211 | # LCD1602 16x2 character LCD (I2C via PCF8574 backpack) |
| 212 | "lcd1602": {"ref_width": 16, "ref_height": 2, "default_flip": False}, |
| 213 | # MAX7219 LED matrix displays |
| 214 | "max7219_4panel": {"ref_width": 32, "ref_height": 8, "default_flip": False}, |
| 215 | "max7219_8panel": {"ref_width": 64, "ref_height": 8, "default_flip": False}, |
| 216 | } |
| 217 | |
| 218 | |
| 219 | logger = Logger(name="shared.py", level=logging.DEBUG) # Create a logger object |
| 220 | |
| 221 | class SharedData: |
| 222 | """Shared data between the different modules.""" |
| 223 | def __init__(self): |
| 224 | # Detect Pager mode (set by pager_payload.sh before Python launch) |
| 225 | self._pager_mode = os.environ.get('RAGNAR_PAGER_MODE') == '1' |
| 226 | # Detect Headless mode (set by headlessRagnar.py / systemd on web-only |
| 227 | # installs). Like Pager mode it must never initialize the EPD, which |
| 228 | # would seize SPI0 + GPIO and blank a DPI/HDMI panel on shared-pin |
| 229 | # boards (HackBerry Pi and similar). |
| 230 | self._headless_mode = os.environ.get('RAGNAR_HEADLESS') == '1' |
| 231 | |
| 232 | self.initialize_paths() # Initialize the paths used by the application |
| 233 | |
| 234 | # --- Network storage & context (not available on Pager) --- |
| 235 | if not self._pager_mode and NetworkStorageManager is not None: |
| 236 | self.storage_manager = NetworkStorageManager(self.datadir) |
| 237 | else: |
| 238 | self.storage_manager = None |
| 239 | self.active_network_ssid = None |
| 240 | self.active_network_slug = None |
| 241 | self.current_network_dir = None |
| 242 | self.current_network_db_path = None |
| 243 | self.network_intelligence_dir = None |
| 244 | self.network_threat_dir = None |
| 245 | if self.storage_manager is not None: |
| 246 | self._apply_network_context( |
| 247 | self.storage_manager.get_active_context(), |
| 248 | configure_db=False |
| 249 | ) |
| 250 | if not self._pager_mode and NetworkContextRegistry is not None: |
no outgoing calls
no test coverage detected