Skip to content

Commit 8b2f061

Browse files
authored
Merge pull request #6666 from tannewt/fix_web_paste
Lots of web workflow, C3 and title bar fixes
2 parents 3612ce2 + 312e298 commit 8b2f061

File tree

23 files changed

+281
-86
lines changed

23 files changed

+281
-86
lines changed

main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
#include "supervisor/shared/stack.h"
5858
#include "supervisor/shared/status_leds.h"
5959
#include "supervisor/shared/tick.h"
60+
#include "supervisor/shared/title_bar.h"
6061
#include "supervisor/shared/traceback.h"
6162
#include "supervisor/shared/translate/translate.h"
6263
#include "supervisor/shared/workflow.h"
@@ -822,7 +823,9 @@ STATIC int run_repl(bool first_run) {
822823
status_led_deinit();
823824
#endif
824825
if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) {
826+
supervisor_title_bar_suspend();
825827
exit_code = pyexec_raw_repl();
828+
supervisor_title_bar_resume();
826829
} else {
827830
exit_code = pyexec_friendly_repl();
828831
}
@@ -914,6 +917,7 @@ int __attribute__((used)) main(void) {
914917
run_boot_py(safe_mode);
915918

916919
supervisor_workflow_start();
920+
supervisor_title_bar_start();
917921

918922
// Boot script is finished, so now go into REPL or run code.py.
919923
int exit_code = PYEXEC_FORCED_EXIT;

ports/espressif/boards/adafruit_qtpy_esp32c3/sdkconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-4MB-no-uf2.csv"
3030
#
3131
# Component config
3232
#
33+
#
34+
35+
#
36+
# PHY
37+
#
38+
CONFIG_ESP_PHY_ENABLE_USB=y
39+
# end of PHY
40+
3341
#
3442
# ESP System Settings
3543
#

ports/espressif/boards/beetle-esp32-c3/sdkconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
# PHY
3+
#
4+
CONFIG_ESP_PHY_ENABLE_USB=y
5+
# end of PHY
6+
17
#
28
# LWIP
39
#

ports/espressif/boards/lolin_c3_mini/sdkconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
# PHY
3+
#
4+
CONFIG_ESP_PHY_ENABLE_USB=y
5+
# end of PHY
6+
17
#
28
# LWIP
39
#

ports/espressif/common-hal/alarm/pin/PinAlarm.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
#include "py/runtime.h"
2929

30-
#include "supervisor/esp_port.h"
30+
#include "supervisor/port.h"
3131
#include "shared-bindings/alarm/pin/PinAlarm.h"
3232
#include "shared-bindings/microcontroller/Pin.h"
3333
#include "shared-bindings/microcontroller/__init__.h"
@@ -90,11 +90,7 @@ STATIC void gpio_interrupt(void *arg) {
9090
gpio_ll_intr_disable(&GPIO, 32 + i);
9191
}
9292
}
93-
BaseType_t high_task_wakeup;
94-
vTaskNotifyGiveFromISR(circuitpython_task, &high_task_wakeup);
95-
if (high_task_wakeup) {
96-
portYIELD_FROM_ISR();
97-
}
93+
port_wake_main_task_from_isr();
9894
}
9995

10096
bool alarm_pin_pinalarm_woke_this_cycle(void) {

ports/espressif/common-hal/alarm/time/TimeAlarm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include "esp_sleep.h"
2828

2929
#include "py/runtime.h"
30-
#include "supervisor/esp_port.h"
30+
#include "supervisor/port.h"
3131

3232
#include "components/esp_timer/include/esp_timer.h"
3333

@@ -66,7 +66,7 @@ STATIC bool woke_up = false;
6666
STATIC void timer_callback(void *arg) {
6767
(void)arg;
6868
woke_up = true;
69-
xTaskNotifyGive(circuitpython_task);
69+
port_wake_main_task();
7070
}
7171

7272
bool alarm_time_timealarm_woke_this_cycle(void) {

ports/espressif/common-hal/alarm/touch/TouchAlarm.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
#include "esp_sleep.h"
3232
#include "peripherals/touch.h"
33-
#include "supervisor/esp_port.h"
33+
#include "supervisor/port.h"
3434

3535
static uint16_t touch_channel_mask;
3636
static volatile bool woke_up = false;
@@ -86,11 +86,7 @@ mp_obj_t alarm_touch_touchalarm_create_wakeup_alarm(void) {
8686
STATIC void touch_interrupt(void *arg) {
8787
(void)arg;
8888
woke_up = true;
89-
BaseType_t task_wakeup;
90-
vTaskNotifyGiveFromISR(circuitpython_task, &task_wakeup);
91-
if (task_wakeup) {
92-
portYIELD_FROM_ISR();
93-
}
89+
port_wake_main_task_from_isr();
9490
}
9591

9692
void alarm_touch_touchalarm_set_alarm(const bool deep_sleep, const size_t n_alarms, const mp_obj_t *alarms) {

ports/espressif/common-hal/wifi/__init__.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ wifi_radio_obj_t common_hal_wifi_radio_obj;
4444
#include "components/log/include/esp_log.h"
4545

4646
#include "supervisor/port.h"
47+
#include "supervisor/shared/title_bar.h"
4748
#include "supervisor/workflow.h"
4849

4950
#include "esp_ipc.h"
@@ -55,7 +56,7 @@ wifi_radio_obj_t common_hal_wifi_radio_obj;
5556
static const char *TAG = "CP wifi";
5657

5758
STATIC void schedule_background_on_cp_core(void *arg) {
58-
supervisor_workflow_request_background();
59+
supervisor_title_bar_request_update(false);
5960

6061
// CircuitPython's VM is run in a separate FreeRTOS task from wifi callbacks. So, we have to
6162
// notify the main task every time in case it's waiting for us.

ports/espressif/esp-idf

ports/espressif/supervisor/port.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#include "supervisor/board.h"
3131
#include "supervisor/port.h"
3232
#include "py/runtime.h"
33-
#include "supervisor/esp_port.h"
3433

3534
#include "freertos/FreeRTOS.h"
3635
#include "freertos/task.h"
@@ -390,6 +389,14 @@ void port_wake_main_task() {
390389
xTaskNotifyGive(circuitpython_task);
391390
}
392391

392+
void port_wake_main_task_from_isr() {
393+
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
394+
vTaskNotifyGiveFromISR(circuitpython_task, &xHigherPriorityTaskWoken);
395+
if (xHigherPriorityTaskWoken == pdTRUE) {
396+
portYIELD_FROM_ISR();
397+
}
398+
}
399+
393400
void sleep_timer_cb(void *arg) {
394401
port_wake_main_task();
395402
}

0 commit comments

Comments
 (0)