arduino: WT61 init logics & matched mounting

This commit is contained in:
Mikkeli Matlock
2026-02-02 19:30:15 +09:00
parent f7f0af92dd
commit 83cc6bed19
5 changed files with 86 additions and 21 deletions

View File

@@ -3,15 +3,24 @@
// Mock RPM: ramps up/down between idle and redline
static int _rpm = 800;
static unsigned long _lastUpdate = 0;
static const unsigned long RPM_UPDATE_INTERVAL_MS = 100; // 10Hz ramp rate
void rpm_init() {
_rpm = 800;
_lastUpdate = 0;
}
void rpm_update() {
// ~100ms per call at 10Hz = takes ~7s to sweep range
unsigned long now = millis();
if (now - _lastUpdate < RPM_UPDATE_INTERVAL_MS) {
return; // Not time yet
}
_lastUpdate = now;
// +10 RPM every 100ms = ~7s to sweep 800-8000
_rpm += 10;
if (_rpm >= 8000) { _rpm = 800;}
if (_rpm >= 8000) { _rpm = 800; }
}
int rpm_get() {