Skip to content

Commit

Permalink
Add startup heater delay
Browse files Browse the repository at this point in the history
  • Loading branch information
apokidin committed Dec 2, 2022
1 parent 2e01a7c commit fdcb63f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"files.associations": {
"functional": "cpp"
}
{
"files.associations": {
"functional": "cpp"
}
}
14 changes: 10 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ AutoConnect portal(server);
#define PING_TIMEOUT_MS 6000 //set from 500 to 1000 to see if its better for discons/hr
#define SUBACK_TIMEOUT_MS 6000 //set from 500 to 1000 to see if its better for discons/hr
void msgReceived(char* topic, byte* payload, unsigned int len);
char* mqtt_server = "192.168.8.1";
char* mqtt_server = "192.168.5.1";

#define DELAY_TIME 10; // mins
bool is_delay = true;

#define CREDENTIAL_OFFSET 64
uint8_t opcode; // register
Expand All @@ -57,7 +60,7 @@ int l_counter = 0;
int b = 0;

byte data[10];
bool pin_9 = true;
bool pin_9 = false;

long lastReconnectAttempt = 0;
StaticJsonDocument<256> doc;
Expand Down Expand Up @@ -132,6 +135,7 @@ void setup(){

void loop(){

is_delay = (millis() / 1000 / 60) < DELAY_TIME;

if (WiFi.status() == WL_CONNECTED) {
// Here to do when WiFi is connected.
Expand Down Expand Up @@ -213,16 +217,18 @@ void emonTick( void * pvParameters ){
}

if(h_counter > I_REPEATS && pin_9 == true ){
pin_9 = false;
h_counter = 0;
pin_9 = false;
digitalWrite(I_PIN, pin_9);
}

if(l_counter > I_REPEATS && pin_9 == false ){
pin_9 = true;
l_counter = 0;
if(is_delay)
pin_9 = true;
digitalWrite(I_PIN, pin_9);
}

vTaskDelay(100);
Serial.println("emonTick");
}
Expand Down

0 comments on commit fdcb63f

Please sign in to comment.