- Added readSerial(Stream &stream) method to allow reading from any Stream-compatible transport. - Introduced readChar(char inChar) method for processing individual characters. - Updated command matching logic to enhance debugging output. - Improved buffer handling and command execution flow. Enhance platformio.ini for better compatibility and added libraries - Added NimBLE-Arduino and WebSockets libraries for BLE and WiFi support. - Updated upload and monitor ports for better compatibility with macOS. Integrate WiFi and BLE protocol interfaces - Implemented startWebInterface() to initialize WiFi protocol alongside existing web server. - Added BLE support with a new EggBot BLE Serial Protocol for command handling over BLE. - Created WebSocket server for WiFi communication, maintaining compatibility with existing command protocols. Refactor command handling in Functions.cpp - Replaced direct Serial.print calls with protocolWrite for consistent output handling. - Updated command registration to use a lambda function for better readability and maintainability. Add documentation for EggBot protocols - Created separate markdown files for BLE, WiFi, and Serial protocols detailing command structures and usage. - Provided examples of command transactions for better developer guidance. Implement BLE and WiFi protocol handling in respective source files - Developed BLE_Interface.cpp for managing BLE connections and data transmission. - Created WiFi_Protocol.cpp for handling WebSocket communication and data reception.
1.8 KiB
1.8 KiB
EggBot Serial Protocol (USB/UART)
Scope
This firmware emulates the EggBot/EBB command protocol over serial transport.
- Transport: USB CDC/UART (
115200 8N1) - Command separator:
, - Command terminator: carriage return (
\r, ASCII 0x0D) - Response terminator: carriage return + newline (
\r\n)
Handshake and Generic Responses
- Version query:
v\r - Version response:
EBBv13_and_above Protocol emulated by Eggduino-Firmware V1.6a\r\n - Success response:
OK\r\n - Error response:
unknown CMD\r\n
Implemented Commands
All commands are case-sensitive and comma-delimited.
EM,<mode>[,<ignored>]SC,<id>,<value>SP,<penState>[,<delayMs>]SM,<durationMs>,<penSteps>,<rotSteps>SE(ack-only placeholder)TP[,<delayMs>]PO(ack-only placeholder)NINDSN,<nodeCount>QNSL,<layer>QLQPQB
Command Behavior Notes
SM: firmware blocks until previous move completes, sendsOK, then runs the requested move.SPandTP: support optional delay argument in milliseconds.QP: returns pen state line (1for pen up,0for pen down), thenOK.QB: returns button state (0or1), thenOK; internal button latch is reset after query.QN,QL: return numeric line first, thenOK.SCsupports these IDs:4: set pen-down servo position (EBB value to servo-mapped value)5: set pen-up servo position6,7: accepted, ignored, and acknowledged11: set servo rate up12: set servo rate down
Timing/Parsing Requirements for Hosts
- Always terminate each command with
\r. - Do not rely on
\nas a command terminator. - Read until
OK\r\n(orunknown CMD\r\n) to complete command transactions. - For commands that return data (
QP,QB,QN,QL), read one data line plus the final status line.