diff --git a/docker/firmware/Dockerfile b/docker/firmware/Dockerfile index d114027..1c60599 100644 --- a/docker/firmware/Dockerfile +++ b/docker/firmware/Dockerfile @@ -8,6 +8,6 @@ RUN cd app/modules/sdk; export CT_EXPERIMENTAL=y; export CT_ALLOW_BUILD_AS_ROOT= USER 0 RUN apt remove --purge -y python2 && apt autoremove --purge -y && apt install -y python3 python3-serial RUN apt install -y --reinstall python-is-python3 -USER 0 +USER 1000 WORKDIR /app ENV PATH=/app/modules/sdk/xtensa-lx106-elf/bin:$PATH diff --git a/firmware/fiatlux.c b/firmware/fiatlux.c index 20fbd97..61e2dca 100644 --- a/firmware/fiatlux.c +++ b/firmware/fiatlux.c @@ -39,7 +39,7 @@ void user_init(void) { wifi_alive = xSemaphoreCreateBinary(); publish_queue = xQueueCreate(3, PUB_MSG_LEN); - //xTaskCreate(&beat_task, "beat_task", 256, NULL, 3, NULL); + xTaskCreate(&beat_task, "beat_task", 256, NULL, 3, NULL); } diff --git a/firmware/web.cpp b/firmware/web.cpp index 618c4ee..0700681 100644 --- a/firmware/web.cpp +++ b/firmware/web.cpp @@ -30,7 +30,6 @@ using namespace fiatlux; int version = 23; - #define vTaskDelayMs(ms) vTaskDelay((ms) / portTICK_PERIOD_MS) const char hex_lookup[] = "0123456789ABCDEF\0\0"; @@ -114,11 +113,11 @@ void websocket_task(void *pvParameter) { UNLOCK_TCPIP_CORE();*/ taskYIELD(); - } else if(has_changed.lights) { + } else if(has_changed.lights) { messages::frame frame; frame.cmd = messages::LIGHTS; - frame.msg.top_color = *(uint32_t*)&top_color; - frame.msg.bottom_color = *(uint32_t*)&bottom_color; + frame.msg.top_color = *(uint32_t *) &top_color; + frame.msg.bottom_color = *(uint32_t *) &bottom_color; frame.msg.white_brightness = light_value; LOCK_TCPIP_CORE(); websocket_write(pcb, (unsigned char *) &frame, sizeof(frame), WS_BIN_MODE); @@ -249,7 +248,8 @@ void websocket_task(void *pvParameter) { //printf("9: %d\n",gpio_read(9)); //printf("10: %d\n",gpio_read(10)); - vTaskDelayMs(250); + + taskYIELD(); { uint8_t response[3]; uint16_t val; @@ -469,6 +469,9 @@ extern "C" void httpd_task(void *pvParameters) { // register handlers and start the server http_set_cgi_handlers(pCGIs, sizeof(pCGIs) / sizeof(pCGIs[0]));*/ + //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();