Skip to content

Commit

Permalink
added saveinterval to protect SD card
Browse files Browse the repository at this point in the history
  • Loading branch information
jordancrubin committed Jul 23, 2022
1 parent 6607a7f commit 5d8d43b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
10 changes: 6 additions & 4 deletions examples/testmeter/testmeter.ino
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,32 @@
can be adjusted as parameters in the instance creation.
https://www.youtube.com/c/jordanrubin6502
2020 - 2022 Jordan Rubin.
*/
*/
#include <Arduino.h> //required for platformio
#include <Watermeter.h>

/*
WATERMETER WATERMETER(SignalGPIOpin,useInternalPullupResistor,measure[g|l],metervalue)
WATERMETER WATERMETER(SignalGPIOpin,useInternalPullupResistor,measure[g|l],metervalue,saveInterval)
Using GPIO 15 [15]
Using internal pullup resistors [true]
This meter is designed as gallons [g]
Debounce delay in ms [100]
Use SD card to autosave meter to filesys [true]
Use SD card to autosave meter to filesys [true]
The value of measurment added each time [.1] i.e. .1 gallons per pulse
The save interval to SD in seconds [30]
If SD card is set to true the programme will expect a fat32 formatted SD card installed in the unit.
It uses the default connections. SPIFFS hase been completely removed as of this version, given the
constant barrage of read and saves to the ESP32 thousands of times over is unhealthy for the device.
The save interval further limits constant writes to the SD card by limiting updates to the interval.
CS -> GPIO 5
MOSI -> GPIO 23
CLK -> GPIO 18
MISO -> GPIO 19
*/

WATERMETER thisMeter(15,true,'g',100,true,.1);
WATERMETER thisMeter(15,true,'g',100,true,.1,30);

void setup() {
Serial.begin(38400);
Expand Down
4 changes: 2 additions & 2 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name=Watermeter
version=1.0.5
version=1.0.6
author=Jordan Rubin <[email protected]>
maintainer=Jordan Rubin <[email protected]>
sentence=Control Library for reed switch pulse actuated water meters such as the DAE Water Meter Model V-100P
paragraph=Support includes Gallons/Litres, Debounce adjustment, conversion, and SPIFFS filesystem power off backup support.
paragraph=Support includes Gallons/Litres, Debounce adjustment, conversion, and SD card filesystem power off backup support.
category=Device Control
url=https://github.com/jordancrubin/watermeter
architectures=*
14 changes: 8 additions & 6 deletions src/main.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,32 @@
can be adjusted as parameters in the instance creation.
https://www.youtube.com/c/jordanrubin6502
2020 - 2022 Jordan Rubin.
*/
*/
#include <Arduino.h> //required for platformio
#include <Watermeter.h>

/*
WATERMETER WATERMETER(SignalGPIOpin,useInternalPullupResistor,measure[g|l],metervalue)
WATERMETER WATERMETER(SignalGPIOpin,useInternalPullupResistor,measure[g|l],metervalue,saveInterval)
Using GPIO 15 [15]
Using internal pullup resistors [true]
This meter is designed as gallons [g]
Debounce delay in ms [100]
Use SD card to autosave meter to filesys [true]
The value of measurment added each time [.1] i.e. .1 gallons per pulse
Use SD card to autosave meter to filesys [true]
The value of measurment added each time [.1] i.e. .1 gallons per pulse
The save interval to SD in seconds [30]

If SD card is set to true the programme will expect a fat32 formatted SD card installed in the unit.
It uses the default connections. SPIFFS hase been completely removed as of this version, given the
constant barrage of read and saves to the ESP32 thousands of times over is unhealthy for the device.
constant barrage of read and saves to the ESP32 thousands of times over is unhealthy for the device.
The save interval further limits constant writes to the SD card by limiting updates to the interval.

CS -> GPIO 5
MOSI -> GPIO 23
CLK -> GPIO 18
MISO -> GPIO 19
*/

WATERMETER thisMeter(15,true,'g',100,true,.1);
WATERMETER thisMeter(15,true,'g',100,true,.1,30);

void setup() {
Serial.begin(38400);
Expand Down

0 comments on commit 5d8d43b

Please sign in to comment.