Include wifi.radio singleton in gc
This commit is contained in:
parent
a7ec4a0489
commit
169b487509
8
main.c
8
main.c
@ -95,6 +95,10 @@
|
|||||||
#include "common-hal/canio/CAN.h"
|
#include "common-hal/canio/CAN.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if CIRCUITPY_WIFI
|
||||||
|
#include "shared-bindings/wifi/__init__.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if MICROPY_ENABLE_PYSTACK
|
#if MICROPY_ENABLE_PYSTACK
|
||||||
static size_t PLACE_IN_DTCM_BSS(_pystack[CIRCUITPY_PYSTACK_SIZE / sizeof(size_t)]);
|
static size_t PLACE_IN_DTCM_BSS(_pystack[CIRCUITPY_PYSTACK_SIZE / sizeof(size_t)]);
|
||||||
#endif
|
#endif
|
||||||
@ -560,6 +564,10 @@ void gc_collect(void) {
|
|||||||
common_hal_bleio_gc_collect();
|
common_hal_bleio_gc_collect();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if CIRCUITPY_WIFI
|
||||||
|
common_hal_wifi_gc_collect();
|
||||||
|
#endif
|
||||||
|
|
||||||
// This naively collects all object references from an approximate stack
|
// This naively collects all object references from an approximate stack
|
||||||
// range.
|
// range.
|
||||||
gc_collect_root((void**)sp, ((uint32_t)port_stack_get_top() - sp) / sizeof(uint32_t));
|
gc_collect_root((void**)sp, ((uint32_t)port_stack_get_top() - sp) / sizeof(uint32_t));
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include "common-hal/wifi/__init__.h"
|
#include "common-hal/wifi/__init__.h"
|
||||||
#include "lib/utils/interrupt_char.h"
|
#include "lib/utils/interrupt_char.h"
|
||||||
|
#include "py/gc.h"
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "shared-bindings/ipaddress/IPv4Address.h"
|
#include "shared-bindings/ipaddress/IPv4Address.h"
|
||||||
#include "shared-bindings/wifi/ScannedNetworks.h"
|
#include "shared-bindings/wifi/ScannedNetworks.h"
|
||||||
@ -262,3 +263,8 @@ mp_int_t common_hal_wifi_radio_ping(wifi_radio_obj_t *self, mp_obj_t ip_address,
|
|||||||
|
|
||||||
return elapsed_time;
|
return elapsed_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void common_hal_wifi_radio_gc_collect(wifi_radio_obj_t *self) {
|
||||||
|
// Only bother to scan the actual object references.
|
||||||
|
gc_collect_ptr(self->current_scan);
|
||||||
|
}
|
||||||
|
@ -59,4 +59,6 @@ typedef struct {
|
|||||||
uint8_t last_disconnect_reason;
|
uint8_t last_disconnect_reason;
|
||||||
} wifi_radio_obj_t;
|
} wifi_radio_obj_t;
|
||||||
|
|
||||||
|
extern void common_hal_wifi_radio_gc_collect(wifi_radio_obj_t *self);
|
||||||
|
|
||||||
#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_WIFI_RADIO_H
|
#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_WIFI_RADIO_H
|
||||||
|
@ -160,3 +160,7 @@ void ipaddress_ipaddress_to_esp_idf(mp_obj_t ip_address, ip_addr_t* esp_ip_addre
|
|||||||
|
|
||||||
IP_ADDR4(esp_ip_address, bytes[0], bytes[1], bytes[2], bytes[3]);
|
IP_ADDR4(esp_ip_address, bytes[0], bytes[1], bytes[2], bytes[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void common_hal_wifi_gc_collect(void) {
|
||||||
|
common_hal_wifi_radio_gc_collect(&common_hal_wifi_radio_obj);
|
||||||
|
}
|
||||||
|
@ -34,5 +34,6 @@
|
|||||||
extern wifi_radio_obj_t common_hal_wifi_radio_obj;
|
extern wifi_radio_obj_t common_hal_wifi_radio_obj;
|
||||||
|
|
||||||
void common_hal_wifi_init(void);
|
void common_hal_wifi_init(void);
|
||||||
|
void common_hal_wifi_gc_collect(void);
|
||||||
|
|
||||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_WIFI___INIT___H
|
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_WIFI___INIT___H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user