Documentation
Onboarding
Getting Started
Power & Battery
Hardware & Components
Build & Assembly
Radio & RF Design
Frequencies & Regulations
Firmware & Software
USB & Connectivity
GPS & Navigation
Morse & Communication
Modes & Operation
Field Operations & Rescue
Building Effectively
Build Variants
Project & Reference
Docs Firmware & Software Extending the Serial Protocol

Extending the Serial Protocol

Edit on GitHub

Add new AEGIS: lines and serial commands to the firmware: where the code lives and the conventions to follow.

Extending the Serial Protocol

The serial protocol is deliberately small, but it is also easy to grow. This page shows where the code lives and the conventions that keep it parseable by the bridge and any other client.

Where the code lives

In AegisBeacon.ino, before setup():

  • serialPosReport(bool force) prints AEGIS:POS: lines (throttled unless forced).
  • processSerialCommand(const char* cmd) handles inbound commands.
  • serialPoll() reads newline-terminated lines from Serial and calls processSerialCommand.
  • serialPoll() is called from every mode loop: beacon sleep, search, config, and the GPS wait.

Adding an outgoing line

  1. Print with plain Serial.printf - never the colored LOG_* macros - so the line has no ANSI escapes.
  2. Keep the AEGIS: prefix and a single TYPE: label.
  3. Use key=value; fields, ASCII only, one line per record.
  4. Document the format in the Serial Command Protocol page.

Example:

CODE
Serial.printf("AEGIS:BAT:mv=%d;percent=%d\n", mv, pct);

Adding an inbound command

  1. Add a striStarts(s, "CMD ") branch in processSerialCommand.
  2. Validate ranges the way FREQ does, and reply with AEGIS:CMD:... on success or AEGIS:ERR:... on failure.
  3. Persist with saveConfig() when the setting must survive reboot.
  4. Document it in the protocol page and in the bridge README.

Conventions

RuleWhy
Plain Serial.printf onlyClients must not strip ANSI codes
One record per line, \n terminatedreadline() in any language works
AEGIS: prefix on every lineThe bridge ignores everything else
Lowercase keysClients parse case-sensitively
SI units in field namesalt in meters, freq in MHz
Throttle position spamserialPosReport keeps a 5 s floor

Testing

Flash, open a monitor, and exercise both directions: send HELP, POS, STATUS, and confirm the replies. Then run the bridge with --verbose and check the new lines pass through cleanly.