Skip to content

Commit ce499c3

Browse files
committed
Merge branch 'add-schedule' into functional-shouldbe-lib
2 parents 8b9b3ac + 25f5307 commit ce499c3

File tree

13 files changed

+115
-295
lines changed

13 files changed

+115
-295
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@ set(CORE_SRCS
2828
cores/esp32/MD5Builder.cpp
2929
cores/esp32/Print.cpp
3030
cores/esp32/stdlib_noniso.c
31-
cores/esp32/Schedule.cpp
3231
cores/esp32/Stream.cpp
3332
cores/esp32/StreamString.cpp
34-
cores/esp32/Ticker.cpp
3533
cores/esp32/wiring_pulse.c
3634
cores/esp32/wiring_shift.c
3735
cores/esp32/WMath.cpp
@@ -53,6 +51,7 @@ set(LIBRARY_SRCS
5351
libraries/HTTPUpdate/src/HTTPUpdate.cpp
5452
libraries/NetBIOS/src/NetBIOS.cpp
5553
libraries/Preferences/src/Preferences.cpp
54+
libraries/Schedule/src/Schedule.cpp
5655
libraries/SD_MMC/src/SD_MMC.cpp
5756
libraries/SD/src/SD.cpp
5857
libraries/SD/src/sd_diskio.cpp
@@ -193,6 +192,7 @@ set(COMPONENT_ADD_INCLUDEDIRS
193192
libraries/HTTPUpdate/src
194193
libraries/NetBIOS/src
195194
libraries/Preferences/src
195+
libraries/Schedule/src
196196
libraries/SD_MMC/src
197197
libraries/SD/src
198198
libraries/SimpleBLE/src

cores/esp32/Arduino.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ void init(void);
130130
void initVariant(void);
131131
void initArduino(void);
132132

133+
void yield_completed(void);
134+
void loop_completed(void);
135+
133136
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout);
134137
unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout);
135138

@@ -153,7 +156,6 @@ void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
153156
#include "Udp.h"
154157
#include "HardwareSerial.h"
155158
#include "Esp.h"
156-
#include "Schedule.h"
157159

158160
using std::abs;
159161
using std::isinf;

cores/esp32/Ticker.cpp

Lines changed: 0 additions & 86 deletions
This file was deleted.

cores/esp32/Ticker.h

Lines changed: 0 additions & 171 deletions
This file was deleted.

cores/esp32/esp32-hal-misc.c

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
#include "rom/rtc.h"
3535
#include "esp_task_wdt.h"
3636
#include "esp32-hal.h"
37-
#include "Schedule.h"
3837

3938
//Undocumented!!! Get chip temperature in Farenheit
4039
//Source: https://github.com/pcbreflux/espressif/blob/master/esp32/arduino/sketchbook/ESP32_int_temp_sensor/ESP32_int_temp_sensor.ino
@@ -45,12 +44,6 @@ float temperatureRead()
4544
return (temprature_sens_read() - 32) / 1.8;
4645
}
4746

48-
void yield()
49-
{
50-
vPortYield();
51-
run_scheduled_functions(SCHEDULE_FUNCTION_WITHOUT_YIELDELAYCALLS);
52-
}
53-
5447
#if CONFIG_AUTOSTART_ARDUINO
5548

5649
extern TaskHandle_t loopTaskHandle;
@@ -141,9 +134,34 @@ unsigned long IRAM_ATTR millis()
141134
return (unsigned long) (esp_timer_get_time() / 1000ULL);
142135
}
143136

137+
void initVariant() __attribute__((weak));
138+
void initVariant() {}
139+
140+
void init() __attribute__((weak));
141+
void init() {}
142+
143+
void yield_completed() __attribute__((weak));
144+
void yield_completed() {}
145+
146+
bool verifyOta() __attribute__((weak));
147+
bool verifyOta() { return true; }
148+
149+
#ifdef CONFIG_BT_ENABLED
150+
//overwritten in esp32-hal-bt.c
151+
bool btInUse() __attribute__((weak));
152+
bool btInUse() { return false; }
153+
#endif
154+
155+
void yield()
156+
{
157+
vPortYield();
158+
yield_completed();
159+
}
160+
144161
void delay(uint32_t ms)
145162
{
146163
vTaskDelay(ms / portTICK_PERIOD_MS);
164+
yield_completed();
147165
}
148166

149167
void IRAM_ATTR delayMicroseconds(uint32_t us)
@@ -162,21 +180,6 @@ void IRAM_ATTR delayMicroseconds(uint32_t us)
162180
}
163181
}
164182

165-
void initVariant() __attribute__((weak));
166-
void initVariant() {}
167-
168-
void init() __attribute__((weak));
169-
void init() {}
170-
171-
bool verifyOta() __attribute__((weak));
172-
bool verifyOta() { return true; }
173-
174-
#ifdef CONFIG_BT_ENABLED
175-
//overwritten in esp32-hal-bt.c
176-
bool btInUse() __attribute__((weak));
177-
bool btInUse(){ return false; }
178-
#endif
179-
180183
void initArduino()
181184
{
182185
#ifdef CONFIG_APP_ROLLBACK_ENABLE

cores/esp32/main.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ void loopTask(void *pvParameters)
1717
esp_task_wdt_reset();
1818
}
1919
loop();
20-
run_scheduled_functions(SCHEDULE_FUNCTION_FROM_LOOP);
20+
loop_completed();
2121
}
2222
}
2323

@@ -28,4 +28,7 @@ extern "C" void app_main()
2828
xTaskCreateUniversal(loopTask, "loopTask", 8192, NULL, 1, &loopTaskHandle, CONFIG_ARDUINO_RUNNING_CORE);
2929
}
3030

31+
extern "C" void loop_completed() __attribute__((weak));
32+
extern "C" void loop_completed() {}
33+
3134
#endif

0 commit comments

Comments
 (0)