Skip to content

Commit

Permalink
air pump cycling feature added
Browse files Browse the repository at this point in the history
  • Loading branch information
jakehosen committed Jun 14, 2024
1 parent aae011d commit 882bf83
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
33 changes: 32 additions & 1 deletion src/datalogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ void Datalogger::setup()

clearAllAlarms(); // don't respond to alarms during setup

// actuator timestamp setup
// actuator variables
unsigned long pumpStopTime = timestamp() + 10800;
unsigned long pumpResetTime = timestamp() + 21600;
unsigned int powermode = 2;
debug(pumpStopTime);
debug(pumpResetTime);

//initBLE();

unsigned char uuid[UUID_LENGTH];
Expand Down Expand Up @@ -236,7 +244,30 @@ void Datalogger::testMeasurementCycle()

void Datalogger::loop()
{

// actuator timestamp setup
// actuator variables
unsigned long pumpStopTime = timestamp() + 10800;
unsigned long pumpResetTime = timestamp() + 21600;
unsigned int powermode = 2;
debug(pumpStopTime);
debug(pumpResetTime);
unsigned long timeCheck = timestamp();
if(powermode==2) {
digitalWrite(GPIO_PIN_6, HIGH);
}

if(timeCheck>=pumpStopTime&&powermode==1) {
powermode=1;
digitalWrite(GPIO_PIN_6, LOW);
}

if(timeCheck>=pumpResetTime&&powermode==2) {
powermode=1;
digitalWrite(GPIO_PIN_6, HIGH);
pumpStopTime = timestamp() + 10800;
pumpResetTime = timestamp() + 21600;
}

if (inMode(deploy_on_trigger))
{
deploy(); // if deploy returns false here, the trigger setup has a fatal coding defect not detecting invalid conditions for deployment
Expand Down
2 changes: 2 additions & 0 deletions src/datalogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ class Datalogger

void processCLI();



// settings
void setSiteName(char * siteName);
void setDeploymentIdentifier(char * deploymentIdentifier);
Expand Down

0 comments on commit 882bf83

Please sign in to comment.