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:
19
arduino/main/gear.cpp
Normal file
19
arduino/main/gear.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include "gear.h"
|
||||
|
||||
// Mock gear: derived from RPM bands
|
||||
// Real sensor would read position switch
|
||||
|
||||
void gear_init() {
|
||||
// Nothing to init for mock
|
||||
}
|
||||
|
||||
int gear_get(int rpm) {
|
||||
// Simulate gear based on RPM
|
||||
// N < 1000, 1st < 2500, 2nd < 4000, 3rd < 5500, 4th < 7000, 5th+
|
||||
if (rpm < 1000) return 0; // Neutral
|
||||
if (rpm < 2500) return 1;
|
||||
if (rpm < 4000) return 2;
|
||||
if (rpm < 5500) return 3;
|
||||
if (rpm < 7000) return 4;
|
||||
return 5;
|
||||
}
|
||||
Reference in New Issue
Block a user