8000 Merge pull request #7192 from bill88t/picow-debug · kdb424/circuitpython@ef93eda · GitHub
[go: up one dir, main page]

Skip to content

Commit ef93eda

Browse files
authored
Merge pull request adafruit#7192 from bill88t/picow-debug
Fix pi cow debug compilation
2 parents b8a2d3f + 6954e56 commit ef93eda

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

ports/raspberrypi/common-hal/wifi/Radio.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,12 @@
4646
#include "components/mdns/include/mdns.h"
4747
#endif
4848

49+
#include "lwip/sys.h"
4950
#include "lwip/dns.h"
5051
#include "lwip/icmp.h"
5152
#include "lwip/raw.h"
5253
#include "lwip_src/ping.h"
5354

54-
#ifndef PING_ID
55-
#define PING_ID 0xAFAF
56-
#endif
57-
5855
#define MAC_ADDRESS_LENGTH 6
5956

6057
#define NETIF_STA (&cyw43_state.netif[CYW43_ITF_STA])
@@ -295,6 +292,7 @@ void common_hal_wifi_radio_set_ipv4_address(wifi_radio_obj_t *self, mp_obj_t ipv
295292
}
296293

297294
volatile bool ping_received;
295+
uint32_t ping_time;
298296

299297
static u8_t
300298
ping_recv(void *arg, struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *addr) {
@@ -303,6 +301,7 @@ ping_recv(void *arg, struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *addr)
303301

304302
if ((p->tot_len >= (PBUF_IP_HLEN + sizeof(struct icmp_echo_hdr))) &&
305303
pbuf_remove_header(p, PBUF_IP_HLEN) == 0) {
304+
306305
iecho = (struct icmp_echo_hdr *)p->payload;
307306

308307
if ((iecho->id == PING_ID) && (iecho->seqno == lwip_htons(ping_seq_num))) {
@@ -322,6 +321,7 @@ ping_recv(void *arg, struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *addr)
322321
}
323322

324323
mp_int_t common_hal_wifi_radio_ping(wifi_radio_obj_t *self, mp_obj_t ip_address, mp_float_t timeout) {
324+
ping_time = sys_now();
325325
ip_addr_t ping_addr;
326326
ipaddress_ipaddress_to_lwip(ip_address, &ping_addr);
327327

ports/raspberrypi/lwip_src/ping.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@
1212
#define PING_USE_SOCKETS LWIP_SOCKET
1313
#endif
1414

15+
#ifndef PING_ID
16+
#define PING_ID 0xAFAF
17+
#endif
18+
19+
#ifndef PING_DEBUG
20+
#define PING_DEBUG LWIP_DBG_ON
21+
#endif
22+
1523
void ping_init(const ip_addr_t *ping_addr);
1624
void ping_prepare_echo(struct icmp_echo_hdr *iecho, u16_t len);
1725

0 commit comments

Comments
 (0)
0