Fix ESP related issues

This commit is contained in:
Scott Shawcroft 2023-10-11 14:11:29 -07:00
parent 9633c4e78f
commit 1f38293096
No known key found for this signature in database
GPG Key ID: 0DFD512649C052DA
4 changed files with 9 additions and 11 deletions

View File

@ -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);

View File

@ -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) {

View File

@ -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));
}

View File

@ -1,4 +1,4 @@
1/*
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)