Diff-lock inputs: DI0 rear / DI1 front via CH422G EXIO0/EXIO5 (bank flipped to input per read), Settings > System switch default OFF, DIFF LOCK pills on the Driveline, 'difflock' console; wiki diff-lock-inputs
Firmware / build (push) Successful in 7m26s
Firmware / build (push) Successful in 7m26s
This commit is contained in:
@@ -19,6 +19,7 @@ static const char* NVS_KEY_WIFI_ENABLED = "wifi_en";
|
||||
static const char* NVS_KEY_UART_ENABLED = "uart_en";
|
||||
static const char* NVS_KEY_DEBUG_ENABLED = "debug_en";
|
||||
static const char* NVS_KEY_CAN_ENABLED = "can_en";
|
||||
static const char* NVS_KEY_DIFFLOCK_ENABLED = "difflock_en";
|
||||
|
||||
// ============================================================================
|
||||
// PUBLIC API IMPLEMENTATION
|
||||
@@ -89,4 +90,18 @@ bool loadCANState() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
void saveDiffLockState(bool enabled) {
|
||||
preferences.begin(NVS_NAMESPACE, false); // read-write mode
|
||||
preferences.putBool(NVS_KEY_DIFFLOCK_ENABLED, enabled);
|
||||
preferences.end();
|
||||
Serial.printf("[SettingsManager] Saved DiffLock state = %s\n", enabled ? "ON" : "OFF");
|
||||
}
|
||||
|
||||
bool loadDiffLockState() {
|
||||
preferences.begin(NVS_NAMESPACE, true); // read-only mode
|
||||
bool enabled = preferences.getBool(NVS_KEY_DIFFLOCK_ENABLED, false); // default: OFF
|
||||
preferences.end();
|
||||
return enabled;
|
||||
}
|
||||
|
||||
} // namespace SettingsManager
|
||||
|
||||
Reference in New Issue
Block a user