Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

- [DISPATCHED] (root_agent) Kick off milestone v0.4.0 planning
- [DISPATCHED] (esp_agent) Implement bidirectional serial protocol and WiFi config
- [DISPATCHED] (protocol_agent) Define command bridge and heartbeat messages
- [DONE] (protocol_agent) Define command bridge and heartbeat messages (see docs/progress/2025-06-18_20-45_protocol_agent_esp_commands.md)
- [DISPATCHED] (firmware_agent) Integrate ESP bridge with Arduino Due
- [DISPATCHED] (ui_agent) Host minimal Web UI for real-time DDS control
- [DISPATCHED] (docs_agent) Document Web UI and ESP configuration
Expand Down
18 changes: 18 additions & 0 deletions docs/impl/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,21 @@ human-readable tokens documented in `command_spec.md`.

Hardware pin names referenced here match the tables in
[`docs/configuration/pins.md`](../configuration/pins.md).

## ESP Interface Commands

These commands target the optional ESP8266-01 WiFi bridge. All ESP commands
start with the letter `E` to distinguish them from the regular DDS commands.

| Constant | Command | Description |
| --- | --- | --- |
| `CMD_ESP_ON` | `EON` | Enable the ESP bridge |
| `CMD_ESP_OFF` | `EOF` | Disable the ESP bridge |
| `CMD_ESP_STATUS` | `EST` | Query ESP status |
| `CMD_ESP_VERSION` | `EVR` | Request ESP firmware version |
| `CMD_ESP_MODE` | `EMD` | Set bridge mode / argument required |
| `CMD_ESP_LED_ON` | `EL1` | Turn WiFi status LED on |
| `CMD_ESP_LED_OFF` | `EL0` | Turn WiFi status LED off |

General diagnostic commands `CMD_STATUS` and `CMD_VERSION` are also available
and apply to the Arduino Due firmware itself.
13 changes: 13 additions & 0 deletions docs/progress/2025-06-18_20-45_protocol_agent_esp_commands.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# ESP command finalization
Date: 2025-06-18 20:45 CEST

- added diagnostic macros `CMD_STATUS` and `CMD_VERSION`
- shortened ESP command tokens and introduced `CMD_ESP_VERSION`
- updated `CommandParser` to handle the new constants
- documented all ESP commands in `docs/impl/commands.md`

Affected files:
- `firmware/shared/commands.h`
- `protocol/ascii/constants.py`
- `firmware/due/CommandParser.cpp`
- `docs/impl/commands.md`
8 changes: 6 additions & 2 deletions firmware/due/CommandParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ String CommandParser::handleCommand(const String& cmd) {
esp_send(CMD_ESP_STATUS);
return "OK:REQ";
}
if (cmd == CMD_ESP_VERSION) {
esp_send(CMD_ESP_VERSION);
return "OK:REQ";
}
if (cmd.rfind(CMD_ESP_MODE, 0) == 0) {
esp_send(cmd);
return "OK:MODE";
Expand All @@ -92,11 +96,11 @@ String CommandParser::handleCommand(const String& cmd) {
return "ERR:ESP_DISABLED";
}
#endif
if (cmd == "STATUS") {
if (cmd == CMD_STATUS) {
return String("OK:FREQ ") + std::to_string(dds->getFrequency()) +
" WAVE " + std::to_string(dds->getWaveform());
}
if (cmd == "VERSION") {
if (cmd == CMD_VERSION) {
return "OK:VERSION 0.0.1";
}
return "ERR:INVALID_COMMAND";
Expand Down
19 changes: 12 additions & 7 deletions firmware/shared/commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,22 @@
#define CMD_OUTPUT_ON "ON"
#define CMD_OUTPUT_OFF "OFF"

// Diagnostic commands
#define CMD_STATUS "STATUS"
#define CMD_VERSION "VERSION"

// Preset management
#define CMD_SAVE "SAVE" // Save to EEPROM or preset slot
#define CMD_LOAD "LOAD" // Load from EEPROM or preset slot
#define CMD_DELETE "DELETE" // Delete preset slot

// ESP8266 control commands
#define CMD_ESP_ON "ESPON"
#define CMD_ESP_OFF "ESPOFF"
#define CMD_ESP_STATUS "ESPSTS"
#define CMD_ESP_MODE "ESPMODE"
#define CMD_ESP_LED_ON "ESPLEDON"
#define CMD_ESP_LED_OFF "ESPLEDOFF"
// ESP8266 control commands (all prefixed with 'E')
#define CMD_ESP_ON "EON"
#define CMD_ESP_OFF "EOF"
#define CMD_ESP_STATUS "EST"
#define CMD_ESP_VERSION "EVR"
#define CMD_ESP_MODE "EMD"
#define CMD_ESP_LED_ON "EL1"
#define CMD_ESP_LED_OFF "EL0"

#endif // SHARED_COMMANDS_H
11 changes: 11 additions & 0 deletions protocol/ascii/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,14 @@
CMD_LOAD = "LOAD"
CMD_DELETE = "DELETE"

CMD_STATUS = "STATUS"
CMD_VERSION = "VERSION"

CMD_ESP_ON = "EON"
CMD_ESP_OFF = "EOF"
CMD_ESP_STATUS = "EST"
CMD_ESP_VERSION = "EVR"
CMD_ESP_MODE = "EMD"
CMD_ESP_LED_ON = "EL1"
CMD_ESP_LED_OFF = "EL0"

Loading