This commit is contained in:
j3d1 2022-06-27 20:00:48 +02:00
parent 7424a80945
commit 8b0020c387
7 changed files with 79 additions and 20 deletions

View file

@ -60,7 +60,8 @@ void websocket_task(void *pvParameter) {
UNLOCK_TCPIP_CORE();
} else
syslog("buffer too small -1\n");
vTaskDelayMs(1000);
taskYIELD();
}
//Global Info
@ -94,7 +95,8 @@ void websocket_task(void *pvParameter) {
UNLOCK_TCPIP_CORE();
} else
syslog("buffer too small 0\n");
vTaskDelayMs(1000);
taskYIELD();
}
//Connection Info
@ -117,7 +119,8 @@ void websocket_task(void *pvParameter) {
UNLOCK_TCPIP_CORE();
} else
syslog("buffer too small 1\n");
vTaskDelayMs(1000);
taskYIELD();
}
if(has_changed.wifi) {
@ -175,7 +178,8 @@ void websocket_task(void *pvParameter) {
syslog("buffer too small 2\n");
}
vTaskDelayMs(1000);
taskYIELD();
if(opmode == STATION_MODE || opmode == STATIONAP_MODE) {
uint8_t hwaddr[6];
@ -204,7 +208,8 @@ void websocket_task(void *pvParameter) {
}
vTaskDelayMs(250);
taskYIELD();
{
uint8_t response[3];
uint16_t val;
@ -354,11 +359,11 @@ void websocket_cb(struct tcp_pcb *pcb, char *data, u16_t data_len,
if(ret == OK) {
if(cmd == 'R' || cmd == 'C') { // Restart
printf("rebooting now");
vTaskDelay(1000 / portTICK_PERIOD_MS);
taskYIELD();
vPortEnterCritical();
sdk_system_restart();
} else if(cmd == 'X') { // Clear Config
vTaskDelay(1000 / portTICK_PERIOD_MS);
taskYIELD();
system_clear_config();
}
}
@ -378,8 +383,9 @@ void websocket_open_cb(struct tcp_pcb *pcb, const char *uri) {
extern "C" void httpd_task(void *pvParameters) {
(void) pvParameters;
while (!uxSemaphoreGetCount(wifi_available_semaphore))
vTaskDelay(500 / portTICK_PERIOD_MS);
//while (!uxSemaphoreGetCount(wifi_available_semaphore))
// taskYIELD();
printf("httpd_task: wifi is available\n");
websocket_register_callbacks((tWsOpenHandler) websocket_open_cb, (tWsHandler) websocket_cb);
httpd_init();