Merge branch 'main' into cp_webserver
This commit is contained in:
commit
3be3e89d82
|
@ -145,8 +145,8 @@
|
|||
url = https://github.com/adafruit/Adafruit_CircuitPython_RFM69.git
|
||||
[submodule "ports/espressif/esp-idf"]
|
||||
path = ports/espressif/esp-idf
|
||||
url = https://github.com/espressif/esp-idf.git
|
||||
branch = release/v4.4
|
||||
url = https://github.com/adafruit/esp-idf.git
|
||||
branch = circuitpython8
|
||||
[submodule "ports/espressif/certificates/nina-fw"]
|
||||
path = ports/espressif/certificates/nina-fw
|
||||
url = https://github.com/adafruit/nina-fw.git
|
||||
|
|
|
@ -65,6 +65,7 @@ volatile uint32_t nesting_count = 0;
|
|||
static portMUX_TYPE cp_mutex = portMUX_INITIALIZER_UNLOCKED;
|
||||
|
||||
void common_hal_mcu_disable_interrupts(void) {
|
||||
assert(xPortGetCoreID() == CONFIG_ESP_MAIN_TASK_AFFINITY);
|
||||
if (nesting_count == 0) {
|
||||
portENTER_CRITICAL(&cp_mutex);
|
||||
}
|
||||
|
@ -72,9 +73,8 @@ void common_hal_mcu_disable_interrupts(void) {
|
|||
}
|
||||
|
||||
void common_hal_mcu_enable_interrupts(void) {
|
||||
if (nesting_count == 0) {
|
||||
// Maybe log here because it's very bad.
|
||||
}
|
||||
assert(xPortGetCoreID() == CONFIG_ESP_MAIN_TASK_AFFINITY);
|
||||
assert(nesting_count > 0);
|
||||
nesting_count--;
|
||||
if (nesting_count > 0) {
|
||||
return;
|
||||
|
|
|
@ -42,12 +42,25 @@ wifi_radio_obj_t common_hal_wifi_radio_obj;
|
|||
|
||||
#include "components/log/include/esp_log.h"
|
||||
|
||||
#include "supervisor/port.h"
|
||||
#include "supervisor/workflow.h"
|
||||
|
||||
#include "esp_ipc.h"
|
||||
|
||||
static const char *TAG = "CP wifi";
|
||||
|
||||
STATIC void schedule_background_on_cp_core(void *arg) {
|
||||
supervisor_workflow_request_background();
|
||||
|
||||
// CircuitPython's VM is run in a separate FreeRTOS task from wifi callbacks. So, we have to
|
||||
// notify the main task every time in case it's waiting for us.
|
||||
port_wake_main_task();
|
||||
}
|
||||
|
||||
static void event_handler(void *arg, esp_event_base_t event_base,
|
||||
int32_t event_id, void *event_data) {
|
||||
// This runs on the PRO CORE! It cannot share CP interrupt enable/disable
|
||||
// directly.
|
||||
wifi_radio_obj_t *radio = arg;
|
||||
if (event_base == WIFI_EVENT) {
|
||||
switch (event_id) {
|
||||
|
@ -108,7 +121,14 @@ static void event_handler(void *arg, esp_event_base_t event_base,
|
|||
radio->retries_left = radio->starting_retries;
|
||||
xEventGroupSetBits(radio->event_group_handle, WIFI_CONNECTED_BIT);
|
||||
}
|
||||
supervisor_workflow_request_background();
|
||||
// Use IPC to ensure we run schedule background on the same core as CircuitPython.
|
||||
#if defined(CONFIG_FREERTOS_UNICORE) && CONFIG_FREERTOS_UNICORE
|
||||
schedule_background_on_cp_core(NULL);
|
||||
#else
|
||||
// This only blocks until the start of the function. That's ok since the PRO
|
||||
// core shouldn't care what we do.
|
||||
esp_ipc_call(CONFIG_ESP_MAIN_TASK_AFFINITY, schedule_background_on_cp_core, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool wifi_inited;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 944c01eef4fbba693f991f9d033cda3f59ca82c9
|
||||
Subproject commit 171e5af9c5b9b126c5f81f217c7b1ff931d54863
|
Loading…
Reference in New Issue