Browse Source

Moved EEPROM initialization to main sketch

fastled
Xose Pérez 7 years ago
parent
commit
a887cc8789
2 changed files with 8 additions and 4 deletions
  1. +7
    -1
      code/espurna/espurna.ino
  2. +1
    -3
      code/espurna/relay.ino

+ 7
- 1
code/espurna/espurna.ino View File

@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config/all.h"
#include <EEPROM.h>
// -----------------------------------------------------------------------------
// 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
}


+ 1
- 3
code/espurna/relay.ino View File

@ -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);


Loading…
Cancel
Save