diff --git a/firmware/fiatlux.c b/firmware/fiatlux.c index fe19578..5533fe0 100644 --- a/firmware/fiatlux.c +++ b/firmware/fiatlux.c @@ -29,14 +29,13 @@ void gpio_intr_handler(uint8_t gpio_num); void manual_switch(void); -void buttonIntTask(void *pvParameters) -{ +_Noreturn void buttonIntTask(void *pvParameters) { printf("Waiting for button press interrupt on gpio %d...\r\n", SWITCH_PIN); - QueueHandle_t *tsqueue = (QueueHandle_t *)pvParameters; + QueueHandle_t *tsqueue = (QueueHandle_t *) pvParameters; gpio_set_interrupt(SWITCH_PIN, int_type, gpio_intr_handler); uint32_t last = 0; - while(1) { + while (1) { uint32_t button_ts; xQueueReceive(*tsqueue, &button_ts, portMAX_DELAY); button_ts *= portTICK_PERIOD_MS; diff --git a/firmware/system.c b/firmware/system.c index f12b19b..d8e1fcc 100644 --- a/firmware/system.c +++ b/firmware/system.c @@ -30,7 +30,7 @@ void system_clear_config() { spiflash_erase_sector(start + i * sdk_flashchip.sector_size); } if(sysparam_create_area(start, num_sectors, true) == SYSPARAM_OK) { - sysparam_init(start, 0); + sysparam_init(start, start + 0x2000); } sysparam_init(start, start + 0x2000); sdk_system_restart(); @@ -39,13 +39,13 @@ void system_clear_config() { void system_init_config() { uint32_t base_addr = 0x00100000; uint32_t num_sectors; - sysparam_init(base_addr, 0); + sysparam_init(base_addr, base_addr + 0x2000); if(sysparam_get_info(&base_addr, &num_sectors) != SYSPARAM_OK) { syslog("Warning: WiFi config, sysparam not initialized\n"); num_sectors = 0x2000 / sdk_flashchip.sector_size; //base_addr = sdk_flashchip.chip_size - (5 + num_sectors) * sdk_flashchip.sector_size; if(sysparam_create_area(base_addr, num_sectors, true) == SYSPARAM_OK) { - sysparam_init(base_addr, 0); + sysparam_init(base_addr, base_addr + 0x2000); } sdk_system_restart(); } diff --git a/firmware/web.cpp b/firmware/web.cpp index 82e7789..24149cf 100644 --- a/firmware/web.cpp +++ b/firmware/web.cpp @@ -325,6 +325,30 @@ void websocket_cb(struct tcp_pcb *pcb, char *data, u16_t data_len, } cmd = 'C'; break; + case 'T': { + auto A = *(int32_t *) &data[4]; + auto B = *(int32_t *) &data[8]; + auto C = *(int32_t *) &data[12]; + auto D = *(int32_t *) &data[16]; + /*sysparam_set_int32("noctis_A", A); + sysparam_set_int32("noctis_B", B); + sysparam_set_int32("noctis_C", C); + sysparam_set_int32("noctis_D", D);*/ + } + cmd = 'T'; + break; + case 'N': { + if(data[1] == 'W') + printf("WS2812\n"); + else if(data[1] == 'A') + printf("APA103C\n"); + else if(data[1] == 'Z') + printf("APA103C-Z\n"); + auto num_leds = *(uint16_t *) &data[2]; + /*sysparam_set_int32("noctis_leds", num_leds);*/ + } + cmd = 'N'; + break; case 'S': { if(data[1] == 'E') en = 1; diff --git a/firmware/webdir/css/style.css b/firmware/webdir/css/style.css index c84c3d9..3a452de 100644 --- a/firmware/webdir/css/style.css +++ b/firmware/webdir/css/style.css @@ -10,7 +10,7 @@ canvas { width: 100%; } -main section:target ~ section, main section#io, main section#wifi, main section#ota { +main section:target ~ section, main section#io, main section#wifi, main section#noctis, main section#ota { display: none; } diff --git a/firmware/webdir/index.html b/firmware/webdir/index.html index 41d3897..5528358 100644 --- a/firmware/webdir/index.html +++ b/firmware/webdir/index.html @@ -18,6 +18,7 @@
@@ -131,6 +132,61 @@ +