Firmware for the Teensy 4.1 based CanSat platform handling sensors (BMP280, MPU6050, HMC5883, INA226, MICS-5524, L89 GNSS), telemetry via XBee, and SD logging.
- Single persistent SD logging directory:
Flight_<TEAM_ID> - Telemetry CSV line ends with last command echo (cmd_echo)
- SD command gating while telemetry active
- Lightweight command dispatcher with conditional immediate response sending
- Altitude fusion (baro + GPS) with filtering
- Optimized GPS handling for 7semi L89 module
Implemented lean logic in gps.cpp:
- Configurable constants in
constants.h:GPS_BAUD_RATE(boot baud, default 9600)GPS_HIGH_BAUD_RATE(optional 115200 if future reconfiguration added)GPS_FIX_STALE_MS(default 1500 ms) marks data stale when no fresh sentences parsedGPS_MIN_UPDATE_INTERVAL_MSthrottles telemetry structure writes (default 200 ms)
- Tracks
last_fix_msand only marks a fix valid when a fresh valid sentence arrives. - If stale, telemetry forced to sentinel values:
lat=0, lon=0, altitude=-1000, satellites=0. - Avoids unnecessary field updates more often than the configured interval.
Use PlatformIO (Teensy 4.1). Example (PowerShell):
pio runOr VS Code task: "Build CanSat Project".
- Add dynamic GPS baud escalation (send module config to switch to 115200 then
Serial2.updateBaudRate) if desired. - Add checksum or CRC to telemetry lines.
- Implement binary telemetry mode.
src/main.cpp– entrypointlib/– modular subsystem librarieslib/gps/– GPS logic (gps.cpp,gps.h)lib/constants/constants.h– system-wide constants & command stringslib/storage/– SD logging
See LICENSE file.