Skip to content

Commit

Permalink
Merge pull request #12 from GreenWizard2015/fix-bugs
Browse files Browse the repository at this point in the history
quick fix
  • Loading branch information
GreenWizard2015 authored Feb 8, 2024
2 parents 1cec79c + e5438a7 commit 34c73e1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
9 changes: 8 additions & 1 deletion controller/tea_poor/lib/Arduino/RemoteControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
5 changes: 3 additions & 2 deletions ui/src/components/SystemControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand All @@ -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);

0 comments on commit 34c73e1

Please sign in to comment.