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:
Mikkeli Matlock
2026-02-01 17:00:14 +09:00
parent 4e68dcef5f
commit f1ed809c71
10 changed files with 186 additions and 51 deletions

View File

@@ -10,6 +10,7 @@ static const int PIN_VBAT = A0;
static const float DIVIDER_RATIO = 47.0 / (100.0 + 47.0); // ~0.3197
static const float ADC_REF = 5.0;
static const int ADC_MAX = 1023;
static const float OFFSET = 0.2; // calib
void voltage_init() {
// analogRead doesn't need explicit pinMode, but here for future config
@@ -23,5 +24,5 @@ int voltage_read_raw() {
float voltage_read() {
int raw = voltage_read_raw();
float vDivider = (raw / (float)ADC_MAX) * ADC_REF;
return vDivider / DIVIDER_RATIO;
return vDivider / DIVIDER_RATIO + OFFSET;
}