Skip to content

GPS Firmware API/Events#2

Merged
Robotmad merged 1 commit into
TeamRobotmad:mainfrom
mbooth101:gps_events
Jun 8, 2026
Merged

GPS Firmware API/Events#2
Robotmad merged 1 commit into
TeamRobotmad:mainfrom
mbooth101:gps_events

Conversation

@mbooth101

Copy link
Copy Markdown

Major changes:

  • Remove the graphical app portion, the firmware now runs in the background only
  • Provide 3 API methods for getting the current position as a (lat, lon) tuple, ground speed in knots, and course in degrees from true north
  • Add a GPSEvent type and emit events every time a location fix message is received from the GPS
  • In both the API and the GPSEvent, when the fix is lost, the position value will be None instead of a tuple

Other fixes:

  • Firmware version bumped to 2
  • Add a character timeout to the UART configuration to improve the ability of uart.readline() to read a full line, and reduce parsing errors caused by reading partial lines
  • Override background_task to manage sleep for longer between UART message bursts, to reduce the impact of the blocking UART timeout on other apps

Major changes:

* Remove the graphical app portion, the firmware now runs in the
  background only
* Provide 3 API methods for getting the current position as a (lat, lon)
  tuple, ground speed in knots, and course in degrees from true north
* Add a GPSEvent type and emit events every time a location fix message is
  received from the GPS
* In both the API and the GPSEvent, when the fix is lost, the position
  value will be None instead of a tuple

Other fixes:

* Firmware version bumped to 2
* Add a character timeout to the UART configuration to improve the
  ability of uart.readline() to read a full line, and reduce parsing
  errors caused by reading partial lines
* Override background_task to manage sleep for longer between UART
  message bursts, to reduce the impact of the blocking UART timeout on
  other apps
@mbooth101

mbooth101 commented May 23, 2026

Copy link
Copy Markdown
Author

In your Tildagon apps, you can then do this:

# Get the app running on the GPS Hexpansion
self.gps = get_app_by_vid_pid(0xCAFE, 0x1295)

Then use the API directly:

position = self.gps.position
speed_knots = self.gps.speed
speed_kmh = self.gps.speed * 1.852
course_degrees = self.gps.bearing

Or use the event system:

# Subscribe to GPS Events
if self.gps:
    eventbus.on(self.gps.GPSEvent, self._handle_gps_event, self)


def _handle_gps_event(self, e):
    """Method to handle GPS events """
    self.position = e.position
    self.speed_knots = e.speed
    self.speed_mph = e.speed * 1.151
    self.bearing = e.bearing

@mbooth101

Copy link
Copy Markdown
Author

Note I wanted to add speed methods for common units, like mph, kmh, and metres/s, but there wasn't enough space in the EEPROM, so Tildagon app authors must do the conversion from knots. The conversion factors are as follows:

  • mph = knots * 1.151
  • km/h = knots * 1.852
  • m/s = knots * 0.514

@mbooth101

Copy link
Copy Markdown
Author

@Robotmad Will this repo be made redundant by the new Hexpansion firmware manager app that has been added to the Tildagon? https://github.com/emfcamp/badge-2024-software/blob/main/modules/firmware_apps/hexpansionfw.py

@mbooth101

Copy link
Copy Markdown
Author

Note this is the firmware I used to develop my Speedo app against: https://github.com/mbooth101/emf-speedometer

@Robotmad

Robotmad commented Jun 8, 2026

Copy link
Copy Markdown

background API based GPS hexpansion software - Note this has NO UI.

@Robotmad Robotmad merged commit 8a27b8d into TeamRobotmad:main Jun 8, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants