Background thread: read NMEA sentences and parse position.
(self)
| 558 | 'searching_seconds': (round(time.time() - self.start_time, 1) |
| 559 | if (self.start_time and not self.first_fix_time) |
| 560 | else None), |
| 561 | 'latitude': self.latitude, |
| 562 | 'longitude': self.longitude, |
| 563 | 'altitude': self.altitude, |
| 564 | 'speed_kmh': self.speed_kmh, |
| 565 | 'course': self.course, |
| 566 | 'last_update': self.last_update, |
| 567 | 'last_sentence': self.last_sentence, |
| 568 | 'last_known': self.last_known, |
| 569 | 'error': self.error |
| 570 | } |
| 571 | |
| 572 | def update_external_fix(self, lat, lon, alt=None, speed_kmh=None, |
| 573 | satellites=None, hdop=None, source='companion'): |
| 574 | """Inject a position from an external source (e.g. a USB-connected |
| 575 | Piglet/HuginnESP companion that has its own GPS receiver). |
| 576 | |
| 577 | Lets Ragnar operate as if it had GPS even when no local receiver is |
| 578 | attached, so BT/cell scans, the gps_track table, and the status UI |
| 579 | all see a position. A local receiver always wins: if NMEA from the |
| 580 | directly-attached GPS arrived within the last 5 s we ignore the |
| 581 | external update. |
| 582 | """ |
| 583 | if lat is None or lon is None: |
| 584 | return False |
| 585 | try: |
nothing calls this directly
no test coverage detected