Open-Acidification / TankController

Arduino and web GUI source code for the Open Acidification tank controller (pH-stat unit).
https://open-acidification.github.io/
Mozilla Public License 2.0
8 stars 33 forks source link

Adding editability to sine period and amplitude on CurrentData page #461

Open lydiathiel opened 3 months ago

lydiathiel commented 3 months ago

Currently, the variables pH_SinePeriodHours, pH_SineAmplitude, Therm_SineAmplitude, and Therm_SinePeriodHours are visible, but not editable from the Current Data page. The main issue with implementing this is including tests that cover each edge case for switching between different calculation modes.

However, the infrastructure is in place to have these values be editable. Currently, in EthernetServer_TC.cpp, there are variables and case statements set up to receive PUT requests changing the sine period and amplitude. The correct function calls in order would just need to be added after the switch statement around line 220 in this file.

One major problem I ran into while trying to make this work was values randomly going extremely out of bounds, which I also discuss in my draft pull request mentioned at the end of this. In addition, to stick with setting FunctionTypes implicitly, the function calls within sine switch statements should begin with setting ramp Hours to 0, then setting sine period hours or amplitude, implicitly switching into sine mode. However, if setting either sine value to 0, the last call should be to ramp hours, implicitly switching to ramp mode.

There is many different test cases for switching between different modes that will need to be implemented.

Here is my working sketch on what should happen when each of these values are set.

This is my Draft Pull request with my proposed & buggy changes to sine editability: https://github.com/Open-Acidification/TankController/pull/460