Parcourir la source

* v2.6.0 - fixes for ESP light sleep support

Anatoli Arkhipenko il y a 8 ans
Parent
commit
5438fcc06a
2 fichiers modifiés avec 12 ajouts et 3 suppressions
  1. 11 2
      src/TaskScheduler.h
  2. 1 1
      src/TaskSchedulerDeclarations.h

+ 11 - 2
src/TaskScheduler.h

@@ -128,6 +128,8 @@
 // 
 // v2.6.0:
 //    2018-01-30 - _TASK_TIMEOUT compilation directive: Task overall timeout functionality
+//    2018-01-30 - ESP32 support (experimental)
+//                 (Contributed by Marco Tombesi: https://github.com/baggior)
 
 
 #include <Arduino.h>
@@ -170,13 +172,17 @@
 #include <avr/power.h>
 #endif  // ARDUINO_ARCH_AVR 
 
-#if defined (ARDUINO_ARCH_ESP8266) || defined (ARDUINO_ARCH_ESP32)
+#ifdef ARDUINO_ARCH_ESP8266
 extern "C" {
 #include "user_interface.h"
 }
 #define _TASK_ESP8266_DLY_THRESHOLD 200L
 #endif  // ARDUINO_ARCH_ESP8266
 
+#ifdef ARDUINO_ARCH_ESP32
+    //#warning _TASK_SLEEP_ON_IDLE_RUN is not tested for ESP32.. going in light sleep for 1 ms
+#endif  // ARDUINO_ARCH_ESP8266 ESP32
+
 #endif  // _TASK_SLEEP_ON_IDLE_RUN
 
 
@@ -713,10 +719,13 @@ void Scheduler::setHighPriorityScheduler(Scheduler* aScheduler) {
 void Scheduler::allowSleep(bool aState) { 
     iAllowSleep = aState; 
 
-#if defined (ARDUINO_ARCH_ESP8266) || defined (ARDUINO_ARCH_ESP32)
+#ifdef ARDUINO_ARCH_ESP8266
     wifi_set_sleep_type( iAllowSleep ? LIGHT_SLEEP_T : NONE_SLEEP_T );
 #endif  // ARDUINO_ARCH_ESP8266
 
+#ifdef ARDUINO_ARCH_ESP32
+	// TO-DO; find a suitable replacement for ESP32 if possible.
+#endif  // ARDUINO_ARCH_ESP32
 }
 #endif  // _TASK_SLEEP_ON_IDLE_RUN
 

+ 1 - 1
src/TaskSchedulerDeclarations.h

@@ -18,7 +18,7 @@
 // #define _TASK_LTS_POINTER       // Compile with support for local task storage pointer
 // #define _TASK_PRIORITY          // Support for layered scheduling priority
 // #define _TASK_MICRO_RES         // Support for microsecond resolution
-// #define _TASK_STD_FUNCTION      // Support for std::function (ESP8266 ONLY)
+// #define _TASK_STD_FUNCTION      // Support for std::function (ESP8266 and ESP32 ONLY)
 // #define _TASK_DEBUG             // Make all methods and variables public for debug purposes
 // #define _TASK_INLINE			   // Make all methods "inline" - needed to support some multi-tab, multi-file implementations
 // #define _TASK_TIMEOUT           // Support for overall task timeout