FW tweeks

This commit is contained in:
JonatanRek 2019-11-27 18:18:46 +01:00
parent 878186c2a2
commit 8975eb785b

View File

@ -5,9 +5,9 @@
#include <ArduinoJson.h> #include <ArduinoJson.h>
//Variables //Variables
const char* ssid = ""; const char* ssid = "SteelAntsNET";
const char* pasw = ""; const char* pasw = "tgr786hgtp3CZ";
const char* hwId = ""; const char* hwId = "JOK3R";
const char* url = "http://dev.steelants.cz/vasek/home/api.php"; const char* url = "http://dev.steelants.cz/vasek/home/api.php";
int unsuccessfulRounds = 0; int unsuccessfulRounds = 0;
@ -31,6 +31,10 @@ void setup() {
void loop() { void loop() {
WiFi.begin(ssid, pasw); WiFi.begin(ssid, pasw);
checkConnection(); checkConnection();
Serial.print("IP address:\t");
Serial.println(WiFi.localIP());
Serial.print("MAC address:\t");
Serial.println(WiFi.macAddress());
//HTTP CLIENT //HTTP CLIENT
HTTPClient http; HTTPClient http;
@ -79,15 +83,18 @@ void loop() {
if (state != "succes") { if (state != "succes") {
unsuccessfulRounds++; unsuccessfulRounds++;
Serial.println("UNSUCCESSFUL ROUND NUMBER " + unsuccessfulRounds + "FROM 5"); Serial.println("UNSUCCESSFUL ROUND NUMBER " + String(unsuccessfulRounds) + "FROM 5");
} else if (state == "succes") { } else if (state == "succes") {
unsuccessfulRounds = 0; unsuccessfulRounds = 0;
} }
//Set static ip //Set static ip
IPAddress addr; IPAddress staticIpAddress;
if (addr.fromString(ipAddress)) { IPAddress subnetIpAddress(192,168,0,1);
IPAddress ip(addr); IPAddress gatewayIpAddress(255, 255, 255, 0);
if (staticIpAddress.fromString(ipAddress)) {
WiFi.config(staticIpAddress, subnetIpAddress, gatewayIpAddress);
Serial.print("IP address:\t"); Serial.print("IP address:\t");
Serial.println(WiFi.localIP()); Serial.println(WiFi.localIP());
} }
@ -100,7 +107,7 @@ void loop() {
if(unsuccessfulRounds == 5) { if(unsuccessfulRounds == 5) {
Serial.println("RESTARTING ESP"); Serial.println("RESTARTING ESP");
ESP.restart() ESP.restart();
} }
Serial.println("GOING TO SLEEP FOR " + String(sleepTime)); Serial.println("GOING TO SLEEP FOR " + String(sleepTime));