Can't turn off ESP8266 dancole90 ping library debug messages

Unfortunately the original topic from user [Resistive132] is closed without any given solution.

Because I'm struggling about the same issue, maybe someone has found a solution in the meantime but has not posted it, because of topic closing.
Therefore I want to readdress the same issue.

Thanks for any hint.

Maybe set a boolean flag, and ignore or queue those driver messages until your program has finished its output.

Or use a different serial port??

They are debug / diagnostic nessafes, so they are important.

@Resistive132 did provide a solution; it might not be the solution that you want.

Well ehm .. i don't !

Connecting to WiFi
....................................
WiFi connected with ip 192.168.0.115
Pinging host www.google.com
Success!!

Maybe it's because i am running an older core version at the moment (3.0.2) but this is my output from HostPing.ino

I am willing to see if it is core related, but maybe you could try and have a look at that as well.

Otherwise just post a full example that illustrates your problem.

Well, I use platformio in the Visual Studio Code environment.

This is the simple code in main.cpp:

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESPping.h>

#define WIFI_SSID "***"
#define WIFI_PASSWORD "***"

#define REMOTE_IP "www.google.com"

void setup() {
    Serial.begin(115200);

    WiFi.mode(WIFI_STA);
    WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
    while (WiFi.status() != WL_CONNECTED) { 
        Serial.print(".");
        delay(200);
    }

    Serial.println("");
    Serial.println("Successfully connected!");
    Serial.println("");

}

void loop() {
    if (Ping.ping(REMOTE_IP,2) > 0){
        Serial.println("Ping success");
    } else {
        Serial.println("Ping Error");
    }
    delay(2000);
}

And this is the output at serial port:

................
Successfully connected!

Ping success
ping 2, timeout 0, total payload 64 bytes, 2034 ms
Ping success
ping 2, timeout 0, total payload 64 bytes, 2018 ms
Ping success

The configuration of platformio.ini is the following:

[platformio]
default_envs = d1_mini


[common_env_data]
lib_deps =   
             dvarrel/ESPping                        

upload_protocol = esptool
upload_port = COM5
upload_speed = 921600
monitor_port = COM5
monitor_speed = 115200
build_flags = 
  -Wall -Wextra
lib_compat_mode = strict

[common_dev_data]
build_flags = 
  -Wall -Wextra
  -D CONFIG_ARDUHAL_LOG_COLORS=1
  -D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
  -D ELEGANTOTA_USE_ASYNC_WEBSERVER=1

[env:d1_mini]
build_flags = ${common_env_data.build_flags} ${common_dev_data.build_flags}
board = d1_mini
platform = espressif8266
framework = arduino
lib_deps = ${common_env_data.lib_deps}
upload_protocol = ${common_env_data.upload_protocol}
upload_port = ${common_env_data.upload_port}
upload_speed = ${common_env_data.upload_speed}
monitor_port = ${common_env_data.monitor_port}
monitor_speed = ${common_env_data.monitor_speed}

As additional information, I found three esp-ping.c files on my PC at tis locations:

C:\Users\Be42\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\tools\sdk\lwip2\builder\glue-lwip\esp-ping.c

C:\Users\Be42.platformio\packages\framework-arduinoespressif8266\tools\sdk\lwip2\builder\glue-lwip\esp-ping.c

C:\Users\Be42.platformio\packages\framework-arduinoespressif8266@3.20704.0\tools\sdk\lwip2\builder\glue-lwip\esp-ping.c

Within these files there is an entry which seems to be responsible for the output, which should be compressed:

		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);

		} else {
			os_bzero(&pingresp, sizeof(struct ping_resp));
			pingresp.total_count = pingmsg->max_count;
			pingresp.timeout_count = pingmsg->timeout_count;
			pingresp.total_bytes = PING_DATA_SIZE*(pingmsg->max_count - pingmsg->timeout_count);
			pingresp.total_time = delay;
			pingresp.ping_err = 0;
		}

But unfortunately, if I do some changes within these esp-ping.c files, the output is still there.

And further more, I tried also the library form dancol90 with "ESP8266ping.h".
But the output is still the same.

platformio.ini with library from dancol90:

[platformio]
default_envs = d1_mini


[common_env_data]
lib_deps =   
             ;dvarrel/ESPping                        
             dancol90/ESP8266Ping

upload_protocol = esptool
upload_port = COM5
upload_speed = 921600
monitor_port = COM5
monitor_speed = 115200
build_flags = 
  -Wall -Wextra
lib_compat_mode = strict

