Merge pull request #325 from tekka007/ClearConfig
HW-independent ClearEepromConfig, substitutes #314
This commit is contained in:
@@ -42,6 +42,9 @@
|
||||
// Enable this in sketch if you want to use TX(1), RX(0) as normal I/O pin
|
||||
//#define MY_DISABLED_SERIAL
|
||||
|
||||
// Enable MY_CORE_ONLY flag if you want to use core functions without loading the framework
|
||||
//#define MY_CORE_ONLY
|
||||
|
||||
// Turn off debug if serial pins is used for other stuff
|
||||
#ifdef MY_DISABLED_SERIAL
|
||||
#undef MY_DEBUG
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -190,6 +190,9 @@ ControllerConfig getConfig() {
|
||||
boolean _sendRoute(MyMessage &message) {
|
||||
// increment heartbeat counter
|
||||
_heartbeat++;
|
||||
#if defined(MY_CORE_ONLY)
|
||||
(void)message;
|
||||
#endif
|
||||
#if defined(MY_GATEWAY_FEATURE)
|
||||
if (message.destination == _nc.nodeId) {
|
||||
// This is a message sent from a sensor attached on the gateway node.
|
||||
|
||||
@@ -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...
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,7 @@ smartSleep KEYWORD2
|
||||
#######################################
|
||||
AUTO LITERAL1
|
||||
MY_DEBUG LITERAL1
|
||||
MY_CORE_ONLY LITERAL1
|
||||
MY_REPEATER_FEATURE LITERAL1
|
||||
MY_RADIO_NRF24 LITERAL1
|
||||
MY_RADIO_RFM69 LITERAL1
|
||||
|
||||
Reference in New Issue
Block a user