From 1f382930962828054a2155da24c9d123249feac0 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 11 Oct 2023 14:11:29 -0700 Subject: [PATCH] Fix ESP related issues --- ports/espressif/bindings/espidf/__init__.c | 4 +++- ports/espressif/bindings/espnow/Peers.c | 12 ++++-------- shared-bindings/socketpool/SocketPool.c | 2 +- shared-bindings/wifi/Monitor.c | 2 +- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/ports/espressif/bindings/espidf/__init__.c b/ports/espressif/bindings/espidf/__init__.c index 092d29c0fd..9f554f4512 100644 --- a/ports/espressif/bindings/espidf/__init__.c +++ b/ports/espressif/bindings/espidf/__init__.c @@ -131,7 +131,7 @@ MP_DEFINE_CONST_OBJ_TYPE( make_new, mp_obj_exception_make_new, attr, mp_obj_exception_attr, parent, &mp_type_MemoryError -}; + ); //| def get_total_psram() -> int: //| """Returns the number of bytes of psram detected, or 0 if psram is not present or not configured""" @@ -170,3 +170,5 @@ const mp_obj_module_t espidf_module = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t *)&espidf_module_globals, }; + +MP_REGISTER_MODULE(MP_QSTR_espidf, espidf_module); diff --git a/ports/espressif/bindings/espnow/Peers.c b/ports/espressif/bindings/espnow/Peers.c index debc8948aa..0606d3a94f 100644 --- a/ports/espressif/bindings/espnow/Peers.c +++ b/ports/espressif/bindings/espnow/Peers.c @@ -83,8 +83,7 @@ STATIC MP_DEFINE_CONST_DICT(espnow_peers_locals_dict, espnow_peers_locals_dict_t STATIC void espnow_peers_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { espnow_peers_obj_t *self = MP_OBJ_TO_PTR(self_in); - mp_obj_list_t *list = MP_OBJ_TO_PTR(self->list); - return list->base.type->print(print, self->list, kind); + return MP_OBJ_TYPE_GET_SLOT(mp_obj_get_type(self->list), print)(print, self->list, kind); } /******************************************************************************/ @@ -92,8 +91,7 @@ STATIC void espnow_peers_print(const mp_print_t *print, mp_obj_t self_in, mp_pri STATIC mp_obj_t espnow_peers_unary_op(mp_unary_op_t op, mp_obj_t self_in) { espnow_peers_obj_t *self = MP_OBJ_TO_PTR(self_in); - mp_obj_list_t *list = MP_OBJ_TO_PTR(self->list); - return list->base.type->ext->unary_op(op, self->list); + return MP_OBJ_TYPE_GET_SLOT(mp_obj_get_type(self->list), unary_op)(op, self->list); } /******************************************************************************/ @@ -104,8 +102,7 @@ STATIC mp_obj_t espnow_peers_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t v return MP_OBJ_NULL; // op not supported } espnow_peers_obj_t *self = MP_OBJ_TO_PTR(self_in); - mp_obj_list_t *list = MP_OBJ_TO_PTR(self->list); - return list->base.type->ext->subscr(self->list, index, value); + return MP_OBJ_TYPE_GET_SLOT(mp_obj_get_type(self->list), subscr)(self->list, index, value); } /******************************************************************************/ @@ -113,8 +110,7 @@ STATIC mp_obj_t espnow_peers_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t v STATIC mp_obj_t espnow_peers_getiter(mp_obj_t self_in, mp_obj_iter_buf_t *iter_buf) { espnow_peers_obj_t *self = MP_OBJ_TO_PTR(self_in); - mp_obj_list_t *list = MP_OBJ_TO_PTR(self->list); - return list->base.type->ext->getiter(self->list, iter_buf); + return ((mp_getiter_fun_t)MP_OBJ_TYPE_GET_SLOT(mp_obj_get_type(self->list), iter))(self->list, iter_buf); } espnow_peers_obj_t *espnow_peers_new(void) { diff --git a/shared-bindings/socketpool/SocketPool.c b/shared-bindings/socketpool/SocketPool.c index e62c0f3395..3db72a86c1 100644 --- a/shared-bindings/socketpool/SocketPool.c +++ b/shared-bindings/socketpool/SocketPool.c @@ -220,7 +220,7 @@ void common_hal_socketpool_socketpool_raise_gaierror_noname(void) { mp_obj_t exc_args[] = { MP_OBJ_NEW_SMALL_INT(SOCKETPOOL_EAI_NONAME), - mp_obj_new_str_from_vstr(&mp_type_str, &vstr), + mp_obj_new_str_from_vstr(&vstr), }; nlr_raise(mp_obj_new_exception_args(&mp_type_gaierror, MP_ARRAY_SIZE(exc_args), exc_args)); } diff --git a/shared-bindings/wifi/Monitor.c b/shared-bindings/wifi/Monitor.c index 95c8ffe2cb..bde6caa59f 100644 --- a/shared-bindings/wifi/Monitor.c +++ b/shared-bindings/wifi/Monitor.c @@ -1,4 +1,4 @@ -1/* +/* * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT)