From 8ee713b616f6b47192e3cb4078db93408c20597f Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Wed, 22 Jan 2020 15:26:07 +0100 Subject: [PATCH] Included some code from @dakarym to support the self powered board for testing --- src/AmsToMqttBridge.ino | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/AmsToMqttBridge.ino b/src/AmsToMqttBridge.ino index 69ce40c6..0160c227 100644 --- a/src/AmsToMqttBridge.ino +++ b/src/AmsToMqttBridge.ino @@ -4,9 +4,7 @@ Author: roarf */ - -//#define HAS_DALLAS_TEMP_SENSOR 1 // Set to zero if Dallas one wire temp sensor is not present -//#define IS_CUSTOM_AMS_BOARD 1 // Set to zero if using NodeMCU or board not designed by Roar Fredriksen +ADC_MODE(ADC_VCC); #include #include @@ -77,6 +75,15 @@ void setup() { debugger->println("Started..."); } + if (ESP.getVcc() < 3300) { + if(debugger) { + debugger->print("Voltage is too low: "); + debugger->print(ESP.getVcc()); + debugger->println("v"); + } + ESP.deepSleep(5000000); //Deep sleep for 5 seconds to allow output cap to charge up + } + // Flash the LED, to indicate we can boot as AP now pinMode(LED_PIN, OUTPUT); led_on();