Git Product home page Git Product logo

open-acidification / tankcontroller Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 33.0 13.3 MB

Arduino and web GUI source code for the Open Acidification tank controller (pH-stat unit).

Home Page: https://open-acidification.github.io/

License: Mozilla Public License 2.0

C++ 64.60% Makefile 6.58% Python 1.85% Shell 0.61% Ruby 0.07% Dart 10.03% HTML 0.92% C 15.32%
arduino flutter oa-box ocean-acidification ph-stat-unit tank-controller

tankcontroller's People

Contributors

aicaraveo avatar allcontributors[bot] avatar atg7000 avatar benjaminwachter avatar cherbel avatar eucalvo avatar evankropf avatar genevea avatar idzyre avatar je-foster avatar jgfoster avatar kavikick avatar keddel avatar khalilxl avatar kirtonthank avatar lsaca05 avatar paydenb avatar pianistrevor avatar prestoncarman avatar samuelnguyen999 avatar suocesky avatar taylorsmith28 avatar thomca avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

tankcontroller's Issues

Refactor loop.ino

Refactor the loop function to remove the user input into a separate function.

The new function should manage the keypad input. Use a switch statement to pick the correct character input from the to_start variable. The new function will probably reveal other code simplification.

Backspace button for entering numbers

Right now when any number is entered, if a mistake is made, you cannot backspace and correct the mistake. You have to finish entering the mistaken number and then go back to enter the number all over again.

Prevent next_path from regressing

Don't allow next_path to regress to a lower level of specificity, unless that lower level of specificity is greater than the previous value of next_path.

For instance, if next_path is currently "2020/05/31/06", don't let it become "2020/05/31", "2020/05", or "2020", as the next run of load_data() will then parse many endpoints that we already hit. The only time this would be acceptable is if the parent endpoint advances to the next directory (e.g. next_path goes from "2020/05/31/06" to "2020/06").

Serial print string using F macro

I think we can improve the memory usage by using the F macro.

Serial.print("Some string");

Lets switch the Serial.print and Serial.println statements to the following using the F macro:

Serial.print(F("Some string"));

Implement mechanism to dismiss a missed path

  1. The user should be able to decide to forget a missed path to stop it from being retried.
  2. A missed path should be automatically removed after a predefined number of retries (maybe 10?).

Remove libraries from repo

  • Remove library code from repository.
  • Switch to a model that downloads the libraries from a script (or something similar).

Update README

Explain setup, running for production, and development.

Remove Autotune

Describe the bug
Currently not working. Lets remove this until we have a working Tank Controller and then later add this as a feature.

Building an open source

Github has a site that explains key ingredients for an open source project: https://opensource.guide/

  • Readme - detail project
  • Code of Conduct
  • Contributing
  • Issue list - with some good first issues
  • linter

More items may be added.

Remove PID_AutoTune_v0 library

Currently this code is not in use. In an effort to clean things up, we should remove this. When the feature gets implemented, the PID_AutoTune_v0 library or alternate libraries can be included again.

Line length of 120 Character

Currently, several lines of the code exceed 120 characters. The code should be updated to fit within 120 characters. Once all the files have been updated the .clang-format file can be updated with the new line length.

Remove Dead Code

If the code has been commented out, it should not be in the repository. Remove commented out code from the repository.

Log calibration reading when changed

Is your feature request related to a problem? Please describe.
Create a log of the calibration setting similar to temperature and pH. Only changes need to be logged. The history would be helpful to see.

Describe the solution you'd like
Log to a file the calibration values (pH and Temperature) and time it changed.

Refactor LogToSD.ino

Separate the data written to the log from the log file management.

Goals:

  • Keep log file management in a single function.
  • Data to be written to the log is created in a separate function. Only passing the resulting new log line to the logging function.

Remove TimeLib

As far as I can tell, this is used only in ManualTime.ino lines 114, 122, and 124. The rtc object could be used instead.

Stop loading data on device deletion

