Added safetyNet()
Still untested
This commit is contained in:
@@ -162,6 +162,8 @@ void loop() {
|
||||
//Serial.println(temp.cur);
|
||||
}
|
||||
|
||||
safetyNet(); //Overload protection
|
||||
|
||||
if (isFirstRun == true) {
|
||||
Blynk.virtualWrite(V53,temp.target);
|
||||
Blynk.virtualWrite(V55,temp.offset);
|
||||
|
||||
+15
-1
@@ -241,7 +241,7 @@ void ReadCse7766()
|
||||
|
||||
//Basic functions that must run
|
||||
void process() {
|
||||
if (timer(1000,0)) {
|
||||
if (timer(2000,0)) {
|
||||
ReadCse7766();
|
||||
}
|
||||
|
||||
@@ -318,8 +318,22 @@ bool overloadCheck() {
|
||||
}
|
||||
|
||||
void safetyNet() {
|
||||
overloadCheck();
|
||||
|
||||
if (!safeLoad && timerCheck(4) >= loadCooldown*1000 && loadAttempt < loadConnectAttempts) {
|
||||
safeLoad = true;
|
||||
loadAttempt++;
|
||||
timerReset(4);
|
||||
timerReset(5);
|
||||
}
|
||||
|
||||
if (loadAttempt > 0) {
|
||||
if (timerCheck(5) > 30*1000) { //If relay hasn't overloaded for 30 seconds, reset the loadAttempt count
|
||||
loadAttempt = 0;
|
||||
}
|
||||
|
||||
if (loadAttempt > loadConnectAttempts) {
|
||||
resetRequired = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,11 @@
|
||||
* 2 - Update Blynk app data
|
||||
* 3 - Heater trigger cooldown
|
||||
* 4 - Overload cooldown
|
||||
* 5 - Overload reset
|
||||
*/
|
||||
|
||||
|
||||
#define countDataAmount 5 //Number of timers
|
||||
#define countDataAmount 6 //Number of timers
|
||||
unsigned long countData[countDataAmount] = {0}; //Holds count information. (Adjust for numeber of timers needed.)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user