diff --git a/hal/architecture/ESP8266/MyHwESP8266.cpp b/hal/architecture/ESP8266/MyHwESP8266.cpp index 5bfca8d37..d76e2cf61 100644 --- a/hal/architecture/ESP8266/MyHwESP8266.cpp +++ b/hal/architecture/ESP8266/MyHwESP8266.cpp @@ -17,6 +17,7 @@ * version 2 as published by the Free Software Foundation. */ +#include #include "MyHwESP8266.h" bool hwInit(void) @@ -29,7 +30,12 @@ bool hwInit(void) #endif #endif EEPROM.begin(EEPROM_size); - return true; + // register _process() to be called at most every 1us, + // at every loop() or yield() + return schedule_recurrent_function_us([]() { + _process(); + return true; + }, 1); } void hwReadConfigBlock(void *buf, void *addr, size_t length) diff --git a/hal/architecture/ESP8266/MyMainESP8266.cpp b/hal/architecture/ESP8266/MyMainESP8266.cpp deleted file mode 100644 index 70a2e1006..000000000 --- a/hal/architecture/ESP8266/MyMainESP8266.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * The MySensors Arduino library handles the wireless radio link and protocol - * between your home built sensors/actuators and HA controller of choice. - * The sensors forms a self healing radio network with optional repeaters. Each - * repeater and gateway builds a routing tables in EEPROM which keeps track of the - * network topology allowing messages to be routed to nodes. - * - * Created by Henrik Ekblad - * Copyright (C) 2013-2022 Sensnology AB - * Full contributor list: https://github.com/mysensors/MySensors/graphs/contributors - * - * Documentation: http://www.mysensors.org - * Support Forum: http://forum.mysensors.org - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 as published by the Free Software Foundation. - */ - -inline void _my_sensors_loop() -{ - // Process incoming data - _process(); - // Call of loop() in the Arduino sketch - loop(); -} - -/* - * Use preprocessor defines for injection of the MySensors calls - * to _begin() and _process() in file core_esp8266_main.cpp. - * These functions implement the "magic" how the MySensors stack - * is setup and executed in background without need - * for explicit calls from the Arduino sketch. - */ - -// Start up MySensors library including call of setup() in the Arduino sketch -#define setup _begin -// Helper function to _process() and call of loop() in the Arduino sketch -#define loop _my_sensors_loop - -#include - -// Tidy up injection defines -#undef loop -#undef setup