diff --git a/Software/ChainLube/src/config.h b/Software/ChainLube/src/config.h index 107c9e9..68f9e57 100644 --- a/Software/ChainLube/src/config.h +++ b/Software/ChainLube/src/config.h @@ -17,6 +17,7 @@ typedef struct uint32_t TireWidthHeight_Ratio = 70; uint32_t RimDiameter_Inch = 18; uint32_t DistancePerRevolution_mm = 2000; + uint8_t BleedingPulses = 25; uint32_t checksum = 0; } LubeConfig_t; diff --git a/Software/ChainLube/src/webui.cpp b/Software/ChainLube/src/webui.cpp index ddc976f..f7ee016 100644 --- a/Software/ChainLube/src/webui.cpp +++ b/Software/ChainLube/src/webui.cpp @@ -52,6 +52,8 @@ void SettingChanged_Callback(Control *sender, int type) LubeConfig.TankRemindAtPercentage = ESPUI.getControl(num_tank_notify)->value.toInt(); else if (sender->id == num_dose_per_pulse) LubeConfig.amountPerDose_µl = ESPUI.getControl(num_dose_per_pulse)->value.toInt(); + else if (sender->id == num_purge_pulses) + LubeConfig.BleedingPulses = ESPUI.getControl(num_purge_pulses)->value.toInt(); } void buttons_Callback(Control *sender, int type) @@ -76,9 +78,8 @@ void buttons_Callback(Control *sender, int type) if (sender->id == button_purge) { - int pulses = ESPUI.getControl(num_purge_pulses)->value.toInt(); - Serial.printf("Starting to Purge with %d pulses", pulses); - globals.purgePulses = pulses; + Serial.printf("Starting to Purge with %d pulses", LubeConfig.BleedingPulses); + globals.purgePulses = LubeConfig.BleedingPulses; globals.resumeStatus = globals.systemStatus; globals.systemStatus = sysStat_Purge; } @@ -120,7 +121,7 @@ void initWebUI() label_tankRemain = ESPUI.addControl(ControlType::Label, "Tankinhalt verbleibend (ml, geschätzt)", String(LubeConfig.tankRemain_µl / 1000), ControlColor::Alizarin, tab_maintenance); button_reset_tank = ESPUI.addControl(ControlType::Button, "Tankinhalt zurücksetzen", "Reset", ControlColor::Alizarin, tab_maintenance, &buttons_Callback); - num_purge_pulses = ESPUI.addControl(ControlType::Number, "Entlüftung Impulse", "10", ControlColor::Alizarin, tab_maintenance); + num_purge_pulses = ESPUI.addControl(ControlType::Number, "Entlüftung Impulse", String(LubeConfig.BleedingPulses), ControlColor::Alizarin, tab_maintenance, &SettingChanged_Callback); button_purge = ESPUI.addControl(ControlType::Button, "Leitung Entlüften", "Start", ControlColor::Alizarin, tab_maintenance, &buttons_Callback); button_store = ESPUI.addControl(ControlType::Button, "Einstellungen permanent speichern", "Speichern", ControlColor::Turquoise, tab_store, &buttons_Callback);