mirror of
https://github.com/anklimov/lighthub
synced 2025-12-06 11:49:51 +03:00
get, load and mdns fix
This commit is contained in:
@@ -122,6 +122,9 @@ volatile uint32_t timerLanCheckTime = 0;
|
|||||||
volatile uint32_t timerThermostatCheck = 0;
|
volatile uint32_t timerThermostatCheck = 0;
|
||||||
volatile uint32_t timerSensorCheck =0;
|
volatile uint32_t timerSensorCheck =0;
|
||||||
volatile uint32_t WiFiAwaitingTime =0;
|
volatile uint32_t WiFiAwaitingTime =0;
|
||||||
|
volatile unsigned long timerCount=0;
|
||||||
|
volatile int16_t timerNumber=-1;
|
||||||
|
volatile int8_t timerHandlerBusy=0;
|
||||||
|
|
||||||
aJsonObject *pollingItem = NULL;
|
aJsonObject *pollingItem = NULL;
|
||||||
|
|
||||||
@@ -173,6 +176,7 @@ if (configLocked)
|
|||||||
}
|
}
|
||||||
|
|
||||||
debugSerial<<F("Stopping channels ...")<<endl;
|
debugSerial<<F("Stopping channels ...")<<endl;
|
||||||
|
timerHandlerBusy++;
|
||||||
//Stoping the channels
|
//Stoping the channels
|
||||||
aJsonObject * item = items->child;
|
aJsonObject * item = items->child;
|
||||||
while (items && item)
|
while (items && item)
|
||||||
@@ -212,6 +216,7 @@ debugSerial<<F("Deleting conf. RAM was:")<<freeRam();
|
|||||||
debugSerial<<F(" is ")<<freeRam()<<endl;
|
debugSerial<<F(" is ")<<freeRam()<<endl;
|
||||||
|
|
||||||
configOk=false;
|
configOk=false;
|
||||||
|
timerHandlerBusy--;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isNotRetainingStatus() {
|
bool isNotRetainingStatus() {
|
||||||
@@ -1194,6 +1199,7 @@ setupSyslog();
|
|||||||
configLoaded=true;
|
configLoaded=true;
|
||||||
if (sysConf.getSaveSuccedConfig()) cmdFunctionSave(0,NULL);
|
if (sysConf.getSaveSuccedConfig()) cmdFunctionSave(0,NULL);
|
||||||
configLocked--;
|
configLocked--;
|
||||||
|
ethClient.stop(); //Refresh MQTT connection
|
||||||
}
|
}
|
||||||
|
|
||||||
void printConfigSummary() {
|
void printConfigSummary() {
|
||||||
@@ -1221,7 +1227,7 @@ void printConfigSummary() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void cmdFunctionLoad(int arg_cnt, char **args) {
|
void cmdFunctionLoad(int arg_cnt, char **args) {
|
||||||
loadConfigFromEEPROM();
|
if (!loadConfigFromEEPROM()) lanStatus=DO_REINIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1241,7 +1247,7 @@ int loadConfigFromEEPROM()
|
|||||||
}
|
}
|
||||||
infoSerial<<F("Loaded")<<endl;
|
infoSerial<<F("Loaded")<<endl;
|
||||||
applyConfig();
|
applyConfig();
|
||||||
ethClient.stop(); //Refresh MQTT connect to get retained info
|
//ethClient.stop(); //Refresh MQTT connect to get retained info
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
JSONStream.write(255); //truncate garbage
|
JSONStream.write(255); //truncate garbage
|
||||||
@@ -1401,7 +1407,7 @@ if (arg_cnt>1)
|
|||||||
}
|
}
|
||||||
|
|
||||||
lanStatus= loadConfigFromHttp(arg_cnt, args);
|
lanStatus= loadConfigFromHttp(arg_cnt, args);
|
||||||
ethClient.stop(); //Refresh MQTT connect to get retained info
|
//ethClient.stop(); //Refresh MQTT connect to get retained info
|
||||||
}
|
}
|
||||||
|
|
||||||
void printBool(bool arg) { (arg) ? infoSerial<<F("+") : infoSerial<<F("-"); }
|
void printBool(bool arg) { (arg) ? infoSerial<<F("+") : infoSerial<<F("-"); }
|
||||||
@@ -1499,6 +1505,7 @@ lan_status loadConfigFromHttp(int arg_cnt, char **args)
|
|||||||
htclient.setHttpResponseTimeout(4000);
|
htclient.setHttpResponseTimeout(4000);
|
||||||
wdt_res();
|
wdt_res();
|
||||||
//debugSerial<<"making GET request");get
|
//debugSerial<<"making GET request");get
|
||||||
|
debugSerial<<F("Before request: Free:")<<freeRam()<<endl;
|
||||||
htclient.beginRequest();
|
htclient.beginRequest();
|
||||||
responseStatusCode = htclient.get(URI);
|
responseStatusCode = htclient.get(URI);
|
||||||
htclient.endRequest();
|
htclient.endRequest();
|
||||||
@@ -1514,8 +1521,9 @@ lan_status loadConfigFromHttp(int arg_cnt, char **args)
|
|||||||
|
|
||||||
//delay(1000);
|
//delay(1000);
|
||||||
if (responseStatusCode == 200) {
|
if (responseStatusCode == 200) {
|
||||||
debugSerial<<F("GET Response: ")<<response<<endl;
|
|
||||||
debugSerial<<F("Free:")<<freeRam()<<endl;
|
debugSerial<<F("Free:")<<freeRam()<<endl;
|
||||||
|
debugSerial<<F("Response Len:")<<response.length()<<endl;
|
||||||
|
//debugSerial<<F("GET Response: ")<<response<<endl;
|
||||||
cleanConf();
|
cleanConf();
|
||||||
debugSerial<<F("Configuration cleaned")<<endl;
|
debugSerial<<F("Configuration cleaned")<<endl;
|
||||||
debugSerial<<F("Free:")<<freeRam()<<endl;
|
debugSerial<<F("Free:")<<freeRam()<<endl;
|
||||||
@@ -1611,21 +1619,18 @@ void postTransmission() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
volatile unsigned long timerCount=0;
|
|
||||||
volatile int16_t timerNumber=-1;
|
|
||||||
volatile int8_t timerHandlerBusy=0;
|
|
||||||
|
|
||||||
void TimerHandler(void)
|
void TimerHandler(void)
|
||||||
{
|
{
|
||||||
timerHandlerBusy++;
|
timerHandlerBusy++;
|
||||||
interrupts();
|
interrupts();
|
||||||
timerCount=micros();
|
timerCount=micros();
|
||||||
if (configLoaded && !timerHandlerBusy) inputLoop(CHECK_INTERRUPT);
|
if (configLoaded && !timerHandlerBusy)
|
||||||
|
{
|
||||||
|
inputLoop(CHECK_INTERRUPT);
|
||||||
#ifdef DMX_SMOOTH
|
#ifdef DMX_SMOOTH
|
||||||
DMXOUT_propagate();
|
DMXOUT_propagate();
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
timerCount=micros()-timerCount;
|
timerCount=micros()-timerCount;
|
||||||
timerHandlerBusy--;
|
timerHandlerBusy--;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user