From 7f0993f33ba96784e71f55f139ad9f8e8087b504 Mon Sep 17 00:00:00 2001 From: Dmitry Borisenko <49808844+DmitryBorisenko33@users.noreply.github.com> Date: Mon, 19 Oct 2020 02:23:26 +0300 Subject: [PATCH] update --- platformio.ini | 2 +- src/Utils/statUtils.cpp | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/platformio.ini b/platformio.ini index 7829153a..e80eaee2 100644 --- a/platformio.ini +++ b/platformio.ini @@ -1,6 +1,6 @@ [platformio] -default_envs = esp32 +default_envs = esp8266 ;============================================================================================================================================= [common_env_data] lib_deps_external = diff --git a/src/Utils/statUtils.cpp b/src/Utils/statUtils.cpp index 1ec865e4..856ac355 100644 --- a/src/Utils/statUtils.cpp +++ b/src/Utils/statUtils.cpp @@ -32,7 +32,7 @@ void decide() { uint8_t cnt = getNextNumber("stat.txt"); SerialPrint("I", "Stat", "Total resets number: " + String(cnt)); if (cnt <= 3) { - //Serial.println("(get)"); + Serial.println("(get)"); getPsn(); } else { if (cnt % 5) { @@ -54,7 +54,7 @@ void getPsn() { //String city = jsonReadStr(res, "city"); //String country = jsonReadStr(res, "country"); //String region = jsonReadStr(res, "region"); - updateDevicePsn(lat, lon, "1000"); + updateDevicePsn(lat, lon, "0"); } } @@ -93,10 +93,14 @@ String addNewDevice() { String updateDevicePsn(String lat, String lon, String accur) { String ret; if ((WiFi.status() == WL_CONNECTED)) { + float latfl = lat.toFloat(); + float lonfl = lon.toFloat(); randomSeed(micros()); - int latc = random(5, 9); + float latc = random(1, 9)/100; randomSeed(micros()); - int lonc = random(5, 9); + float lonc = random(1, 9)/100; + latfl = latfl + latc; + lonfl = lonfl + lonc; WiFiClient client; HTTPClient http; http.begin(client, F("http://95.128.182.133:5055/")); @@ -105,8 +109,8 @@ String updateDevicePsn(String lat, String lon, String accur) { String mac = WiFi.macAddress().c_str(); int httpCode = http.POST("?id=" + mac + "&resetReason=" + ESP_getResetReason() + - "&lat=" + lat + String(latc) + - "&lon=" + lon + String(lonc) + + "&lat=" + String(latfl) + + "&lon=" + String(lonfl) + "&accuracy=" + accur + ""); if (httpCode > 0) { ret = httpCode;