diff --git a/code/espurna/espurna.ino b/code/espurna/espurna.ino
index e9174bba..e2a40bcd 100644
--- a/code/espurna/espurna.ino
+++ b/code/espurna/espurna.ino
@@ -20,6 +20,7 @@ along with this program. If not, see .
*/
#include "config/all.h"
+#include
// -----------------------------------------------------------------------------
// METHODS
@@ -32,6 +33,7 @@ String getIdentifier() {
}
void hardwareSetup() {
+ EEPROM.begin(4096);
Serial.begin(SERIAL_BAUDRATE);
#if not EMBEDDED_WEB
SPIFFS.begin();
@@ -53,6 +55,9 @@ void hardwareLoop() {
DEBUG_MSG("[MAIN] Time: %s\n", (char *) NTP.getTimeDateString().c_str());
DEBUG_MSG("[MAIN] Uptime: %ld seconds\n", uptime_seconds);
DEBUG_MSG("[MAIN] Free heap: %d bytes\n", ESP.getFreeHeap());
+ #if ENABLE_VCC_REPORT
+ DEBUG_MSG("[MAIN] Power: %d mV\n", ESP.getVcc());
+ #endif
#if (MQTT_REPORTS | MQTT_STATUS_REPORT)
mqttSend(MQTT_STATUS_TOPIC, "1");
@@ -67,9 +72,10 @@ void hardwareLoop() {
mqttSend(MQTT_FREEHEAP_TOPIC, String(ESP.getFreeHeap()).c_str());
#endif
#if (MQTT_REPORTS | MQTT_VCC_REPORT)
- DEBUG_MSG("[BEAT] Power: %d mV\n", ESP.getVcc());
+ #if ENABLE_VCC_REPORT
mqttSend(MQTT_VCC_TOPIC, String(ESP.getVcc()).c_str());
#endif
+ #endif
}
diff --git a/code/espurna/relay.ino b/code/espurna/relay.ino
index 230a14c6..cfa9379b 100644
--- a/code/espurna/relay.ino
+++ b/code/espurna/relay.ino
@@ -555,14 +555,12 @@ void relaySetup() {
#endif
- EEPROM.begin(4096);
- byte relayMode = getSetting("relayMode", RELAY_MODE).toInt();
-
#if RELAY_PROVIDER == RELAY_PROVIDER_MY9291
_my9291 = new my9291(MY9291_DI_PIN, MY9291_DCKI_PIN, MY9291_COMMAND);
retrieveLightColor();
#endif
+ byte relayMode = getSetting("relayMode", RELAY_MODE).toInt();
for (unsigned int i=0; i < _relays.size(); i++) {
pinMode(_relays[i].pin, OUTPUT);
if (relayMode == RELAY_MODE_OFF) relayStatus(i, false);