File tree 5 files changed +27
-14
lines changed
examples/ClearEepromConfig
5 files changed +27
-14
lines changed Original file line number Diff line number Diff line change 42
42
// Enable this in sketch if you want to use TX(1), RX(0) as normal I/O pin
43
43
//#define MY_DISABLED_SERIAL
44
44
45
+ // Enable MY_CORE_ONLY flag if you want to use core functions without loading the framework
46
+ //#define MY_CORE_ONLY
47
+
45
48
// Turn off debug if serial pins is used for other stuff
46
49
#ifdef MY_DISABLED_SERIAL
47
50
#undef MY_DEBUG
Original file line number Diff line number Diff line change 48
48
//#undef F
49
49
//#define F(x) (x)
50
50
#include "core/MyHwESP8266.cpp"
51
- // For ESP8266, we always enable gateway feature
52
- #define MY_GATEWAY_ESP8266
51
+ // Enable gateway feature
52
+ #if !defined(MY_CORE_ONLY )
53
+ #define MY_GATEWAY_ESP8266
54
+ #endif
53
55
#elif defined(ARDUINO_ARCH_AVR )
54
56
#include "core/MyHwATMega328.cpp"
55
57
#elif defined(ARDUINO_ARCH_SAMD )
219
221
#undef MY_INCLUSION_BUTTON_FEATURE
220
222
#endif
221
223
222
- #if !defined(MY_GATEWAY_FEATURE ) && !defined(MY_RADIO_FEATURE )
223
- #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
224
+ #if !defined(MY_CORE_ONLY )
225
+ #if !defined(MY_GATEWAY_FEATURE ) && !defined(MY_RADIO_FEATURE )
226
+ #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
227
+ #endif
224
228
#endif
225
229
226
-
227
230
#include "core/MyCapabilities.h"
228
231
#include "core/MyMessage.cpp"
229
232
#include "core/MySensorCore.cpp"
230
233
231
234
#include <Arduino.h>
232
235
233
- #if defined(MY_GATEWAY_ESP8266 )
234
- #include "core/MyMainESP8266.cpp"
235
- #else
236
- #include "core/MyMainDefault.cpp"
236
+ #if !defined(MY_CORE_ONLY )
237
+ #if defined(MY_GATEWAY_ESP8266 )
238
+ #include "core/MyMainESP8266.cpp"
239
+ #else
240
+ #include "core/MyMainDefault.cpp"
241
+ #endif
237
242
#endif
238
243
239
-
240
244
#endif
Original file line number Diff line number Diff line change @@ -190,6 +190,9 @@ ControllerConfig getConfig() {
190
190
boolean _sendRoute (MyMessage &message) {
191
191
// increment heartbeat counter
192
192
_heartbeat++;
193
+ #if defined(MY_CORE_ONLY)
194
+ (void )message;
195
+ #endif
193
196
#if defined(MY_GATEWAY_FEATURE)
194
197
if (message.destination == _nc.nodeId ) {
195
198
// This is a message sent from a sensor attached on the gateway node.
Original file line number Diff line number Diff line change 23
23
* This sketch clears radioId, relayId and other routing information in EEPROM back to factory default
24
24
*
25
25
*/
26
+ // load core modules only
27
+ #define MY_CORE_ONLY
26
28
27
- #include < MyConfig.h>
28
29
#include < EEPROM.h>
30
+ #include < MySensor.h>
29
31
30
32
void setup ()
31
33
{
32
34
Serial.begin (MY_BAUD_RATE);
33
35
Serial.println (" Started clearing. Please wait..." );
34
- for (int i=0 ;i<512 ;i++) {
35
- EEPROM. write (i, 0xff );
36
+ for (int i=0 ;i<EEPROM_LOCAL_CONFIG_ADDRESS ;i++) {
37
+ hwWriteConfig (i,0xFF );
36
38
}
37
39
Serial.println (" Clearing done. You're ready to go!" );
38
40
}
39
41
40
42
void loop ()
41
43
{
42
44
// Nothing to do here...
43
- }
45
+ }
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ smartSleep KEYWORD2
31
31
#######################################
32
32
AUTO LITERAL1
33
33
MY_DEBUG LITERAL1
34
+ MY_CORE_ONLY LITERAL1
34
35
MY_REPEATER_FEATURE LITERAL1
35
36
MY_RADIO_NRF24 LITERAL1
36
37
MY_RADIO_RFM69 LITERAL1
You can’t perform that action at this time.
0 commit comments