Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schedule Switch does not turn off #118

Open
DarkStarDS9 opened this issue Apr 19, 2022 · 1 comment
Open

Schedule Switch does not turn off #118

DarkStarDS9 opened this issue Apr 19, 2022 · 1 comment

Comments

@DarkStarDS9
Copy link

I take it the schedule-switch should act as a toggle? When I tested it, it just stayed on. From reading the code, my guess is that this return here...

... shouldn't be there?!

I'm not a JS guy, but from a general clean-code-perspective, I think that the whole setStates-function would benefit from braking it up into smaller functions. Especially the case 'extra-cntrlswitch' could be put in something like handleExtraCntrlSwitch() and use a switch instead of the ifs to switch on Central, Shedule, Boost and Off, or at the very least use "else if" there - this would make the intention of the code more clear ("it's either this or that..."). With the existing "if (target !== 'Central')" at the end, it would be more clear that the intention is to run this on all the cases EXCEPT when target is Central.
Maybe it would be even more readable to have a resetSwitchState() and call this explicitly in all the relevant cases...

@r33ce15
Copy link

r33ce15 commented Dec 30, 2022

Yes I have noticed this too it would be great if this switch reacted as should so once a manual override has been do this switch should be turned off automatically allowing you to know it's been changed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants