Skip to content

Commit

Permalink
Pico Wireless: Fixup for GCC 13.x.
Browse files Browse the repository at this point in the history
These changes are giving me "how did this ever work?" vibes.
  • Loading branch information
Gadgetoid committed Oct 2, 2024
1 parent aa34f12 commit 96b17ae
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions micropython/modules/pico_wireless/pico_wireless.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ mp_obj_t picowireless_init() {

mp_obj_t picowireless_get_network_data() {
if(wireless != nullptr) {
uint8_t *ip = nullptr;
uint8_t *mask = nullptr;
uint8_t *gwip = nullptr;
wireless->get_network_data(ip, mask, gwip);
IPAddress ip;
IPAddress mask;
IPAddress gwip;
wireless->get_network_data((uint8_t *)&ip, &mask, &gwip);

mp_obj_t tuple[3];
tuple[0] = mp_obj_new_bytes(ip, WL_IPV4_LENGTH);
tuple[1] = mp_obj_new_bytes(mask, WL_IPV4_LENGTH);
tuple[2] = mp_obj_new_bytes(gwip, WL_IPV4_LENGTH);
tuple[0] = mp_obj_new_bytes((uint8_t *)&ip, WL_IPV4_LENGTH);
tuple[1] = mp_obj_new_bytes((uint8_t *)&mask, WL_IPV4_LENGTH);
tuple[2] = mp_obj_new_bytes((uint8_t *)&gwip, WL_IPV4_LENGTH);
return mp_obj_new_tuple(3, tuple);
}
else
Expand All @@ -86,13 +86,13 @@ mp_obj_t picowireless_get_remote_data(size_t n_args, const mp_obj_t *pos_args, m
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);

uint8_t *ip = nullptr;
uint8_t *port = nullptr;
wireless->get_remote_data(args[ARG_sock].u_int, ip, port);
IPAddress ip;
uint16_t port = 0;
wireless->get_remote_data(args[ARG_sock].u_int, (uint8_t *)&ip, (uint8_t *)&port);

mp_obj_t tuple[2];
tuple[0] = mp_obj_new_bytes(ip, WL_IPV4_LENGTH);
tuple[1] = mp_obj_new_int((uint16_t)port[0] << 8 | (uint16_t)port[1]); //TODO verify size and ordering of port
tuple[0] = mp_obj_new_bytes((uint8_t *)ip, WL_IPV4_LENGTH);
tuple[1] = mp_obj_new_int(port); //TODO verify size and ordering of port
return mp_obj_new_tuple(2, tuple);
}
else
Expand Down

0 comments on commit 96b17ae

Please sign in to comment.