This commit is contained in:
l0sted 2019-01-06 18:29:13 +03:00
parent f161e467bf
commit 9350b6f77d
2 changed files with 7 additions and 12 deletions

View File

@ -1,7 +1,6 @@
{
"output": "Output",
"port": "/dev/ttyUSB0",
"board": "esp8266:esp8266:generic",
"configuration": "CpuFrequency=80,FlashFreq=40,FlashMode=qio,UploadSpeed=921600,FlashSize=4M2M,ResetMethod=ck,Debug=Disabled,DebugLevel=None____",
"sketch": "frontend.ino"
"configuration": "CpuFrequency=80,FlashFreq=40,FlashMode=qio,UploadSpeed=115200,FlashSize=512K0,ResetMethod=ck,Debug=Disabled,DebugLevel=None____",
"sketch": "frontend.ino",
"port": "/dev/ttyUSB0"
}

View File

@ -10,7 +10,7 @@
String inTemp,outTemp,pressure,humid;
const unsigned short int onTime=6, offTime=23, beepDelay=60, timeOffset=3;
short int lastBeep;
const String httpAddr="http://192.168.100.101:1880";
const String httpAddr="http://192.168.100.100:1880";
WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP);
@ -45,15 +45,14 @@ void loop(){
netTasks();
}
else {
delay(750);
delay(500);
}
}
void netTasks() {
HTTPClient http;
WiFi.forceSleepWake();
wifiConnect();
if (WiFi.status() != WL_CONNECTED) {
wifiConnect();
wifiConnect(false);
}
http.begin(httpAddr+"/inTemp");
if (http.GET() < 0) //IDK why the fuck i cant getString without this check
@ -141,21 +140,18 @@ bool nightMode() {
else
return false;
}
void wifiConnect() {
void wifiConnect(bool boot) {
int beginMillis = millis();
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED && millis() - beginMillis < 30000) {
delay(250);
displayStatus(1);
Serial.print(".");
}
if (WiFi.status() != WL_CONNECTED) {
displayStatus(2);
delay(10000);
ESP.reset();
} else {
Serial.print("Connected to " + String(ssid) + "; IP address: ");
Serial.println(WiFi.localIP());
displayStatus(0);
}
}