MicroPython: Switch from MICROPY_EVENT_POLL_HOOK to mp_event_handle_nowait().

Note: Unsure if mp_event_handle_nowait() is the right answer in all cases,
but this seems to be what we want in our blocking loops.
pull/892/head
Phil Howard 2024-01-08 10:33:26 +00:00
rodzic 1b3d9d9fb2
commit d45daef654
5 zmienionych plików z 23 dodań i 23 usunięć

Wyświetl plik

@ -122,8 +122,8 @@ mp_obj_t Badger2040_update(mp_obj_t self_in) {
_Badger2040_obj_t *self = MP_OBJ_TO_PTR2(self_in, _Badger2040_obj_t);
while(self->badger2040->is_busy()) {
#ifdef MICROPY_EVENT_POLL_HOOK
MICROPY_EVENT_POLL_HOOK
#ifdef mp_event_handle_nowait
mp_event_handle_nowait();
#endif
}
@ -133,8 +133,8 @@ MICROPY_EVENT_POLL_HOOK
// Ensure blocking for the minimum amount of time
// in cases where "is_busy" is unreliable.
while(self->badger2040->is_busy() || absolute_time_diff_us(get_absolute_time(), t_end) > 0) {
#ifdef MICROPY_EVENT_POLL_HOOK
MICROPY_EVENT_POLL_HOOK
#ifdef mp_event_handle_nowait
mp_event_handle_nowait();
#endif
}
@ -166,8 +166,8 @@ mp_obj_t Badger2040_partial_update(size_t n_args, const mp_obj_t *pos_args, mp_m
while(self->badger2040->is_busy()) {
#ifdef MICROPY_EVENT_POLL_HOOK
MICROPY_EVENT_POLL_HOOK
#ifdef mp_event_handle_nowait
mp_event_handle_nowait();
#endif
}
@ -177,8 +177,8 @@ MICROPY_EVENT_POLL_HOOK
// Ensure blocking for the minimum amount of time
// in cases where "is_busy" is unreliable.
while(self->badger2040->is_busy() || absolute_time_diff_us(get_absolute_time(), t_end) > 0) {
#ifdef MICROPY_EVENT_POLL_HOOK
MICROPY_EVENT_POLL_HOOK
#ifdef mp_event_handle_nowait
mp_event_handle_nowait();
#endif
}
@ -199,8 +199,8 @@ mp_obj_t Badger2040_halt(mp_obj_t self_in) {
self->badger2040->update_button_states();
while (self->badger2040->button_states() == 0) {
#ifdef MICROPY_EVENT_POLL_HOOK
MICROPY_EVENT_POLL_HOOK
#ifdef mp_event_handle_nowait
mp_event_handle_nowait();
#endif
self->badger2040->update_button_states();
}

Wyświetl plik

@ -84,8 +84,8 @@ int32_t jpegdec_seek_callback(JPEGFILE *jpeg, int32_t p) {
}
int JPEGDraw(JPEGDRAW *pDraw) {
#ifdef MICROPY_EVENT_POLL_HOOK
MICROPY_EVENT_POLL_HOOK
#ifdef mp_event_handle_nowait
mp_event_handle_nowait();
#endif
PicoGraphics *current_graphics = (PicoGraphics *)pDraw->pUser;
// "pixel" is slow and clipped,

Wyświetl plik

@ -110,7 +110,7 @@ mp_obj_t picoscroll_scroll_text(mp_uint_t n_args, const mp_obj_t *args) {
self->scroll->clear();
self->scroll->set_bitmap_1d((const char *)draw_buffer, draw_buffer_len, brightness, offset);
self->scroll->update();
MICROPY_EVENT_POLL_HOOK
mp_event_handle_nowait();
sleep_ms(delay_ms);
}

Wyświetl plik

@ -623,16 +623,16 @@ mp_obj_t ModPicoGraphics_update(mp_obj_t self_in) {
*/
while(self->display->is_busy()) {
#ifdef MICROPY_EVENT_POLL_HOOK
MICROPY_EVENT_POLL_HOOK
#ifdef mp_event_handle_nowait
mp_event_handle_nowait();
#endif
}
self->display->update(self->graphics);
while(self->display->is_busy()) {
#ifdef MICROPY_EVENT_POLL_HOOK
MICROPY_EVENT_POLL_HOOK
#ifdef mp_event_handle_nowait
mp_event_handle_nowait();
#endif
}
@ -647,8 +647,8 @@ mp_obj_t ModPicoGraphics_partial_update(size_t n_args, const mp_obj_t *args) {
ModPicoGraphics_obj_t *self = MP_OBJ_TO_PTR2(args[ARG_self], ModPicoGraphics_obj_t);
while(self->display->is_busy()) {
#ifdef MICROPY_EVENT_POLL_HOOK
MICROPY_EVENT_POLL_HOOK
#ifdef mp_event_handle_nowait
mp_event_handle_nowait();
#endif
}
@ -660,8 +660,8 @@ mp_obj_t ModPicoGraphics_partial_update(size_t n_args, const mp_obj_t *args) {
});
while(self->display->is_busy()) {
#ifdef MICROPY_EVENT_POLL_HOOK
MICROPY_EVENT_POLL_HOOK
#ifdef mp_event_handle_nowait
mp_event_handle_nowait();
#endif
}

Wyświetl plik

@ -118,8 +118,8 @@ void pngdec_open_helper(_PNG_obj_t *self) {
}
void PNGDraw(PNGDRAW *pDraw) {
#ifdef MICROPY_EVENT_POLL_HOOK
MICROPY_EVENT_POLL_HOOK
#ifdef mp_event_handle_nowait
mp_event_handle_nowait();
#endif
_PNG_decode_target *target = (_PNG_decode_target*)pDraw->pUser;
PicoGraphics *current_graphics = (PicoGraphics *)target->target;