diff --git a/controller/tea_poor/lib/Arduino/RemoteControl.cpp b/controller/tea_poor/lib/Arduino/RemoteControl.cpp index 5d9b1e7..c314d46 100644 --- a/controller/tea_poor/lib/Arduino/RemoteControl.cpp +++ b/controller/tea_poor/lib/Arduino/RemoteControl.cpp @@ -96,7 +96,14 @@ void RemoteControl::reconnect() { } void RemoteControl::process() { - if(WL_CONNECTED != WiFi.status()) { + const auto status = WiFi.status(); + // TODO: verify if this is the correct way to detect if we need to reconnect + const bool needsReconnect = ( + (WL_CONNECT_FAILED == status) || + (WL_CONNECTION_LOST == status) || + (WL_DISCONNECTED == status) + ); + if(needsReconnect) { reconnect(); return; // wait for next tick, just to be sure that all is ok } diff --git a/ui/src/components/SystemControls.js b/ui/src/components/SystemControls.js index b98b6e5..86b085f 100644 --- a/ui/src/components/SystemControls.js +++ b/ui/src/components/SystemControls.js @@ -6,11 +6,11 @@ import { useWaterPumpAPI } from '../contexts/WaterPumpAPIContext'; import { startPump, stopPump } from '../store/slices/SystemStatus.js'; export function SystemControlsComponent({ - pouringTime, systemStatus, startPump, stopPump + pouringTime, powerLevel, systemStatus, startPump, stopPump }) { const api = useWaterPumpAPI().API; const handleStart = async () => { - await startPump({ api , pouringTime }); + await startPump({ api, pouringTime, powerLevel }); }; const handleStop = async () => { @@ -33,6 +33,7 @@ export function SystemControlsComponent({ export default connect( state => ({ pouringTime: state.UI.pouringTime, + powerLevel: state.UI.powerLevelInPercents, systemStatus: state.systemStatus, }), { startPump, stopPump } )(SystemControlsComponent); \ No newline at end of file