mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 14:12:16 +03:00
update
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
|
||||
[platformio]
|
||||
default_envs = esp32
|
||||
default_envs = esp8266
|
||||
;=============================================================================================================================================
|
||||
[common_env_data]
|
||||
lib_deps_external =
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user