Skip to content

Ping Library fails in main branch, works in 3.0.2 and 2.7.4 #8555

Closed
@dduehren

Description

@dduehren

----------------------------- Delete below -----------------------------

Basic Infos

  • [ x] This issue complies with the issue POLICY doc.
  • [x ] I have read the documentation at readthedocs and the issue is not addressed there.
  • [ x] I have tested that the issue is present in current master branch (aka latest git).
  • [x ] I have searched the issue tracker for a similar issue.
  • [ x] If there is a stack dump, I have decoded it.
  • [x ] I have filled out all fields below.

Platform

  • Hardware: NodeMCU 1.0 (ESP-12 Module)
  • Core Version: Github Desktop clone on 5/2/2022
  • Development Env: Arduino IDE 1.8.13
  • Operating System: Windows 10

Settings in IDE

  • Module: ESP-12
  • Flash Mode: Probably GPIO, not sure
  • Flash Size: 4MB (FS:2MB, OTA: 1019KB)
  • lwip Variant: v2 Lower Memory
  • Reset Method: Reset via UART and button on the device
  • Flash Frequency: Not sure, probably
  • CPU Frequency: 80 MHz
  • Upload Using: Serial for this case
  • Upload Speed: 115200

Problem Description

This example sketch for ping functionality works on 3.0.2 and 2.7.4 but does not work in Master Branch I downloaded yesterday (5/2/22)

MCVE Sketch

/*
 * With this library an ESP8266 can ping a remote machine and know if it's reachable. 
 * It provides some basic measurements on ping messages (avg response time).
 */

#include <ESP8266WiFi.h>
#include <ESP8266Ping.h>

const char* ssid     = "ssid";
const char* password = "password";

const IPAddress remote_ip(192, 168, 0, 01;  //some suitable target

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

  // We start by connecting to a WiFi network

  Serial.println();
  Serial.println("Connecting to WiFi");
  
  WiFi.begin(ssid, password);
  
  while (WiFi.status() != WL_CONNECTED) {
    delay(100);
    Serial.print(".");
  }

  Serial.println();
  Serial.print("WiFi connected with ip ");  
  Serial.println(WiFi.localIP());

  Serial.print("Pinging ip ");
  Serial.println(remote_ip);

  if(Ping.ping(remote_ip)) {
    Serial.println("Success!!");
  } else {
    Serial.println("Error :(");
  }
}

void loop() { }

06:36:48.221 -> .......scandone
06:36:49.766 -> state: 0 -> 2 (b0)
06:36:49.766 -> .state: 2 -> 3 (0)
06:36:49.766 -> state: 3 -> 5 (10)
06:36:49.766 -> add 0
06:36:49.766 -> aid 8
06:36:49.766 -> cnt 
06:36:49.813 -> 
06:36:49.813 -> connected with TigerScout, channel 1
06:36:49.813 -> dhcp client start...
06:36:49.813 -> wifi evt: 0
06:36:49.859 -> ...ip:192.168.0.39,mask:255.255.255.0,gw:192.168.0.1
06:36:50.142 -> wifi evt: 3
06:36:50.189 -> .
06:36:50.189 -> WiFi connected with ip 192.168.0.39
06:36:50.189 -> Pinging ip 192.168.0.28
06:36:50.189 -> Error :(
06:36:55.305 -> ping 5, timeout 0, total payload 160 bytes, 5122 ms
06:36:59.764 -> pm open,type:2 0
06:38:52.241 -> ...........................scandone
06:38:55.753 -> state: 0 -> 2 (b0)
06:38:55.753 -> .state: 2 -> 3 (0)
06:38:55.753 -> state: 3 -> 5 (10)
06:38:55.753 -> add 0
06:38:55.753 -> aid 8
06:38:55.753 -> cnt 
06:38:55.801 -> 
06:38:55.801 -> connected with TigerScout, channel 1
06:38:55.801 -> dhcp client start...
06:38:55.801 -> wifi evt: 0
06:38:55.848 -> ...ip:192.168.0.39,mask:255.255.255.0,gw:192.168.0.1
06:38:56.081 -> wifi evt: 3
06:38:56.174 -> .
06:38:56.174 -> WiFi connected with ip 192.168.0.39
06:38:56.174 -> Pinging ip 192.168.0.35
06:38:56.174 -> Error :(
06:39:01.190 -> ping 5, timeout 0, total payload 160 bytes, 5022 ms
06:39:05.782 -> pm open,type:2 0

This is a section of output from the library running in a small app of my own. on 3.0.2 Note "ping succeeded).

connected with TigerScout, channel 1
13:33:43.803 -> dhcp client start...
13:33:43.803 -> wifi evt: 0
13:33:43.966 -> .!.!ip:192.168.0.39,mask:255.255.255.0,gw:192.168.0.1
13:33:44.199 -> wifi evt: 3
13:33:44.384 -> .!WiFi STA Conn.  Millis 4328,  TryCnt 3
13:33:44.384 -> ******* WIFI INFO ****************
13:33:44.384 -> Mode: STA
13:33:44.384 -> PHY mode: G
13:33:44.384 -> Channel: 1
13:33:44.384 -> AP id: 0
13:33:44.384 -> Status: 5
13:33:44.384 -> Auto connect: 1
13:33:44.384 -> SSID (10): TigerScout
13:33:44.384 -> BSSID set: 0
13:33:44.384 -> IP Address: 192.168.0.39 Signal: -70 Channel No: 1
13:33:44.384 -> GATEway IP: 192.168.0.1
13:33:44.384 -> AP SSID : (IP unset)
13:33:44.384 -> ******* WIFI INFO ****************
13:33:44.432 -> Begin loop
13:33:53.777 -> pm open,type:2 0
13:33:54.385 -> Begin loop
13:34:04.416 -> Begin loop
13:34:08.475 -> ping succeeded

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions