Merge pull request #7192 from bill88t/picow-debug
Fix pi cow debug compilation
This commit is contained in:
commit
ef93eda0a0
@ -46,15 +46,12 @@
|
|||||||
#include "components/mdns/include/mdns.h"
|
#include "components/mdns/include/mdns.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "lwip/sys.h"
|
||||||
#include "lwip/dns.h"
|
#include "lwip/dns.h"
|
||||||
#include "lwip/icmp.h"
|
#include "lwip/icmp.h"
|
||||||
#include "lwip/raw.h"
|
#include "lwip/raw.h"
|
||||||
#include "lwip_src/ping.h"
|
#include "lwip_src/ping.h"
|
||||||
|
|
||||||
#ifndef PING_ID
|
|
||||||
#define PING_ID 0xAFAF
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define MAC_ADDRESS_LENGTH 6
|
#define MAC_ADDRESS_LENGTH 6
|
||||||
|
|
||||||
#define NETIF_STA (&cyw43_state.netif[CYW43_ITF_STA])
|
#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
|
|||||||
}
|
}
|
||||||
|
|
||||||
volatile bool ping_received;
|
volatile bool ping_received;
|
||||||
|
uint32_t ping_time;
|
||||||
|
|
||||||
static u8_t
|
static u8_t
|
||||||
ping_recv(void *arg, struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *addr) {
|
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)
|
|||||||
|
|
||||||
if ((p->tot_len >= (PBUF_IP_HLEN + sizeof(struct icmp_echo_hdr))) &&
|
if ((p->tot_len >= (PBUF_IP_HLEN + sizeof(struct icmp_echo_hdr))) &&
|
||||||
pbuf_remove_header(p, PBUF_IP_HLEN) == 0) {
|
pbuf_remove_header(p, PBUF_IP_HLEN) == 0) {
|
||||||
|
|
||||||
iecho = (struct icmp_echo_hdr *)p->payload;
|
iecho = (struct icmp_echo_hdr *)p->payload;
|
||||||
|
|
||||||
if ((iecho->id == PING_ID) && (iecho->seqno == lwip_htons(ping_seq_num))) {
|
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)
|
|||||||
}
|
}
|
||||||
|
|
||||||
mp_int_t common_hal_wifi_radio_ping(wifi_radio_obj_t *self, mp_obj_t ip_address, mp_float_t timeout) {
|
mp_int_t common_hal_wifi_radio_ping(wifi_radio_obj_t *self, mp_obj_t ip_address, mp_float_t timeout) {
|
||||||
|
ping_time = sys_now();
|
||||||
ip_addr_t ping_addr;
|
ip_addr_t ping_addr;
|
||||||
ipaddress_ipaddress_to_lwip(ip_address, &ping_addr);
|
ipaddress_ipaddress_to_lwip(ip_address, &ping_addr);
|
||||||
|
|
||||||
|
@ -12,6 +12,14 @@
|
|||||||
#define PING_USE_SOCKETS LWIP_SOCKET
|
#define PING_USE_SOCKETS LWIP_SOCKET
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef PING_ID
|
||||||
|
#define PING_ID 0xAFAF
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PING_DEBUG
|
||||||
|
#define PING_DEBUG LWIP_DBG_ON
|
||||||
|
#endif
|
||||||
|
|
||||||
void ping_init(const ip_addr_t *ping_addr);
|
void ping_init(const ip_addr_t *ping_addr);
|
||||||
void ping_prepare_echo(struct icmp_echo_hdr *iecho, u16_t len);
|
void ping_prepare_echo(struct icmp_echo_hdr *iecho, u16_t len);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user