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
|
// Enable this in sketch if you want to use TX(1), RX(0) as normal I/O pin
|
||||||
//#define MY_DISABLED_SERIAL
|
//#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
|
// Turn off debug if serial pins is used for other stuff
|
||||||
#ifdef MY_DISABLED_SERIAL
|
#ifdef MY_DISABLED_SERIAL
|
||||||
#undef MY_DEBUG
|
#undef MY_DEBUG
|
||||||
|
|||||||
@@ -48,8 +48,10 @@
|
|||||||
//#undef F
|
//#undef F
|
||||||
//#define F(x) (x)
|
//#define F(x) (x)
|
||||||
#include "core/MyHwESP8266.cpp"
|
#include "core/MyHwESP8266.cpp"
|
||||||
// For ESP8266, we always enable gateway feature
|
// Enable gateway feature
|
||||||
#define MY_GATEWAY_ESP8266
|
#if !defined(MY_CORE_ONLY)
|
||||||
|
#define MY_GATEWAY_ESP8266
|
||||||
|
#endif
|
||||||
#elif defined(ARDUINO_ARCH_AVR)
|
#elif defined(ARDUINO_ARCH_AVR)
|
||||||
#include "core/MyHwATMega328.cpp"
|
#include "core/MyHwATMega328.cpp"
|
||||||
#elif defined(ARDUINO_ARCH_SAMD)
|
#elif defined(ARDUINO_ARCH_SAMD)
|
||||||
@@ -219,22 +221,24 @@
|
|||||||
#undef MY_INCLUSION_BUTTON_FEATURE
|
#undef MY_INCLUSION_BUTTON_FEATURE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(MY_GATEWAY_FEATURE) && !defined(MY_RADIO_FEATURE)
|
#if !defined(MY_CORE_ONLY)
|
||||||
#error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
|
#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
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include "core/MyCapabilities.h"
|
#include "core/MyCapabilities.h"
|
||||||
#include "core/MyMessage.cpp"
|
#include "core/MyMessage.cpp"
|
||||||
#include "core/MySensorCore.cpp"
|
#include "core/MySensorCore.cpp"
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
#if defined(MY_GATEWAY_ESP8266)
|
#if !defined(MY_CORE_ONLY)
|
||||||
#include "core/MyMainESP8266.cpp"
|
#if defined(MY_GATEWAY_ESP8266)
|
||||||
#else
|
#include "core/MyMainESP8266.cpp"
|
||||||
#include "core/MyMainDefault.cpp"
|
#else
|
||||||
|
#include "core/MyMainDefault.cpp"
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -190,6 +190,9 @@ ControllerConfig getConfig() {
|
|||||||
boolean _sendRoute(MyMessage &message) {
|
boolean _sendRoute(MyMessage &message) {
|
||||||
// increment heartbeat counter
|
// increment heartbeat counter
|
||||||
_heartbeat++;
|
_heartbeat++;
|
||||||
|
#if defined(MY_CORE_ONLY)
|
||||||
|
(void)message;
|
||||||
|
#endif
|
||||||
#if defined(MY_GATEWAY_FEATURE)
|
#if defined(MY_GATEWAY_FEATURE)
|
||||||
if (message.destination == _nc.nodeId) {
|
if (message.destination == _nc.nodeId) {
|
||||||
// This is a message sent from a sensor attached on the gateway node.
|
// 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
|
* 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 <EEPROM.h>
|
||||||
|
#include <MySensor.h>
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin(MY_BAUD_RATE);
|
Serial.begin(MY_BAUD_RATE);
|
||||||
Serial.println("Started clearing. Please wait...");
|
Serial.println("Started clearing. Please wait...");
|
||||||
for (int i=0;i<512;i++) {
|
for (int i=0;i<EEPROM_LOCAL_CONFIG_ADDRESS;i++) {
|
||||||
EEPROM.write(i, 0xff);
|
hwWriteConfig(i,0xFF);
|
||||||
}
|
}
|
||||||
Serial.println("Clearing done. You're ready to go!");
|
Serial.println("Clearing done. You're ready to go!");
|
||||||
}
|
}
|
||||||
@@ -40,4 +42,4 @@ void setup()
|
|||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
// Nothing to do here...
|
// Nothing to do here...
|
||||||
}
|
}
|
||||||
@@ -31,6 +31,7 @@ smartSleep KEYWORD2
|
|||||||
#######################################
|
#######################################
|
||||||
AUTO LITERAL1
|
AUTO LITERAL1
|
||||||
MY_DEBUG LITERAL1
|
MY_DEBUG LITERAL1
|
||||||
|
MY_CORE_ONLY LITERAL1
|
||||||
MY_REPEATER_FEATURE LITERAL1
|
MY_REPEATER_FEATURE LITERAL1
|
||||||
MY_RADIO_NRF24 LITERAL1
|
MY_RADIO_NRF24 LITERAL1
|
||||||
MY_RADIO_RFM69 LITERAL1
|
MY_RADIO_RFM69 LITERAL1
|
||||||
|
|||||||
Reference in New Issue
Block a user