123456789101112131415161718192021222324252627282930 |
- unsigned long lastPwrCheck_millis = 0;
- boolean powerOut = false;
- void checkPowerGood() {
-
-
-
-
- if (powerGoodMinValue > 0) {
- if (!powerOut && analogRead(PIN_IN_ADC_PWRGOOD) < powerGoodMinValue) {
- powerOut = true;
- saveAllCurrentData(false);
- Serial.println("POWER IS GOING DOWN...");
-
- }
- else if (powerOut && analogRead(PIN_IN_ADC_PWRGOOD) > (powerGoodMinValue + 20)) {
- powerOut = false;
- Serial.println("POWER RESTORED...");
- }
- }
- }
- void printPowerValue() {
- Serial.print(F("POWER: pwrCurr="));
- Serial.print(analogRead(PIN_IN_ADC_PWRGOOD));
- Serial.print(F(", pwrGood="));
- Serial.print(powerGoodMinValue);
- Serial.println();
- }
|