Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esp-ping should use debug macros instead of os_printf #67

Merged
merged 1 commit into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion glue-lwip/arduino/lwipopts.h
Original file line number Diff line number Diff line change
Expand Up @@ -3561,9 +3561,13 @@
#define PPPOS_SUPPORT IP_NAPT // because we don't have proxyarp yet
#define PPP_SUPPORT PPPOS_SUPPORT
#define PPP_SERVER 1
#define PPP_DEBUG ULWIPDEBUG
#define PRINTPKT_SUPPORT ULWIPDEBUG

#if ULWIPDEBUG
#define PPP_DEBUG LWIP_DBG_ON
#define PING_DEBUG LWIP_DBG_ON
#endif

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
10 changes: 5 additions & 5 deletions glue-lwip/esp-ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static void ICACHE_FLASH_ATTR ping_timeout(void* arg)
struct ping_msg *pingmsg = (struct ping_msg *)arg;
pingmsg->timeout_count ++;
if (pingmsg->ping_opt->recv_function == NULL){
os_printf("ping timeout\n");
LWIP_DEBUGF( PING_DEBUG, ("ping timeout\n"));
} else {
struct ping_resp pingresp;
os_bzero(&pingresp, sizeof(struct ping_resp));
Expand Down Expand Up @@ -161,7 +161,7 @@ ping_recv(void *arg, struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *addr)
ip_addr_copy_from_ip4(source_ip, iphdr->src);
ipaddr_ntoa_r(&source_ip,ipaddrstr, sizeof(ipaddrstr));
if (pingmsg->ping_opt->recv_function == NULL){
os_printf("recv %s: byte = %d, time = %d ms, seq = %d\n",ipaddrstr, PING_DATA_SIZE, delay, ntohs(iecho->seqno));
LWIP_DEBUGF( PING_DEBUG, ("recv %s: byte = %d, time = %d ms, seq = %d\n", ipaddrstr, PING_DATA_SIZE, delay, ntohs(iecho->seqno)));
} else {
struct ping_resp pingresp;
os_bzero(&pingresp, sizeof(struct ping_resp));
Expand All @@ -181,7 +181,7 @@ ping_recv(void *arg, struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *addr)
}
// } else if(iecho->type == ICMP_ECHO){
// struct pbuf *q = NULL;
// os_printf("receive ping request:seq=%d\n", ntohs(iecho->seqno));
// LWIP_DEBUGF( PING_DEBUG, ("receive ping request:seq=%d\n", ntohs(iecho->seqno)));
// q = pbuf_alloc(PBUF_IP, (u16_t)p->tot_len, PBUF_RAM);
// if (q!=NULL) {
// pbuf_copy(q, p);
Expand Down Expand Up @@ -249,8 +249,8 @@ ping_coarse_tmr(void *arg)
delay /= PING_COARSE;
// ping_seq_num = 0;
if (ping_opt->sent_function == NULL){
os_printf("ping %d, timeout %d, total payload %d bytes, %d ms\n",
pingmsg->max_count, pingmsg->timeout_count, PING_DATA_SIZE*(pingmsg->max_count - pingmsg->timeout_count),delay);
LWIP_DEBUGF( PING_DEBUG, ("ping %d, timeout %d, total payload %d bytes, %d ms\n",
pingmsg->max_count, pingmsg->timeout_count, PING_DATA_SIZE*(pingmsg->max_count - pingmsg->timeout_count),delay));
} else {
os_bzero(&pingresp, sizeof(struct ping_resp));
pingresp.total_count = pingmsg->max_count;
Expand Down