update measure interval to 1h

This commit is contained in:
Nicu Hodos 2022-10-17 14:14:23 +02:00
parent ef00f5f417
commit d803b2402d
2 changed files with 4 additions and 4 deletions

View File

@ -12,6 +12,7 @@ public:
void setup() { void setup() {
pinMode(VCC_PIN, OUTPUT); pinMode(VCC_PIN, OUTPUT);
turnOff();
} }
unsigned int scan() { unsigned int scan() {

View File

@ -10,8 +10,8 @@
#include "SonarSensor.h" #include "SonarSensor.h"
#define SEND_INTERVAL 37 // 37*8s = ~5min #define SEND_INTERVAL 450 // 450*8s = ~1 hour
#define SEND_VCC_INTERVAL (SEND_INTERVAL*6) // ~30min #define SEND_VCC_INTERVAL (SEND_INTERVAL*12) // ~12 hours
SonarSensor oilSensor(OIL_SENSOR); SonarSensor oilSensor(OIL_SENSOR);
@ -22,7 +22,6 @@ volatile bool shouldSend = true;
void setup() { void setup() {
oilSensor.setup(); oilSensor.setup();
TinySwitch::setup(SENDER_PIN); TinySwitch::setup(SENDER_PIN);
delay(10000);
TinyPower::setup(); TinyPower::setup();
TinyPower::enableWdt(WDTO_8S); TinyPower::enableWdt(WDTO_8S);
} }
@ -31,7 +30,7 @@ void loop() {
if (shouldSend) { if (shouldSend) {
shouldSend = false; shouldSend = false;
oilSensor.turnOn(); oilSensor.turnOn();
delay(1000); delay(500);
unsigned int distance = oilSensor.scan(); unsigned int distance = oilSensor.scan();
oilSensor.turnOff(); oilSensor.turnOff();
if (distance) { if (distance) {