Currently, deleting a device simply orphans its asynchronous refresh task, allowing it to pointlessly work indefinitely. Fix this so that the device halts the current refresh task if there is one.

Update the refresh.sh script

The refresh.sh script has been set up for a single developers configuration. It needs to be updated for the new code structure and made to work on any developers system. The code should also be loaded from the main branch.

Define global time variable constants for readability

All time-related variables are currently assigned in milliseconds. It would be nice to increase the readability through global constant time variables pre-assigned in milliseconds.
Example:
Convert
int exampleVariable = 300000
To
const int SECOND = 1000
const int MINUTE = 60 * SECOND
int exampleVariable = 5 * MINUTE

Don't delete a device's data on device deletion

Data deletion should be handled by the Tank view. In order to accomplish this, a datum should store the device's MAC address in a CharField instead of storing the device as a foreign key. This way, a device can be deleted while a history of its data is retained, and if the device is ever added again, it will still be able to access its old data.

Add Install and Development Documentation

Add items to the README or docs folder with instructions.

Topics

  • How to install the software on an arduino
  • How to set up your development environment
  • How to update the library

Add ramp function for pH and Temperature setpoints

When asking for a new pH or temperature, there should be a follow-up question of the number of hours (with tenths) to allow to get to the new value (see "SetTime" for an example of sub-states). The default hours will be zero to provide backwards compatibility. If a non-zero value is entered, then the current time and measured value (not target) will be the starting point for the ramp and the newly-entered target and the current time plus the number of hours (with fraction) will be the ending point. Each target query (typically to control the solenoid, but also to report to the screen, serial, and log) will be calculated based on a linear ramp between the start time/value and the end time/target.

This will require storing four values: (1) start time (uint32_t), (2) start value (float), (3) end time (also uint32_t), and (4) ending value (float) (which is already stored as the existing target so no new storage is required for it). The times could be stored as seconds since 2000 (note that millis() is based on (re)start time and rolls over in about 50 days so is not reliable as an end time).

Report when Calibratation of pH is done

Is your feature request related to a problem? Please describe.
This would improve the ability a user to know when calibration is finished.

Describe the solution you'd like
Display on the screen when the pH calibration has reach an equilibrium.

Building an open source

Github has a site that explains key ingredients for an open source project: https://opensource.guide/

  • Readme - detail project
  • Code of Conduct
  • Contributing
  • Issue list - with some good first issues
  • linter

More items may be added.

Remove Time Library from repository

Figure out a way to install and manage the Time library in a script (install_libraries.sh) instead of saving the files in the repository.

Create a "Projects"

A project is a list of devices that will be used over a specific time range.

The project should have:

  • a special view to see all results for these devices in one place
  • manage device list
  • manage time range
  • download project archives

Global Variable Review

Some global variables are only used in a single function. It may be possible refactor and reduce the number of global variables.

Goal

  • Reduce the number of global variables.

Over The Air Updates

Add the ability to do OTA based on a trigger from the control panel or server request.

Fix unexpected start_at behavior in load_data_recursive()

If start_at is specified and the corresponding endpoint doesn't exist, the next applicable endpoint will be visited. However, this doesn't cascade for the child endpoints, so they will still be subject to the original constraints specified in start_at. For example, if ['2020', '04', '24', '13', '2'] is specified for start_at, but the device doesn't have data for the month of April ('04'), but does have data for the month of May ('05'), then the function will skip to '05' as expected; however, the child endpoints ('24', '13', and '2') will not be reset to 0, and thus will naively assume that the parent is '04', causing all data prior to the second page of the 13th hour of the 24th of May to be erroneously skipped.

This issue is not likely to affect anything within the constraints of normal use, as 'start_at' will always be derived from the last visited path from the previous refresh, or else will be [0, 0, 0, 0, 0]. However, it would be nice to eventually fix this in case we wanted to, say, allow the user to add a new device and specify an arbitrary start point at which to begin downloading data.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.