## What is PurrGO?

PurrGO is a standalone GNSS navigator and track logger built around one idea:
**offline navigation with minimum power consumption, without route calculation.**

It shows your position on a pre-compiled OpenStreetMap vector map, records tracks,
works with waypoints and GPX routes, and never needs the Internet, a phone or a cloud
service. It is a navigator, not a routing engine.

The prototype is assembled on perfboard and already works on real hardware.

## Features

- Offline vector maps (PurrGO Map Format V3) rendered on the device from microSD
- GNSS position, speed, course, trip computer, sunrise/sunset
- Track recording to microSD with quality filters (fix type, HDOP, satellites, outlier rejection)
- GPX route display from the SD card, drawn in its own style over the map
- 4-gray e-Paper map with partial refresh (1-bit for menus, 4-gray for map)
- Power-source setting (NiMH / alkaline / Li-ion AA / 5 V) with a discharge curve and battery indication
- E-book reader mode (GNSS off, 1-bit display) for a custom compact PGB format
- Four hardware buttons, long/short press, hints in the bottom status line
- PC emulator (SDL2) that runs the same core, so most of the logic is tested without hardware

## Hardware

| Part | Choice |
|---|---|
| MCU | WeAct STM32U585CIU6 (Cortex-M33, 784 KB RAM, 2 MB Flash) |
| GNSS | G10A F30 (u-blox M10) on LPUART1, DMA reception, EN and 1PPS lines |
| Display | Waveshare 2.7" e-Paper HAT, 264x176, 4 gray levels, 4 buttons |
| Storage | microSD over SPI (the 48-pin U585CI has no SDMMC), with card detect |
| Power | 3x AA -> TPS63802 buck-boost -> 3.3 V; or USB-C power bank |
| Battery monitor | resistor divider -> ADC1 |

## Software

- Portable C core (GNSS/NMEA, map, track, geo, graphics, navigation) separated from the platform layer (PC / STM32)
- Host tests
- Firmware built with CMake presets (`stm32u5-debug`, `stm32u5-release`), CubeMX project included
- Own e-Paper driver `epd4g`: 4-gray partial refresh for the Waveshare 2.7" V2, non-blocking, with
  automatic full refresh after N partials to prevent ghosting

## Maps

Maps are prepared on a PC:

OSM (.pbf) -> optimizer -> map compiler -> PurrGO map package -> microSD -> renderer

A GitHub Action builds a ready-to-load map package from Geofabrik data.
The STM32 only draws pre-compiled data and does no general GIS processing, which keeps
power and RAM use low.

## E-Ink tricks

- Partial refresh with the old/new RAM planes kept in sync, so menus change without flashing
- Only the changed regions are redrawn; the GNSS marker is not redrawn if it moved <= 3 px
- Line anti-aliasing on 4-gray for smoother roads and tracks
- Worst-case ghosting test (40 partial refreshes in a row) shows no residual image

## Status

- Working on hardware: GNSS fix (hot start ~8 s), map on e-Paper, buttons, microSD, track logging
- In progress: battery measurement and low-battery behaviour, e-book reader, map format speed-ups
- Planned: measuring real battery life, sleeping between updates (Stop 2), a custom PCB

## Why

Phone navigation drains the battery in hours. E-paper plus an MCU that sleeps most of
the time can run for days on three AA cells and has no dependency on connectivity.