arduino: TSV telemetry protocol with mock RPM/gear
- null-terminated TSV frame: V_bat, IMU (9 fields), RPM, gear - mock RPM ramps 800-8000, gear derived from RPM bands - voltage calibration offset - PROTOCOL.md documents wire format Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define COMMS_H
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "imu.h"
|
||||
|
||||
// Initialize Pi serial communication (call in setup)
|
||||
void comms_init();
|
||||
@@ -10,7 +11,12 @@ void comms_init();
|
||||
// Returns true if a complete command was received
|
||||
bool comms_update();
|
||||
|
||||
// Send telemetry line to Pi
|
||||
// Send complete telemetry frame (TSV format, null-terminated)
|
||||
// Format: V_bat\tAx\tAy\tAz\tGx\tGy\tGz\tRoll\tPitch\tYaw\tRPM\tGear\0
|
||||
// If imu_valid is false, IMU fields are empty (but tabs preserved)
|
||||
void comms_send_telemetry(float voltage, const ImuData& imu, bool imu_valid, int rpm, int gear);
|
||||
|
||||
// Send key:value line (for debug/ACK, newline-terminated)
|
||||
void comms_send(const char* key, float value, int decimals = 2);
|
||||
void comms_send(const char* key, int value);
|
||||
void comms_send(const char* key, const char* value);
|
||||
|
||||
Reference in New Issue
Block a user