Scrolling status display for MAX7219 cascaded LED matrix panels.
(self)
| 2596 | if isinstance(alt, (int, float)): |
| 2597 | rows.append(("Alt", f"{alt:.0f}m")) |
| 2598 | elif gps.get('connected'): |
| 2599 | rows.append(("Fix", "Searching")) |
| 2600 | else: |
| 2601 | rows.append(("Fix", "No GPS")) |
| 2602 | |
| 2603 | used = gps.get('satellites') |
| 2604 | in_view = gps.get('satellites_in_view') |
| 2605 | if isinstance(used, (int, float)) or isinstance(in_view, (int, float)): |
| 2606 | u = int(used) if isinstance(used, (int, float)) else 0 |
| 2607 | v = int(in_view) if isinstance(in_view, (int, float)) else 0 |
| 2608 | rows.append(("Sats", f"{u}/{v}")) |
| 2609 | hdop = gps.get('hdop') |
| 2610 | if isinstance(hdop, (int, float)) and hdop > 0: |
| 2611 | rows.append(("HDOP", f"{hdop:.1f}")) |
| 2612 | |
| 2613 | spd = gps.get('speed_kmh') |
| 2614 | if isinstance(spd, (int, float)): |
| 2615 | unit = self.config.get('wardriving_speed_unit', 'kmh') |
| 2616 | rows.append(("Spd", _fmt_wd_speed(spd, unit))) |
| 2617 | course = gps.get('course') |
| 2618 | if gps.get('has_fix') and isinstance(course, (int, float)): |
| 2619 | rows.append(("Crs", f"{course:.0f}")) |
| 2620 | |
| 2621 | self._wd_compact_rows(draw, rows, int(15 * sy), footer_y) |
| 2622 | |
| 2623 | def _wd_sky_data(self): |
| 2624 | """Per-satellite sky list (constellation/az/elev/snr) from the live GPS, |
| 2625 | for the compact SKY screen. Pulled straight off the running engine's |
| 2626 | GPSManager (the same get_sky_view() the web sky view polls) since the |
| 2627 | wardriving status dict doesn't carry the per-satellite detail. Returns |
| 2628 | [] when GPS isn't running or nothing is being tracked.""" |
| 2629 | try: |
| 2630 | from webapp_modern import _get_wardriving_engine |
| 2631 | engine = _get_wardriving_engine() |
| 2632 | if engine and getattr(engine, '_gps', None) and engine._running: |
| 2633 | return engine._gps.get_sky_view() or [] |
| 2634 | except Exception: |
| 2635 | pass |
| 2636 | return [] |
| 2637 | |
| 2638 | def _render_wd_compact_sky(self, image, draw, wd): |
| 2639 | """Compact GPS sky view — a polar plot of the satellites in view, the |
| 2640 | graphical twin of the web sky view. North is up, the outer circle is the |
| 2641 | horizon (elevation 0°) and the centre is the zenith (90°); each satellite |
| 2642 | sits at its azimuth/elevation. Dots are filled for a strong signal and |
| 2643 | hollow for a weak one, so a glance shows both geometry and fix quality.""" |
| 2644 | sx = getattr(self, 'render_sx', self.scale_factor_x) |
| 2645 | sy = getattr(self, 'render_sy', self.scale_factor_y) |
| 2646 | w = getattr(self, 'render_w', self.shared_data.width) |
| 2647 | font = self.shared_data.font_arial9 |
| 2648 | footer_y = self._draw_wd_compact_chrome(draw, title="SKY") |
| 2649 | if self._wd_compact_not_running(draw, wd): |
| 2650 | return |
| 2651 | |
| 2652 | top = int(15 * sy) |
| 2653 | bottom = footer_y - int(2 * sy) |
| 2654 | cx = w / 2.0 |
| 2655 | cy = (top + bottom) / 2.0 |