HW-independent ClearEepromConfig, substitutes #314

This commit is contained in:
tekka007
2016-01-11 21:12:59 +01:00
parent 60318a702d
commit 866e7cf08b
3 changed files with 22 additions and 15 deletions
+14 -10
View File
@@ -48,8 +48,10 @@
//#undef F
//#define F(x) (x)
#include "core/MyHwESP8266.cpp"
// For ESP8266, we always enable gateway feature
#define MY_GATEWAY_ESP8266
// Enable gateway feature
#if !defined(MY_CORE_ONLY)
#define MY_GATEWAY_ESP8266
#endif
#elif defined(ARDUINO_ARCH_AVR)
#include "core/MyHwATMega328.cpp"
#elif defined(ARDUINO_ARCH_SAMD)
@@ -219,22 +221,24 @@
#undef MY_INCLUSION_BUTTON_FEATURE
#endif
#if !defined(MY_GATEWAY_FEATURE) && !defined(MY_RADIO_FEATURE)
#error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
#if !defined(MY_CORE_ONLY)
#if !defined(MY_GATEWAY_FEATURE) && !defined(MY_RADIO_FEATURE)
#error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
#endif
#endif
#include "core/MyCapabilities.h"
#include "core/MyMessage.cpp"
#include "core/MySensorCore.cpp"
#include <Arduino.h>
#if defined(MY_GATEWAY_ESP8266)
#include "core/MyMainESP8266.cpp"
#else
#include "core/MyMainDefault.cpp"
#if !defined(MY_CORE_ONLY)
#if defined(MY_GATEWAY_ESP8266)
#include "core/MyMainESP8266.cpp"
#else
#include "core/MyMainDefault.cpp"
#endif
#endif
#endif
@@ -23,16 +23,18 @@
* This sketch clears radioId, relayId and other routing information in EEPROM back to factory default
*
*/
// load core modules only
#define MY_CORE_ONLY
#include <MyConfig.h>
#include <EEPROM.h>
#include <MySensor.h>
void setup()
{
Serial.begin(MY_BAUD_RATE);
Serial.println("Started clearing. Please wait...");
for (int i=0;i<512;i++) {
EEPROM.write(i, 0xff);
for (int i=0;i<EEPROM_LOCAL_CONFIG_ADDRESS;i++) {
hwWriteConfig(i,0xFF);
}
Serial.println("Clearing done. You're ready to go!");
}
@@ -40,4 +42,4 @@ void setup()
void loop()
{
// Nothing to do here...
}
}
+2 -1
View File
@@ -109,4 +109,5 @@ MY_GATEWAY_MQTT_CLIENT LITERAL1
MY_DISABLE_REMOTE_RESET LITERAL1
MY_RS485_DE_PIN LITERAL1
MY_SIGNING_REQUEST_SIGNATURES LITERAL1
MY_SMART_SLEEP_WAIT_DURATION LITERAL1
MY_SMART_SLEEP_WAIT_DURATION LITERAL1
MY_CORE_ONLY LITERAL1