[common_dev_data]
build_flags = 
  -Wall -Wextra
  -D CONFIG_ARDUHAL_LOG_COLORS=1
  -D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
  -D ELEGANTOTA_USE_ASYNC_WEBSERVER=1

[env:d1_mini]
build_flags = ${common_env_data.build_flags} ${common_dev_data.build_flags}
board = d1_mini
platform = espressif8266
framework = arduino
lib_deps = ${common_env_data.lib_deps}
upload_protocol = ${common_env_data.upload_protocol}
upload_port = ${common_env_data.upload_port}
upload_speed = ${common_env_data.upload_speed}
monitor_port = ${common_env_data.monitor_port}
monitor_speed = ${common_env_data.monitor_speed}

Sourcecode of main.cpp:

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266ping.h>

#define WIFI_SSID "***"
#define WIFI_PASSWORD "***"

#define REMOTE_IP "www.google.com"

void setup() {
    Serial.begin(115200);

    WiFi.mode(WIFI_STA);
    WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
    while (WiFi.status() != WL_CONNECTED) { 
        Serial.print(".");
        delay(200);
    }

    Serial.println("");
    Serial.println("Successfully connected!");
    Serial.println("");

}

void loop() {
    if (Ping.ping(REMOTE_IP) > 0){
        Serial.println("Ping success");
    } else {
        Serial.println("Ping Error");
    }
    delay(2000);
}

Output at serial port:

................
Successfully connected!

Ping success
ping 5, timeout 0, total payload 160 bytes, 5037 ms
Ping success
ping 5, timeout 0, total payload 160 bytes, 5110 ms
Ping success
ping 5, timeout 0, total payload 160 bytes, 5081 ms

pretty sure that this is the cause.

probably should be ARDUHAL_LOG_LEVEL_NONE or something like that

Hi Deva_Rishi,
good point, but unfortunately not the case.

I tried ARDUHAL_LOG_LEVEL_NONE or even no build flags at all, but the ping message is still there.

There is an option that selects the debug port, with the options being 'Disabled', 'Serial' & 'Serial1'

Needles to say i have selected 'Disabled'

For the rest i can not help you much further. The compile from the Arduino IDE does not replicate your problem.

I actually suggest you compile the sketch and upload it from the Arduino IDE yourself, to confirm that the code itself is not the issue

I would say the first is used by the Arduino builder, the other 2 by platformio, but hard tell what is the difference between them. maybe a core version or something.

You could compare the files and see if there is any difference between the 3 of them.

It is possible that the files are cached of course, but as i said it seems not the code is the cause but the build.

Your are right, it's a problem of the build within platformio.

Somehow the code of esp-ping.c is compiled and cached, therefore any changes within these files will not make any difference.

But I found a workaround now.

  1. I copied the esp-ping.c file from location ".platformio\packages\framework-arduinoespressif8266\tools\sdk\lwip2\builder\glue-lwip" into my project path in parallel to my main.cpp.
    A compiling error will occur because the include file in esp-ping.c #include "lwip/apps-esp/ping.h" cannot be found.

  2. So I copied the directory ".platformio\packages\framework-arduinoespressif8266@3.20704.0\tools\sdk\lwip2\builder\glue-lwip\lwip\apps-esp which contains the right ping.h file to the folder ".platformio\packages\framework-arduinoespressif8266\tools\sdk\lwip2\include\lwip".
    Compile error solved!

  3. Now the esp-ping.c file in my project will be used for the build and I can modify the line

     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);
     			
     } else {
     	os_bzero(&pingresp, sizeof(struct ping_resp));
     	pingresp.total_count = pingmsg->max_count;
     	pingresp.timeout_count = pingmsg->timeout_count;
     	pingresp.total_bytes = PING_DATA_SIZE*(pingmsg->max_count - pingmsg->timeout_count);
     	pingresp.total_time = delay;
     	pingresp.ping_err = 0;
     }
    

to

		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);

					
		} else {
			os_bzero(&pingresp, sizeof(struct ping_resp));
			pingresp.total_count = pingmsg->max_count;
			pingresp.timeout_count = pingmsg->timeout_count;
			pingresp.total_bytes = PING_DATA_SIZE*(pingmsg->max_count - pingmsg->timeout_count);
			pingresp.total_time = delay;
			pingresp.ping_err = 0;
		}

Result as expected. Unwanted message gone.

2 Likes

Great that has been resolved.

Ah i was wondering,... isn't there a way of forcing a re-compile of these cached files ?

Maybe, but unfortunately I did not found any information how to recompile those cached files.