[build conflict] Renamed ESP32 version of ping (#963)

Had a conflict with the ESP8266 version of ping.
Let's hope I did not break anything with the ESP32 builds @mvdbro does.
This commit is contained in:
Gijs Noorlander
2018-02-27 00:10:17 +01:00
committed by DatuX
parent 226c0a6f83
commit 076ce0127b
6 changed files with 22 additions and 13 deletions
+6 -6
View File
@@ -7,7 +7,7 @@
#include <WiFi.h>
#include "ping.h"
#include "esp32_ping.h"
// the setup function runs once when you press reset or power the board
const char ssid[] = "TP-LINK_C20B"; // your network SSID (name)
@@ -26,7 +26,7 @@ void setup() {
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("Pinging address: 192.168.1.1");
@@ -37,17 +37,17 @@ void loop() {
int ia[4] = { 192,168,1,1 };
int i = 0;
while (Serial.available()) {
char c = Serial.read();
delay(100);
int val = 0;
while (c != '.' && c != 10 && c!=255) {
if (c >= '0'&& c<='9') {
val = val*10+(c-'0');
val = val*10+(c-'0');
}
c = Serial.read();
}
ia[i++] =val ;
}
IPAddress adr = IPAddress(ia[0], ia[1], ia[2], ia[3]);
@@ -71,4 +71,4 @@ int readnu(char s) {
}
Serial.println(digit);
return digit;
}
}
@@ -27,7 +27,7 @@
* Lua RTOS, ping utility
*
*
* Author: Jaume Olivé (jolive@iberoxarxa.com / jolive@whitecatboard.org)
* Author: Jaume Oliv (jolive@iberoxarxa.com / jolive@whitecatboard.org)
*
* --------------------------------------------------------------------------------
*
@@ -57,6 +57,8 @@
*
*/
#ifdef ESP32
#include <Arduino.h>
#include <math.h>
@@ -66,7 +68,7 @@
#include <string.h>
#include <errno.h>
#include "ping.h"
#include "esp32_ping.h"
#include "lwip/inet_chksum.h"
#include "lwip/ip.h"
@@ -246,7 +248,7 @@ void ping(const char *name, int count, int interval, int size, int timeout) {
ping_start(adr, count, interval, size, timeout);
}
bool ping_start(struct ping_option *ping_o) {
return ping_start(ping_o->ip,ping_o->count,0,0,0);
@@ -280,8 +282,8 @@ bool ping_start(IPAddress adr, int count=0, int interval=0, int size=0, int time
}
address.sin_addr.s_addr = adr;
ping_target.addr = address.sin_addr.s_addr;
address.sin_addr.s_addr = adr;
ping_target.addr = address.sin_addr.s_addr;
// Setup socket
struct timeval tout;
@@ -361,3 +363,4 @@ bool ping_regist_sent(struct ping_option *ping_opt, ping_sent_function ping_sent
ping_opt->sent_function = ping_sent;
return true;
}
#endif
@@ -3,6 +3,8 @@
#define _PING_
#include <Arduino.h>
#ifdef ESP32
typedef void(*ping_recv_function)(void* arg, void *pdata);
typedef void(*ping_sent_function)(void* arg, void *pdata);
@@ -30,4 +32,5 @@ bool ping_start(struct ping_option *ping_opt);
void ping(const char *name, int count, int interval, int size, int timeout);
bool ping_start(IPAddress adr, int count, int interval, int size, int timeout);
#endif
#endif
#endif
@@ -20,6 +20,7 @@
#ifndef ESP8266Ping_H
#define ESP8266Ping_H
#if defined(ESP8266)
#include <Arduino.h>
#include <ESP8266WiFi.h>
@@ -57,3 +58,4 @@ class PingClass {
PingClass Ping;
#endif
#endif
@@ -17,6 +17,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern "C" void esp_schedule();
extern "C" void esp_yield();
+1 -1
View File
@@ -436,7 +436,7 @@
#define FILE_NOTIFICATION "/notification.dat"
#define FILE_RULES "/rules1.dat"
#include <WiFi.h>
#include "ping.h"
#include "esp32_ping.h"
#include <ESP32WebServer.h>
#include "SPIFFS.h"
ESP32WebServer WebServer(80);