From 866e7cf08b0dc55c0b0d8549e1c7ee631be8c220 Mon Sep 17 00:00:00 2001 From: tekka007 Date: Tue, 5 Jan 2016 14:48:23 +0100 Subject: [PATCH] HW-independent ClearEepromConfig, substitutes #314 --- libraries/MySensors/MySensor.h | 24 +++++++++++-------- .../ClearEepromConfig/ClearEepromConfig.ino | 10 ++++---- libraries/MySensors/keywords.txt | 3 ++- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/libraries/MySensors/MySensor.h b/libraries/MySensors/MySensor.h index d795655..c07402a 100644 --- a/libraries/MySensors/MySensor.h +++ b/libraries/MySensors/MySensor.h @@ -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 -#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 diff --git a/libraries/MySensors/examples/ClearEepromConfig/ClearEepromConfig.ino b/libraries/MySensors/examples/ClearEepromConfig/ClearEepromConfig.ino index fffc4f9..272bf43 100644 --- a/libraries/MySensors/examples/ClearEepromConfig/ClearEepromConfig.ino +++ b/libraries/MySensors/examples/ClearEepromConfig/ClearEepromConfig.ino @@ -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 #include +#include 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