From f89f3e181684142207129212fbf57116872d0553 Mon Sep 17 00:00:00 2001 From: jedi Date: Mon, 21 Jun 2021 21:35:22 +0200 Subject: [PATCH] basic webconf --- firmware/fiatlux.c | 796 +++++++++++++++++++++++++- firmware/fsdata/fs/css/picnic.min.css | 1 + firmware/fsdata/fs/css/style.css | 62 ++ firmware/fsdata/fs/index.html | 477 +++++++++++++++ firmware/fsdata/fs/js/smoothie_min.js | 15 + 5 files changed, 1349 insertions(+), 2 deletions(-) create mode 100644 firmware/fsdata/fs/css/picnic.min.css create mode 100644 firmware/fsdata/fs/css/style.css create mode 100644 firmware/fsdata/fs/index.html create mode 100644 firmware/fsdata/fs/js/smoothie_min.js diff --git a/firmware/fiatlux.c b/firmware/fiatlux.c index 1368d86..f655639 100644 --- a/firmware/fiatlux.c +++ b/firmware/fiatlux.c @@ -8,13 +8,805 @@ #include "mqtt.h" #include "lux.h" +#define LED_PIN 2 +#define SWITCH_PIN 2 -void user_init(void) -{ +/* Add extras/sntp component to makefile for this include to work */ +#include +#include + +const int cs0 = 15; +const int gpio4 = 4; +const int gpio5 = 5; + +const int led_number = 8; + +static ws2812_pixel_t next_colour(int i) { + ws2812_pixel_t colour = {{0, 0, 0, 0}}; + if(i == 8) { + colour.white = 32; + } else { + colour.red = i & 1 ? 32 : 0; + colour.green = i & 2 ? 32 : 0; + colour.blue = i & 4 ? 32 : 0; + } + + return colour; +} + +void spi_dac(int id, int val) { + int dac_val = (val << 2) & 0x3FFC; + + spi_transfer_8(1, ~(0x00)); + gpio_write(cs0, 1); + gpio_write(cs0, 0); + spi_transfer_8(1, ~(0x01 << id)); + gpio_write(cs0, 1); + gpio_write(cs0, 0); + + spi_transfer_16(1, dac_val); + + spi_transfer_8(1, ~(0x00)); + gpio_write(cs0, 1); + gpio_write(cs0, 0); + spi_transfer_8(1, ~(0x01 << id)); + gpio_write(cs0, 1); + gpio_write(cs0, 0); +} + +/* This task uses the high level GPIO API (esp_gpio.h) to blink an LED. + * + */ +void blinkenTask(void *pvParameters) { + + gpio_enable(9, GPIO_INPUT); + gpio_enable(10, GPIO_INPUT); + + ws2812_pixel_t pixels[led_number]; + ws2812_i2s_init(led_number, PIXEL_RGBW); + memset(pixels, 0, sizeof(ws2812_pixel_t) * led_number); + + gpio_enable(cs0, GPIO_OUTPUT); + gpio_enable(gpio4, GPIO_OUTPUT); + gpio_enable(gpio5, GPIO_OUTPUT); + spi_init(1, SPI_MODE0, SPI_FREQ_DIV_1M, 1, SPI_BIG_ENDIAN, 1); + while (1) { + gpio_write(gpio4, 1); + vTaskDelay(200 / portTICK_PERIOD_MS); + gpio_write(gpio4, 0); + for (int j = 0; j < 64; j++) { + for (int i = 0; i < 8; i++) + spi_dac(i, 64 * j); + //printf("> %d\n", 64*j); + vTaskDelay(1000 / portTICK_PERIOD_MS); + } + for (int i = 0; i < 8; i++) + spi_dac(i, 0); + + gpio_write(gpio5, 1); + vTaskDelay(200 / portTICK_PERIOD_MS); + gpio_write(gpio5, 0); + + for (int c = 8; c >= 0; c--) { + + for (int i = 0; i < led_number; i++) { + pixels[i] = next_colour(c); + } + ws2812_i2s_update(pixels, PIXEL_RGBW); + vTaskDelay(200 / portTICK_PERIOD_MS); + } + + } +} + +#define SNTP_SERVERS "0.pool.ntp.org", "1.pool.ntp.org", \ + "2.pool.ntp.org", "3.pool.ntp.org" + +#define vTaskDelayMs(ms) vTaskDelay((ms)/portTICK_PERIOD_MS) +#define UNUSED_ARG(x) (void)x + +const gpio_inttype_t int_type = GPIO_INTTYPE_EDGE_NEG; + + +const char *gpio_cgi_handler(int iIndex, int iNumParams, char *pcParam[], char *pcValue[]) { + for (int i = 0; i < iNumParams; i++) { + if(strcmp(pcParam[i], "on") == 0) { + uint8_t gpio_num = atoi(pcValue[i]); + gpio_enable(gpio_num, GPIO_OUTPUT); + gpio_write(gpio_num, true); + } else if(strcmp(pcParam[i], "off") == 0) { + uint8_t gpio_num = atoi(pcValue[i]); + gpio_enable(gpio_num, GPIO_OUTPUT); + gpio_write(gpio_num, false); + } else if(strcmp(pcParam[i], "toggle") == 0) { + uint8_t gpio_num = atoi(pcValue[i]); + gpio_enable(gpio_num, GPIO_OUTPUT); + gpio_toggle(gpio_num); + } + } + return "/index.html"; +} + +void websocket_task(void *pvParameter) { + struct tcp_pcb *pcb = (struct tcp_pcb *) pvParameter; + + int connstarttime = xTaskGetTickCount(); + + for (;;) { + if(pcb == NULL || pcb->state != ESTABLISHED) { + printf("Connection closed, deleting task\n"); + break; + } + + + //Global Info + { + struct timeval tv; + gettimeofday(&tv, NULL); + int uptime = xTaskGetTickCount() * portTICK_PERIOD_MS / 1000; + int heap = (int) xPortGetFreeHeapSize(); + uint32_t chip_id = sdk_system_get_chip_id(); + uint32_t flash_id = sdk_spi_flash_get_id(); + uint32_t flash_size = sdk_flashchip.chip_size >> 10; + char *hostname = NULL; + + sysparam_get_string("hostname", &hostname); + /* Generate response in JSON format */ + char response[160]; + int len = snprintf(response, sizeof(response), + "{\"walltime\" : \"%d\"," + "\"uptime\" : \"%d\"," + " \"heap\" : \"%d\"," + " \"chipid\" : \"%08x\"," + " \"flashid\" : \"0x%08x\"," + " \"flashsize\" : \"%u\"," + " \"hostname\" : \"%s\"" + "}", (int) tv.tv_sec, uptime, heap, chip_id, flash_id, flash_size, hostname); + free(hostname); + if(len < sizeof(response)) { + LOCK_TCPIP_CORE(); + websocket_write(pcb, (unsigned char *) response, len, WS_TEXT_MODE); + UNLOCK_TCPIP_CORE(); + } else + printf("buffer too small 1"); + } + + vTaskDelay(2000 / portTICK_PERIOD_MS); + + + //Connection Info + { + struct timeval tv; + gettimeofday(&tv, NULL); + int connuptime = (xTaskGetTickCount() - connstarttime) * portTICK_PERIOD_MS / 1000; + + printf("conn %d: " + IPSTR + " <-> " + IPSTR + " \n", pcb->netif_idx, IP2STR(&pcb->local_ip), IP2STR(&pcb->remote_ip)); + char response[160]; + int len = snprintf(response, sizeof(response), + "{\"connage\" : \"%d\"," + "\"clientip\" : \"" + IPSTR + "\"" + "}", connuptime, IP2STR(&pcb->remote_ip)); + if(len < sizeof(response)) { + LOCK_TCPIP_CORE(); + websocket_write(pcb, (unsigned char *) response, len, WS_TEXT_MODE); + UNLOCK_TCPIP_CORE(); + } else + printf("buffer too small 1"); + } + + vTaskDelay(2000 / portTICK_PERIOD_MS); + + { + uint8_t opmode = sdk_wifi_get_opmode(); + const char *opmode_str = "??"; + switch (opmode) { + case NULL_MODE: + opmode_str = "Null"; + break; + case STATION_MODE: + opmode_str = "Station"; + break; + case SOFTAP_MODE: + opmode_str = "SoftAP"; + break; + case STATIONAP_MODE: + opmode_str = "StationAP"; + break; + default: + break; + } + + + /*struct sockaddr_storage addr; + socklen_t addr_len = sizeof(addr); + if (getpeername(s, (struct sockaddr *)&addr, &addr_len) == 0) { + printf("peer\n"); + }*/ + + + if(opmode == SOFTAP_MODE || opmode == STATIONAP_MODE) { + uint8_t hwaddr[6]; + sdk_wifi_get_macaddr(SOFTAP_IF, hwaddr); + struct ip_info info; + sdk_wifi_get_ip_info(SOFTAP_IF, &info); + + char *apssid = NULL; + sysparam_get_string("wifi_ap_ssid", &apssid); + + /* Generate response in JSON format */ + char response[128]; + int len = snprintf(response, sizeof(response), + "{\"opmode\" : \"%s\"," + " \"apssid\" : \"%s\"," + " \"apip\" : \"" + IPSTR + "\"," + " \"apmac\" : \"" + MACSTR + "\"" + "}", opmode_str, apssid, IP2STR(&info.ip), MAC2STR(hwaddr)); + free(apssid); + if(len < sizeof(response)) { + LOCK_TCPIP_CORE(); + websocket_write(pcb, (unsigned char *) response, len, WS_TEXT_MODE); + UNLOCK_TCPIP_CORE(); + } else + printf("buffer too small 2"); + } + + vTaskDelay(2000 / portTICK_PERIOD_MS); + + if(opmode == STATION_MODE || opmode == STATIONAP_MODE) { + uint8_t hwaddr[6]; + sdk_wifi_get_macaddr(STATION_IF, hwaddr); + struct ip_info info; + sdk_wifi_get_ip_info(STATION_IF, &info); + char *stassid = NULL; + sysparam_get_string("wifi_sta_ssid", &stassid); + + /* Generate response in JSON format */ + char response[128]; + int len = snprintf(response, sizeof(response), + "{\"opmode\" : \"%s\"," + " \"stassid\" : \"%s\"," + " \"staip\" : \"" + IPSTR + "\"," + " \"stamac\" : \"" + MACSTR + "\"" + "}", opmode_str, stassid, IP2STR(&info.ip), MAC2STR(hwaddr)); + free(stassid); + if(len < sizeof(response)) { + LOCK_TCPIP_CORE(); + websocket_write(pcb, (unsigned char *) response, len, WS_TEXT_MODE); + UNLOCK_TCPIP_CORE(); + } else + printf("buffer too small 3"); + } + + } + + vTaskDelay(2000 / portTICK_PERIOD_MS); + //printf("9: %d\n",gpio_read(9)); + //printf("10: %d\n",gpio_read(10)); + } + + vTaskDelete(NULL); +} + +/** + * This function is called when websocket frame is received. + * + * Note: this function is executed on TCP thread and should return as soon + * as possible. + */ +void websocket_cb(struct tcp_pcb *pcb, char *data, u16_t data_len, uint8_t mode) { + + uint8_t response[3]; + uint16_t val = 0; + char cmd = '0'; + + uint8_t en = 0; + /*uint8_t ap_disable_if_sta = 0; + uint8_t ssid_hidden = 0; + uint8_t dns_enable = 0; + uint8_t mdns_enable = 0;*/ + + switch (data[0]) { + case 'V': // ADC + /* This should be done on a separate thread in 'real' applications */ + val = sdk_system_adc_read(); + cmd = 'V'; + break; + case 'R': // Restart + cmd = 'R'; + break; + case 'X': // Clear Config + cmd = 'X'; + break; + case 'D': // Disable LED + gpio_write(LED_PIN, true); + val = 0xDEAD; + cmd = 'G'; + break; + case 'E': // Enable LED + gpio_write(LED_PIN, false); + val = 0xBEEF; + cmd = 'G'; + break; + case 'S': { + if(data[1] == 'E') + en = 1; + char *ssid = &data[2]; + size_t ssid_len = strlen(ssid); + char *password = &data[3 + ssid_len]; + size_t password_len = strlen(password); + + sysparam_set_int8("wifi_sta_enable", en); + sysparam_set_string("wifi_sta_ssid", ssid); + sysparam_set_string("wifi_sta_password", password); + } + cmd = 'S'; + break; + case 'A': { + if(data[1] == 'E') + en = 1; + char *ssid = &data[2]; + size_t ssid_len = strlen(ssid); + char *password = &data[3 + ssid_len]; + size_t password_len = strlen(password); + + sysparam_set_int8("wifi_ap_enable", en); + sysparam_set_string("wifi_ap_ssid", ssid); + sysparam_set_string("wifi_ap_password", password); + + //sysparam_set_int8("wifi_ap_disable_if_sta", ap_disable_if_sta); + //sysparam_set_int8("wifi_ap_ssid_hidden", ssid_hidden); + //sysparam_set_int8("wifi_ap_dns", dns_enable); + //sysparam_set_int8("wifi_ap_mdns", mdns_enable); + } + cmd = 'A'; + break; + default: + printf("[websocket_callback]:\n%.*s\n", (int) data_len, (char *) data); + printf("Unknown command\n"); + val = 0; + break; + } + + response[2] = (uint8_t) val; + response[1] = val >> 8; + response[0] = cmd; + + websocket_write(pcb, response, 3, WS_BIN_MODE); + + if(data[0] == 'R') { // Restart + vTaskDelay(500 / portTICK_PERIOD_MS); + vPortEnterCritical(); + sdk_system_restart(); + } else if(data[0] == 'X') { // Clear Config + vTaskDelay(500 / portTICK_PERIOD_MS); + vPortEnterCritical(); + uint32_t num_sectors = 5 + DEFAULT_SYSPARAM_SECTORS; + uint32_t start = sdk_flashchip.chip_size - num_sectors * sdk_flashchip.sector_size; + for (uint32_t i = 0; i < num_sectors; i++) { + spiflash_erase_sector(start + i * sdk_flashchip.sector_size); + } + sdk_system_restart(); + } +} + +/** + * This function is called when new websocket is open and + * creates a new websocket_task if requested URI equals '/stream'. + */ +void websocket_open_cb(struct tcp_pcb *pcb, const char *uri) { + printf("WS URI: %s\n", uri); + if(!strcmp(uri, "/stream")) { + xTaskCreate(&websocket_task, "websocket_task", 512, (void *) pcb, 2, NULL); + } +} + +void httpd_task(void *pvParameters) { + tCGI pCGIs[] = { + {"/gpio", (tCGIHandler) gpio_cgi_handler}, + }; + + /* register handlers and start the server */ + http_set_cgi_handlers(pCGIs, sizeof(pCGIs) / sizeof(pCGIs[0])); + websocket_register_callbacks((tWsOpenHandler) websocket_open_cb, + (tWsHandler) websocket_cb); + httpd_init(); + + for (;;); +} + + +void sntp_task(void *pvParameters) { + const char *servers[] = {SNTP_SERVERS}; + UNUSED_ARG(pvParameters); + + /* Wait until we have joined AP and are assigned an IP */ + while (sdk_wifi_station_get_connect_status() != STATION_GOT_IP) { + vTaskDelayMs(100); + } + + /* Start SNTP */ + printf("Starting SNTP... "); + /* SNTP will request an update each 5 minutes */ + sntp_set_update_delay(5 * 60000); + /* Set GMT+1 zone, daylight savings off */ + const struct timezone tz = {1 * 60, 1}; + /* SNTP initialization */ + sntp_initialize(&tz); + /* Servers must be configured right after initialization */ + sntp_set_servers(servers, sizeof(servers) / sizeof(char *)); + printf("DONE!\n"); + + /* Print date and time each 5 seconds */ + while (1) { + vTaskDelayMs(5000); + //time_t ts = time(NULL); + //int t = ts; + //printf("TIME: %d %d %s", t,(int) day_seconds(), ctime(&ts)); + } +} + +static void dns_task(void *pvParameters) { + char *wifi_ap_ip_addr = NULL; + sysparam_get_string("wifi_ap_ip_addr", &wifi_ap_ip_addr); + if(!wifi_ap_ip_addr) { + printf("dns: no ip address\n"); + vTaskDelete(NULL); + } + ip4_addr_t server_addr; + server_addr.addr = ipaddr_addr(wifi_ap_ip_addr); + +#if LWIP_IPV6 + int fd = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); + struct sockaddr_in6 serv_addr; + memset(&serv_addr, '0', sizeof(serv_addr)); + serv_addr.sin6_family = AF_INET6; + serv_addr.sin6_port = htons(53); + serv_addr.sin6_flowinfo = 0; + serv_addr.sin6_addr = in6addr_any; + serv_addr.sin6_scope_id = IP6_NO_ZONE; +#else + int fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + struct sockaddr_in serv_addr; + memset(&serv_addr, '0', sizeof(serv_addr)); + serv_addr.sin_family = AF_INET; + serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); + serv_addr.sin_port = htons(53); +#endif + bind(fd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)); + + const struct ifreq ifreq0 = {"en0"}; + const struct ifreq ifreq1 = {"en1"}; + setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, + sdk_wifi_get_opmode() == STATIONAP_MODE ? &ifreq1 : &ifreq0, + sizeof(ifreq0)); + + for (;;) { + char buffer[96]; + struct sockaddr_storage src_addr; + socklen_t src_addr_len = sizeof(src_addr); + ssize_t count = recvfrom(fd, buffer, sizeof(buffer), 0, (struct sockaddr *) &src_addr, &src_addr_len); + + /* Drop messages that are too large to send a response in the buffer */ + if(count > 0 && count <= sizeof(buffer) - 16) { + size_t qname_len = strlen(buffer + 12) + 1; + uint32_t reply_len = 2 + 10 + qname_len + 16 + 4; + + char *head = buffer + 2; + *head++ = 0x80; // Flags + *head++ = 0x00; + *head++ = 0x00; // Q count + *head++ = 0x01; + *head++ = 0x00; // A count + *head++ = 0x01; + *head++ = 0x00; // Auth count + *head++ = 0x00; + *head++ = 0x00; // Add count + *head++ = 0x00; + head += qname_len; + *head++ = 0x00; // Q type + *head++ = 0x01; + *head++ = 0x00; // Q class + *head++ = 0x01; + *head++ = 0xC0; // LBL offs + *head++ = 0x0C; + *head++ = 0x00; // Type + *head++ = 0x01; + *head++ = 0x00; // Class + *head++ = 0x01; + *head++ = 0x00; // TTL + *head++ = 0x00; + *head++ = 0x00; + *head++ = 0x78; + *head++ = 0x00; // RD len + *head++ = 0x04; + *head++ = ip4_addr1(&server_addr); + *head++ = ip4_addr2(&server_addr); + *head++ = ip4_addr3(&server_addr); + *head++ = ip4_addr4(&server_addr); + + sendto(fd, buffer, reply_len, 0, (struct sockaddr *) &src_addr, src_addr_len); + } + } +} + + +const char *wificfg_default_ssid = "fiatlux_%02X%02X%02X"; +const char *wificfg_default_password = "fiatlux02"; +const char *wificfg_default_hostname = "fiatlux-%02x%02x%02x"; + +void user_init(void) { uart_set_baud(0, 115200); printf("SDK version: %s\n", sdk_system_get_sdk_version()); sdk_wifi_set_sleep_type(WIFI_SLEEP_MODEM); system_init_config(); + char *wifi_sta_ssid = NULL; + char *wifi_sta_password = NULL; + char *wifi_ap_ssid = NULL; + char *wifi_ap_password = NULL; + + /* Default a hostname. */ + char *hostname = NULL; + sysparam_get_string("hostname", &hostname); + if(!hostname && wificfg_default_hostname) { + uint8_t macaddr[6]; + char name[32]; + sdk_wifi_get_macaddr(1, macaddr); + snprintf(name, sizeof(name), wificfg_default_hostname, macaddr[3], + macaddr[4], macaddr[5]); + sysparam_set_string("hostname", name); + } + if(hostname) { + free(hostname); + } + + sysparam_get_string("wifi_ap_ssid", &wifi_ap_ssid); + sysparam_get_string("wifi_ap_password", &wifi_ap_password); + sysparam_get_string("wifi_sta_ssid", &wifi_sta_ssid); + sysparam_get_string("wifi_sta_password", &wifi_sta_password); + + int8_t wifi_sta_enable = 1; + int8_t wifi_ap_enable = 1; + sysparam_get_int8("wifi_sta_enable", &wifi_sta_enable); + sysparam_get_int8("wifi_ap_enable", &wifi_ap_enable); + + if(!wifi_sta_enable) + wifi_ap_enable = 1; + + int8_t wifi_sta_disabled_restarts = 0; + sysparam_get_int8("wifi_sta_disabled_restarts", &wifi_sta_disabled_restarts); + if(wifi_sta_disabled_restarts > 0) { + wifi_sta_enable = 0; + wifi_sta_disabled_restarts--; + sysparam_set_int8("wifi_sta_disabled_restarts", wifi_sta_disabled_restarts); + } + + int8_t wifi_ap_disabled_restarts = 0; + sysparam_get_int8("wifi_ap_disabled_restarts", &wifi_ap_disabled_restarts); + if(wifi_ap_disabled_restarts > 0) { + wifi_ap_enable = 0; + wifi_ap_disabled_restarts--; + sysparam_set_int8("wifi_ap_disabled_restarts", wifi_ap_disabled_restarts); + } + + /* Validate the configuration. */ + + if(wifi_sta_enable && (!wifi_sta_ssid || !wifi_sta_password || + strlen(wifi_sta_ssid) < 1 || + strlen(wifi_sta_ssid) > 32 || + !wifi_sta_password || + strlen(wifi_sta_password) < 8 || + strlen(wifi_sta_password) >= 64)) { + wifi_sta_enable = 0; + } + + if(wifi_ap_enable) { + /* Default AP ssid and password. */ + if(!wifi_ap_ssid && wificfg_default_ssid) { + uint8_t macaddr[6]; + char ssid[32]; + sdk_wifi_get_macaddr(1, macaddr); + snprintf(ssid, sizeof(ssid), wificfg_default_ssid, macaddr[3], + macaddr[4], macaddr[5]); + sysparam_set_string("wifi_ap_ssid", ssid); + sysparam_get_string("wifi_ap_ssid", &wifi_ap_ssid); + + if(!wifi_ap_password && wificfg_default_password) { + sysparam_set_string("wifi_ap_password", wificfg_default_password); + sysparam_get_string("wifi_ap_password", &wifi_ap_password); + } + } + printf("ssid: %s\n", wifi_ap_ssid); + + /* If the ssid and password are not valid then disable the AP interface. */ + if(!wifi_ap_ssid || strlen(wifi_ap_ssid) < 1 || strlen(wifi_ap_ssid) >= 32 || + !wifi_ap_password || strlen(wifi_ap_password) < 8 || strlen(wifi_ap_password) >= 64) { + printf("len err\n"); + wifi_ap_enable = 0; + } + } + + int8_t wifi_mode = NULL_MODE; + if(wifi_sta_enable && wifi_ap_enable) + wifi_mode = STATIONAP_MODE; + else if(wifi_sta_enable) + wifi_mode = STATION_MODE; + else if(wifi_ap_enable) + wifi_mode = SOFTAP_MODE; + sdk_wifi_set_opmode(wifi_mode); + + if(wifi_sta_enable) { + printf("try STA Mode\n"); + struct sdk_station_config config; + strcpy((char *) config.ssid, wifi_sta_ssid); + strcpy((char *) config.password, wifi_sta_password); + config.bssid_set = 0; + + int8_t wifi_sta_dhcp = 1; + sysparam_get_int8("wifi_sta_dhcp", &wifi_sta_dhcp); + + if(!wifi_sta_dhcp) { + char *wifi_sta_ip_addr = NULL; + char *wifi_sta_netmask = NULL; + char *wifi_sta_gateway = NULL; + sysparam_get_string("wifi_sta_ip_addr", &wifi_sta_ip_addr); + sysparam_get_string("wifi_sta_netmask", &wifi_sta_netmask); + sysparam_get_string("wifi_sta_gateway", &wifi_sta_gateway); + + if(wifi_sta_ip_addr && strlen(wifi_sta_ip_addr) > 4 && + wifi_sta_netmask && strlen(wifi_sta_netmask) > 4 && + wifi_sta_gateway && strlen(wifi_sta_gateway) > 4) { + sdk_wifi_station_dhcpc_stop(); + struct ip_info info; + memset(&info, 0x0, sizeof(info)); + info.ip.addr = ipaddr_addr(wifi_sta_ip_addr); + info.netmask.addr = ipaddr_addr(wifi_sta_netmask); + info.gw.addr = ipaddr_addr(wifi_sta_gateway); + sdk_wifi_set_ip_info(STATION_IF, &info); + } + if(wifi_sta_ip_addr) free(wifi_sta_ip_addr); + if(wifi_sta_netmask) free(wifi_sta_netmask); + if(wifi_sta_gateway) free(wifi_sta_gateway); + } + + sdk_wifi_station_set_config(&config); + } + + if(wifi_ap_enable) { + printf("try AP Mode\n"); + /* Read and validate paramenters. */ + int8_t wifi_ap_ssid_hidden = 0; + sysparam_get_int8("wifi_ap_ssid_hidden", &wifi_ap_ssid_hidden); + if(wifi_ap_ssid_hidden < 0 || wifi_ap_ssid_hidden > 1) { + wifi_ap_ssid_hidden = 1; + } + + int8_t wifi_ap_channel = 6; + sysparam_get_int8("wifi_ap_channel", &wifi_ap_channel); + + +#if 0 + /* AU does not allow channels above 13, although 14 works. */ + if(wifi_ap_channel > 13) { + wifi_ap_channel = 13; + } + /* US does not allow channels above 11, although they work. */ + if (wifi_ap_channel > 11) { + wifi_ap_channel = 11; + } +#endif + if(wifi_ap_channel < 1 || wifi_ap_channel > 14) { + wifi_ap_channel = 6; + } + + int8_t wifi_ap_authmode = AUTH_WPA_WPA2_PSK; + sysparam_get_int8("wifi_ap_authmode", &wifi_ap_authmode); + if(wifi_ap_authmode != AUTH_OPEN && wifi_ap_authmode != AUTH_WPA_PSK && + wifi_ap_authmode != AUTH_WPA2_PSK && wifi_ap_authmode != AUTH_WPA_WPA2_PSK) { + wifi_ap_authmode = AUTH_WPA_WPA2_PSK; + } + + int8_t wifi_ap_max_conn = 3; + sysparam_get_int8("wifi_ap_max_conn", &wifi_ap_max_conn); + if(wifi_ap_max_conn < 1 || wifi_ap_max_conn > 8) { + wifi_ap_max_conn = 3; + } + + int32_t wifi_ap_beacon_interval = 100; + sysparam_get_int32("wifi_ap_beacon_interval", &wifi_ap_beacon_interval); + if(wifi_ap_beacon_interval < 0 || wifi_ap_beacon_interval > 1000) { + wifi_ap_beacon_interval = 100; + } + + /* Default AP IP address and netmask. */ + char *wifi_ap_ip_addr = NULL; + sysparam_get_string("wifi_ap_ip_addr", &wifi_ap_ip_addr); + if(!wifi_ap_ip_addr) { + sysparam_set_string("wifi_ap_ip_addr", "172.16.0.1"); + sysparam_get_string("wifi_ap_ip_addr", &wifi_ap_ip_addr); + } + char *wifi_ap_netmask = NULL; + sysparam_get_string("wifi_ap_netmask", &wifi_ap_netmask); + if(!wifi_ap_netmask) { + sysparam_set_string("wifi_ap_netmask", "255.255.0.0"); + sysparam_get_string("wifi_ap_netmask", &wifi_ap_netmask); + } + + if(strlen(wifi_ap_ip_addr) >= 7 && strlen(wifi_ap_netmask) >= 7) { + struct ip_info ap_ip; + ap_ip.ip.addr = ipaddr_addr(wifi_ap_ip_addr); + ap_ip.netmask.addr = ipaddr_addr(wifi_ap_netmask); + IP4_ADDR(&ap_ip.gw, 0, 0, 0, 0); + sdk_wifi_set_ip_info(1, &ap_ip); + + struct sdk_softap_config ap_config = { + .ssid_hidden = wifi_ap_ssid_hidden, + .channel = wifi_ap_channel, + .authmode = wifi_ap_authmode, + .max_connection = wifi_ap_max_conn, + .beacon_interval = wifi_ap_beacon_interval, + }; + strcpy((char *) ap_config.ssid, wifi_ap_ssid); + ap_config.ssid_len = strlen(wifi_ap_ssid); + strcpy((char *) ap_config.password, wifi_ap_password); + sdk_wifi_softap_set_config(&ap_config); + + int8_t wifi_ap_dhcp_leases = 4; + sysparam_get_int8("wifi_ap_dhcp_leases", &wifi_ap_dhcp_leases); + + if(wifi_ap_dhcp_leases) { + ip4_addr_t first_client_ip; + first_client_ip.addr = ap_ip.ip.addr + htonl(1); + + int8_t wifi_ap_dns = 1; + sysparam_get_int8("wifi_ap_dns", &wifi_ap_dns); + if(wifi_ap_dns < 0 || wifi_ap_dns > 1) + wifi_ap_dns = 1; + + dhcpserver_start(&first_client_ip, wifi_ap_dhcp_leases); + dhcpserver_set_router(&ap_ip.ip); + if(wifi_ap_dns) { + dhcpserver_set_dns(&ap_ip.ip); + xTaskCreate(dns_task, "WiFi Cfg DNS", 384, NULL, 2, NULL); + } + } + } + + free(wifi_ap_ip_addr); + free(wifi_ap_netmask); + } + + if(wifi_sta_ssid) free(wifi_sta_ssid); + if(wifi_sta_password) free(wifi_sta_password); + if(wifi_ap_ssid) free(wifi_ap_ssid); + if(wifi_ap_password) free(wifi_ap_password); + + if(wifi_mode != NULL_MODE) { + + /* turn off LED */ + //gpio_enable(LED_PIN, GPIO_OUTPUT); + //gpio_write(LED_PIN, true); + xTaskCreate(blinkenTask, "blinkenTask", 256, NULL, 2, NULL); + + /* initialize tasks */ + xTaskCreate(&httpd_task, "HTTP Daemon", 2048, NULL, 2, NULL); + + xTaskCreate(&sntp_task, "SNTP", 512, NULL, 1, NULL); + } +>>>>>>> 4b8d354 (basic webconf) } diff --git a/firmware/fsdata/fs/css/picnic.min.css b/firmware/fsdata/fs/css/picnic.min.css new file mode 100644 index 0000000..7daf65a --- /dev/null +++ b/firmware/fsdata/fs/css/picnic.min.css @@ -0,0 +1 @@ +html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}h1{font-size:2em;margin:0.67em 0}mark{background:#fff;color:#111}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace, monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:0;padding:0}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:bold}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}*{box-sizing:inherit}html,body{font-family:Arial, Helvetica, sans-serif;box-sizing:border-box;height:100%}body{color:#111;font-size:1.1em;line-height:1.5;background:#fff}main{display:block}h1,h2,h3,h4,h5,h6{margin:0;padding:.6em 0}li{margin:0 0 .3em}a{color:#0074d9;text-decoration:none;box-shadow:none;transition:all 0.3s}code{padding:.3em .6em;font-size:.8em;background:#f5f5f5}pre{text-align:left;padding:.3em .6em;background:#f5f5f5;border-radius:.2em}pre code{padding:0}blockquote{padding:0 0 0 1em;margin:0 0 0 .1em;box-shadow:inset 5px 0 rgba(17,17,17,0.3)}label{cursor:pointer}[class^="icon-"]:before,[class*=" icon-"]:before{margin:0 .6em 0 0}i[class^="icon-"]:before,i[class*=" icon-"]:before{margin:0}.label,[data-tooltip]:after,button,.button,[type=submit],.dropimage{display:inline-block;text-align:center;letter-spacing:inherit;margin:0;padding:.3em .9em;vertical-align:middle;background:#0074d9;color:#fff;border:0;border-radius:.2em;width:auto;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.success.label,.success[data-tooltip]:after,button.success,.success.button,.success[type=submit],.success.dropimage{background:#2ecc40}.warning.label,.warning[data-tooltip]:after,button.warning,.warning.button,.warning[type=submit],.warning.dropimage{background:#ff851b}.error.label,.error[data-tooltip]:after,button.error,.error.button,.error[type=submit],.error.dropimage{background:#ff4136}.pseudo.label,.pseudo[data-tooltip]:after,button.pseudo,.pseudo.button,.pseudo[type=submit],.pseudo.dropimage{background-color:transparent;color:inherit}.label,[data-tooltip]:after{font-size:.6em;padding:.4em .6em;margin-left:1em;line-height:1}button,.button,[type=submit],.dropimage{margin:.3em 0;cursor:pointer;transition:all 0.3s;border-radius:.2em;height:auto;vertical-align:baseline;box-shadow:0 0 rgba(17,17,17,0) inset}button:hover,.button:hover,:hover[type=submit],.dropimage:hover,button:focus,.button:focus,:focus[type=submit],.dropimage:focus{box-shadow:inset 0 0 0 99em rgba(255,255,255,0.2);border:0}button.pseudo:hover,.pseudo.button:hover,.pseudo:hover[type=submit],.pseudo.dropimage:hover,button.pseudo:focus,.pseudo.button:focus,.pseudo:focus[type=submit],.pseudo.dropimage:focus{box-shadow:inset 0 0 0 99em rgba(17,17,17,0.1)}button.active,.active.button,.active[type=submit],.active.dropimage,button:active,.button:active,:active[type=submit],.dropimage:active,button.pseudo:active,.pseudo.button:active,.pseudo:active[type=submit],.pseudo.dropimage:active{box-shadow:inset 0 0 0 99em rgba(17,17,17,0.2)}button[disabled],.button[disabled],[disabled][type=submit],.dropimage[disabled]{cursor:default;box-shadow:none;background:#aaa}:checked+.toggle,:checked+.toggle:hover{box-shadow:inset 0 0 0 99em rgba(17,17,17,0.2)}[type]+.toggle{padding:.3em .9em;margin-right:0}[type]+.toggle:after,[type]+.toggle:before{display:none}input,textarea,.select select{line-height:1.5;margin:0;height:2.1em;padding:.3em .6em;border:1px solid #aaa;background-color:#fff;border-radius:.2em;transition:all 0.3s;width:100%}input:focus,textarea:focus,.select select:focus{border:1px solid #0074d9;outline:0}textarea{height:auto}[type=file],[type=color]{cursor:pointer}[type=file]{height:auto}select{background:#fff url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyIiBoZWlnaHQ9IjMiPjxwYXRoIGQ9Im0gMCwxIDEsMiAxLC0yIHoiLz48L3N2Zz4=) no-repeat scroll 95% center/10px 15px;background-position:calc(100% - 15px) center;border:1px solid #aaa;border-radius:.2em;cursor:pointer;width:100%;height:2.2em;box-sizing:border-box;padding:.3em .45em;transition:all 0.3s;-moz-appearance:none;-webkit-appearance:none;appearance:none}select::-ms-expand{display:none}select:focus,select:active{border:1px solid #0074d9;transition:outline 0s}select:-moz-focusring{color:transparent;text-shadow:0 0 0 #111}select option{font-size:inherit;padding:.45em}select[multiple]{height:auto;background:none;padding:0}[type=radio],[type=checkbox]{opacity:0;width:0;position:absolute;display:inline-block}[type=radio]+.checkable:hover:before,[type=checkbox]+.checkable:hover:before,:focus[type=radio]+.checkable:before,:focus[type=checkbox]+.checkable:before{border:1px solid #0074d9}[type=radio]+.checkable,[type=checkbox]+.checkable{position:relative;cursor:pointer;padding-left:1.5em;margin-right:.6em}[type=radio]+.checkable:before,[type=checkbox]+.checkable:before,[type=radio]+.checkable:after,[type=checkbox]+.checkable:after{content:'';position:absolute;display:inline-block;left:0;top:50%;transform:translateY(-50%);font-size:1em;line-height:1em;color:transparent;font-family:sans;text-align:center;box-sizing:border-box;width:1em;height:1em;border-radius:50%;transition:all 0.3s}[type=radio]+.checkable:before,[type=checkbox]+.checkable:before{border:1px solid #aaa}:checked[type=radio]+.checkable:after,:checked[type=checkbox]+.checkable:after{background:#111;transform:scale(0.5) translateY(-100%)}[type=checkbox]+.checkable:before{border-radius:.2em}[type=checkbox]+.checkable:after{content:"✔";background:none;transform:scale(2) translateY(-25%);visibility:hidden;opacity:0}:checked[type=checkbox]+.checkable:after{color:#111;background:none;transform:translateY(-50%);transition:all 0.3s;visibility:visible;opacity:1}table{text-align:left}td,th{padding:.3em 2.4em .3em .6em}th{text-align:left;font-weight:900;color:#fff;background-color:#0074d9}.success th{background-color:#2ecc40}.warning th{background-color:#ff851b}.error th{background-color:#ff4136}.dull th{background-color:#aaa}tr:nth-child(even){background:rgba(17,17,17,0.05)}.flex{display:-ms-flexbox;display:flex;margin-left:-.6em;width:calc(100% + .6em);flex-wrap:wrap;transition:all .3s ease}.flex>*{box-sizing:border-box;flex:1 1 auto;padding-left:.6em;padding-bottom:.6em}.flex[class*="one"]>*,.flex[class*="two"]>*,.flex[class*="three"]>*,.flex[class*="four"]>*,.flex[class*="five"]>*,.flex[class*="six"]>*,.flex[class*="seven"]>*,.flex[class*="eight"]>*,.flex[class*="nine"]>*,.flex[class*="ten"]>*,.flex[class*="eleven"]>*,.flex[class*="twelve"]>*{flex-grow:0}.flex.grow>*{flex-grow:1}.center{justify-content:center}.one>*{width:100%}.two>*{width:50%}.three>*{width:33.33333%}.four>*{width:25%}.five>*{width:20%}.six>*{width:16.66666%}.seven>*{width:14.28571%}.eight>*{width:12.5%}.nine>*{width:11.11111%}.ten>*{width:10%}.eleven>*{width:9.09091%}.twelve>*{width:8.33333%}@media all and (min-width: 500px){.one-500>*{width:100%}.two-500>*{width:50%}.three-500>*{width:33.33333%}.four-500>*{width:25%}.five-500>*{width:20%}.six-500>*{width:16.66666%}.seven-500>*{width:14.28571%}.eight-500>*{width:12.5%}.nine-500>*{width:11.11111%}.ten-500>*{width:10%}.eleven-500>*{width:9.09091%}.twelve-500>*{width:8.33333%}}@media all and (min-width: 600px){.one-600>*{width:100%}.two-600>*{width:50%}.three-600>*{width:33.33333%}.four-600>*{width:25%}.five-600>*{width:20%}.six-600>*{width:16.66666%}.seven-600>*{width:14.28571%}.eight-600>*{width:12.5%}.nine-600>*{width:11.11111%}.ten-600>*{width:10%}.eleven-600>*{width:9.09091%}.twelve-600>*{width:8.33333%}}@media all and (min-width: 700px){.one-700>*{width:100%}.two-700>*{width:50%}.three-700>*{width:33.33333%}.four-700>*{width:25%}.five-700>*{width:20%}.six-700>*{width:16.66666%}.seven-700>*{width:14.28571%}.eight-700>*{width:12.5%}.nine-700>*{width:11.11111%}.ten-700>*{width:10%}.eleven-700>*{width:9.09091%}.twelve-700>*{width:8.33333%}}@media all and (min-width: 800px){.one-800>*{width:100%}.two-800>*{width:50%}.three-800>*{width:33.33333%}.four-800>*{width:25%}.five-800>*{width:20%}.six-800>*{width:16.66666%}.seven-800>*{width:14.28571%}.eight-800>*{width:12.5%}.nine-800>*{width:11.11111%}.ten-800>*{width:10%}.eleven-800>*{width:9.09091%}.twelve-800>*{width:8.33333%}}@media all and (min-width: 900px){.one-900>*{width:100%}.two-900>*{width:50%}.three-900>*{width:33.33333%}.four-900>*{width:25%}.five-900>*{width:20%}.six-900>*{width:16.66666%}.seven-900>*{width:14.28571%}.eight-900>*{width:12.5%}.nine-900>*{width:11.11111%}.ten-900>*{width:10%}.eleven-900>*{width:9.09091%}.twelve-900>*{width:8.33333%}}@media all and (min-width: 1000px){.one-1000>*{width:100%}.two-1000>*{width:50%}.three-1000>*{width:33.33333%}.four-1000>*{width:25%}.five-1000>*{width:20%}.six-1000>*{width:16.66666%}.seven-1000>*{width:14.28571%}.eight-1000>*{width:12.5%}.nine-1000>*{width:11.11111%}.ten-1000>*{width:10%}.eleven-1000>*{width:9.09091%}.twelve-1000>*{width:8.33333%}}@media all and (min-width: 1100px){.one-1100>*{width:100%}.two-1100>*{width:50%}.three-1100>*{width:33.33333%}.four-1100>*{width:25%}.five-1100>*{width:20%}.six-1100>*{width:16.66666%}.seven-1100>*{width:14.28571%}.eight-1100>*{width:12.5%}.nine-1100>*{width:11.11111%}.ten-1100>*{width:10%}.eleven-1100>*{width:9.09091%}.twelve-1100>*{width:8.33333%}}@media all and (min-width: 1200px){.one-1200>*{width:100%}.two-1200>*{width:50%}.three-1200>*{width:33.33333%}.four-1200>*{width:25%}.five-1200>*{width:20%}.six-1200>*{width:16.66666%}.seven-1200>*{width:14.28571%}.eight-1200>*{width:12.5%}.nine-1200>*{width:11.11111%}.ten-1200>*{width:10%}.eleven-1200>*{width:9.09091%}.twelve-1200>*{width:8.33333%}}@media all and (min-width: 1300px){.one-1300>*{width:100%}.two-1300>*{width:50%}.three-1300>*{width:33.33333%}.four-1300>*{width:25%}.five-1300>*{width:20%}.six-1300>*{width:16.66666%}.seven-1300>*{width:14.28571%}.eight-1300>*{width:12.5%}.nine-1300>*{width:11.11111%}.ten-1300>*{width:10%}.eleven-1300>*{width:9.09091%}.twelve-1300>*{width:8.33333%}}@media all and (min-width: 1400px){.one-1400>*{width:100%}.two-1400>*{width:50%}.three-1400>*{width:33.33333%}.four-1400>*{width:25%}.five-1400>*{width:20%}.six-1400>*{width:16.66666%}.seven-1400>*{width:14.28571%}.eight-1400>*{width:12.5%}.nine-1400>*{width:11.11111%}.ten-1400>*{width:10%}.eleven-1400>*{width:9.09091%}.twelve-1400>*{width:8.33333%}}@media all and (min-width: 1500px){.one-1500>*{width:100%}.two-1500>*{width:50%}.three-1500>*{width:33.33333%}.four-1500>*{width:25%}.five-1500>*{width:20%}.six-1500>*{width:16.66666%}.seven-1500>*{width:14.28571%}.eight-1500>*{width:12.5%}.nine-1500>*{width:11.11111%}.ten-1500>*{width:10%}.eleven-1500>*{width:9.09091%}.twelve-1500>*{width:8.33333%}}@media all and (min-width: 1600px){.one-1600>*{width:100%}.two-1600>*{width:50%}.three-1600>*{width:33.33333%}.four-1600>*{width:25%}.five-1600>*{width:20%}.six-1600>*{width:16.66666%}.seven-1600>*{width:14.28571%}.eight-1600>*{width:12.5%}.nine-1600>*{width:11.11111%}.ten-1600>*{width:10%}.eleven-1600>*{width:9.09091%}.twelve-1600>*{width:8.33333%}}@media all and (min-width: 1700px){.one-1700>*{width:100%}.two-1700>*{width:50%}.three-1700>*{width:33.33333%}.four-1700>*{width:25%}.five-1700>*{width:20%}.six-1700>*{width:16.66666%}.seven-1700>*{width:14.28571%}.eight-1700>*{width:12.5%}.nine-1700>*{width:11.11111%}.ten-1700>*{width:10%}.eleven-1700>*{width:9.09091%}.twelve-1700>*{width:8.33333%}}@media all and (min-width: 1800px){.one-1800>*{width:100%}.two-1800>*{width:50%}.three-1800>*{width:33.33333%}.four-1800>*{width:25%}.five-1800>*{width:20%}.six-1800>*{width:16.66666%}.seven-1800>*{width:14.28571%}.eight-1800>*{width:12.5%}.nine-1800>*{width:11.11111%}.ten-1800>*{width:10%}.eleven-1800>*{width:9.09091%}.twelve-1800>*{width:8.33333%}}@media all and (min-width: 1900px){.one-1900>*{width:100%}.two-1900>*{width:50%}.three-1900>*{width:33.33333%}.four-1900>*{width:25%}.five-1900>*{width:20%}.six-1900>*{width:16.66666%}.seven-1900>*{width:14.28571%}.eight-1900>*{width:12.5%}.nine-1900>*{width:11.11111%}.ten-1900>*{width:10%}.eleven-1900>*{width:9.09091%}.twelve-1900>*{width:8.33333%}}@media all and (min-width: 2000px){.one-2000>*{width:100%}.two-2000>*{width:50%}.three-2000>*{width:33.33333%}.four-2000>*{width:25%}.five-2000>*{width:20%}.six-2000>*{width:16.66666%}.seven-2000>*{width:14.28571%}.eight-2000>*{width:12.5%}.nine-2000>*{width:11.11111%}.ten-2000>*{width:10%}.eleven-2000>*{width:9.09091%}.twelve-2000>*{width:8.33333%}}.full{width:100%}.half{width:50%}.third{width:33.33333%}.two-third{width:66.66666%}.fourth{width:25%}.three-fourth{width:75%}.fifth{width:20%}.two-fifth{width:40%}.three-fifth{width:60%}.four-fifth{width:80%}.sixth{width:16.66666%}.none{display:none}@media all and (min-width: 500px){.full-500{width:100%;display:block}.half-500{width:50%;display:block}.third-500{width:33.33333%;display:block}.two-third-500{width:66.66666%;display:block}.fourth-500{width:25%;display:block}.three-fourth-500{width:75%;display:block}.fifth-500{width:20%;display:block}.two-fifth-500{width:40%;display:block}.three-fifth-500{width:60%;display:block}.four-fifth-500{width:80%;display:block}.sixth-500{width:16.66666%;display:block}}@media all and (min-width: 600px){.full-600{width:100%;display:block}.half-600{width:50%;display:block}.third-600{width:33.33333%;display:block}.two-third-600{width:66.66666%;display:block}.fourth-600{width:25%;display:block}.three-fourth-600{width:75%;display:block}.fifth-600{width:20%;display:block}.two-fifth-600{width:40%;display:block}.three-fifth-600{width:60%;display:block}.four-fifth-600{width:80%;display:block}.sixth-600{width:16.66666%;display:block}}@media all and (min-width: 700px){.full-700{width:100%;display:block}.half-700{width:50%;display:block}.third-700{width:33.33333%;display:block}.two-third-700{width:66.66666%;display:block}.fourth-700{width:25%;display:block}.three-fourth-700{width:75%;display:block}.fifth-700{width:20%;display:block}.two-fifth-700{width:40%;display:block}.three-fifth-700{width:60%;display:block}.four-fifth-700{width:80%;display:block}.sixth-700{width:16.66666%;display:block}}@media all and (min-width: 800px){.full-800{width:100%;display:block}.half-800{width:50%;display:block}.third-800{width:33.33333%;display:block}.two-third-800{width:66.66666%;display:block}.fourth-800{width:25%;display:block}.three-fourth-800{width:75%;display:block}.fifth-800{width:20%;display:block}.two-fifth-800{width:40%;display:block}.three-fifth-800{width:60%;display:block}.four-fifth-800{width:80%;display:block}.sixth-800{width:16.66666%;display:block}}@media all and (min-width: 900px){.full-900{width:100%;display:block}.half-900{width:50%;display:block}.third-900{width:33.33333%;display:block}.two-third-900{width:66.66666%;display:block}.fourth-900{width:25%;display:block}.three-fourth-900{width:75%;display:block}.fifth-900{width:20%;display:block}.two-fifth-900{width:40%;display:block}.three-fifth-900{width:60%;display:block}.four-fifth-900{width:80%;display:block}.sixth-900{width:16.66666%;display:block}}@media all and (min-width: 1000px){.full-1000{width:100%;display:block}.half-1000{width:50%;display:block}.third-1000{width:33.33333%;display:block}.two-third-1000{width:66.66666%;display:block}.fourth-1000{width:25%;display:block}.three-fourth-1000{width:75%;display:block}.fifth-1000{width:20%;display:block}.two-fifth-1000{width:40%;display:block}.three-fifth-1000{width:60%;display:block}.four-fifth-1000{width:80%;display:block}.sixth-1000{width:16.66666%;display:block}}@media all and (min-width: 1100px){.full-1100{width:100%;display:block}.half-1100{width:50%;display:block}.third-1100{width:33.33333%;display:block}.two-third-1100{width:66.66666%;display:block}.fourth-1100{width:25%;display:block}.three-fourth-1100{width:75%;display:block}.fifth-1100{width:20%;display:block}.two-fifth-1100{width:40%;display:block}.three-fifth-1100{width:60%;display:block}.four-fifth-1100{width:80%;display:block}.sixth-1100{width:16.66666%;display:block}}@media all and (min-width: 1200px){.full-1200{width:100%;display:block}.half-1200{width:50%;display:block}.third-1200{width:33.33333%;display:block}.two-third-1200{width:66.66666%;display:block}.fourth-1200{width:25%;display:block}.three-fourth-1200{width:75%;display:block}.fifth-1200{width:20%;display:block}.two-fifth-1200{width:40%;display:block}.three-fifth-1200{width:60%;display:block}.four-fifth-1200{width:80%;display:block}.sixth-1200{width:16.66666%;display:block}}@media all and (min-width: 1300px){.full-1300{width:100%;display:block}.half-1300{width:50%;display:block}.third-1300{width:33.33333%;display:block}.two-third-1300{width:66.66666%;display:block}.fourth-1300{width:25%;display:block}.three-fourth-1300{width:75%;display:block}.fifth-1300{width:20%;display:block}.two-fifth-1300{width:40%;display:block}.three-fifth-1300{width:60%;display:block}.four-fifth-1300{width:80%;display:block}.sixth-1300{width:16.66666%;display:block}}@media all and (min-width: 1400px){.full-1400{width:100%;display:block}.half-1400{width:50%;display:block}.third-1400{width:33.33333%;display:block}.two-third-1400{width:66.66666%;display:block}.fourth-1400{width:25%;display:block}.three-fourth-1400{width:75%;display:block}.fifth-1400{width:20%;display:block}.two-fifth-1400{width:40%;display:block}.three-fifth-1400{width:60%;display:block}.four-fifth-1400{width:80%;display:block}.sixth-1400{width:16.66666%;display:block}}@media all and (min-width: 1500px){.full-1500{width:100%;display:block}.half-1500{width:50%;display:block}.third-1500{width:33.33333%;display:block}.two-third-1500{width:66.66666%;display:block}.fourth-1500{width:25%;display:block}.three-fourth-1500{width:75%;display:block}.fifth-1500{width:20%;display:block}.two-fifth-1500{width:40%;display:block}.three-fifth-1500{width:60%;display:block}.four-fifth-1500{width:80%;display:block}.sixth-1500{width:16.66666%;display:block}}@media all and (min-width: 1600px){.full-1600{width:100%;display:block}.half-1600{width:50%;display:block}.third-1600{width:33.33333%;display:block}.two-third-1600{width:66.66666%;display:block}.fourth-1600{width:25%;display:block}.three-fourth-1600{width:75%;display:block}.fifth-1600{width:20%;display:block}.two-fifth-1600{width:40%;display:block}.three-fifth-1600{width:60%;display:block}.four-fifth-1600{width:80%;display:block}.sixth-1600{width:16.66666%;display:block}}@media all and (min-width: 1700px){.full-1700{width:100%;display:block}.half-1700{width:50%;display:block}.third-1700{width:33.33333%;display:block}.two-third-1700{width:66.66666%;display:block}.fourth-1700{width:25%;display:block}.three-fourth-1700{width:75%;display:block}.fifth-1700{width:20%;display:block}.two-fifth-1700{width:40%;display:block}.three-fifth-1700{width:60%;display:block}.four-fifth-1700{width:80%;display:block}.sixth-1700{width:16.66666%;display:block}}@media all and (min-width: 1800px){.full-1800{width:100%;display:block}.half-1800{width:50%;display:block}.third-1800{width:33.33333%;display:block}.two-third-1800{width:66.66666%;display:block}.fourth-1800{width:25%;display:block}.three-fourth-1800{width:75%;display:block}.fifth-1800{width:20%;display:block}.two-fifth-1800{width:40%;display:block}.three-fifth-1800{width:60%;display:block}.four-fifth-1800{width:80%;display:block}.sixth-1800{width:16.66666%;display:block}}@media all and (min-width: 1900px){.full-1900{width:100%;display:block}.half-1900{width:50%;display:block}.third-1900{width:33.33333%;display:block}.two-third-1900{width:66.66666%;display:block}.fourth-1900{width:25%;display:block}.three-fourth-1900{width:75%;display:block}.fifth-1900{width:20%;display:block}.two-fifth-1900{width:40%;display:block}.three-fifth-1900{width:60%;display:block}.four-fifth-1900{width:80%;display:block}.sixth-1900{width:16.66666%;display:block}}@media all and (min-width: 2000px){.full-2000{width:100%;display:block}.half-2000{width:50%;display:block}.third-2000{width:33.33333%;display:block}.two-third-2000{width:66.66666%;display:block}.fourth-2000{width:25%;display:block}.three-fourth-2000{width:75%;display:block}.fifth-2000{width:20%;display:block}.two-fifth-2000{width:40%;display:block}.three-fifth-2000{width:60%;display:block}.four-fifth-2000{width:80%;display:block}.sixth-2000{width:16.66666%;display:block}}@media all and (min-width: 500px){.none-500{display:none}}@media all and (min-width: 600px){.none-600{display:none}}@media all and (min-width: 700px){.none-700{display:none}}@media all and (min-width: 800px){.none-800{display:none}}@media all and (min-width: 900px){.none-900{display:none}}@media all and (min-width: 1000px){.none-1000{display:none}}@media all and (min-width: 1100px){.none-1100{display:none}}@media all and (min-width: 1200px){.none-1200{display:none}}@media all and (min-width: 1300px){.none-1300{display:none}}@media all and (min-width: 1400px){.none-1400{display:none}}@media all and (min-width: 1500px){.none-1500{display:none}}@media all and (min-width: 1600px){.none-1600{display:none}}@media all and (min-width: 1700px){.none-1700{display:none}}@media all and (min-width: 1800px){.none-1800{display:none}}@media all and (min-width: 1900px){.none-1900{display:none}}@media all and (min-width: 2000px){.none-2000{display:none}}.off-none{margin-left:0}.off-half{margin-left:50%}.off-third{margin-left:33.33333%}.off-two-third{margin-left:66.66666%}.off-fourth{margin-left:25%}.off-three-fourth{margin-left:75%}.off-fifth{margin-left:20%}.off-two-fifth{margin-left:40%}.off-three-fifth{margin-left:60%}.off-four-fifth{margin-left:80%}.off-sixth{margin-left:16.66666%}@media all and (min-width: 500px){.off-none-500{margin-left:0}.off-half-500{margin-left:50%}.off-third-500{margin-left:33.33333%}.off-two-third-500{margin-left:66.66666%}.off-fourth-500{margin-left:25%}.off-three-fourth-500{margin-left:75%}.off-fifth-500{margin-left:20%}.off-two-fifth-500{margin-left:40%}.off-three-fifth-500{margin-left:60%}.off-four-fifth-500{margin-left:80%}.off-sixth-500{margin-left:16.66666%}}@media all and (min-width: 600px){.off-none-600{margin-left:0}.off-half-600{margin-left:50%}.off-third-600{margin-left:33.33333%}.off-two-third-600{margin-left:66.66666%}.off-fourth-600{margin-left:25%}.off-three-fourth-600{margin-left:75%}.off-fifth-600{margin-left:20%}.off-two-fifth-600{margin-left:40%}.off-three-fifth-600{margin-left:60%}.off-four-fifth-600{margin-left:80%}.off-sixth-600{margin-left:16.66666%}}@media all and (min-width: 700px){.off-none-700{margin-left:0}.off-half-700{margin-left:50%}.off-third-700{margin-left:33.33333%}.off-two-third-700{margin-left:66.66666%}.off-fourth-700{margin-left:25%}.off-three-fourth-700{margin-left:75%}.off-fifth-700{margin-left:20%}.off-two-fifth-700{margin-left:40%}.off-three-fifth-700{margin-left:60%}.off-four-fifth-700{margin-left:80%}.off-sixth-700{margin-left:16.66666%}}@media all and (min-width: 800px){.off-none-800{margin-left:0}.off-half-800{margin-left:50%}.off-third-800{margin-left:33.33333%}.off-two-third-800{margin-left:66.66666%}.off-fourth-800{margin-left:25%}.off-three-fourth-800{margin-left:75%}.off-fifth-800{margin-left:20%}.off-two-fifth-800{margin-left:40%}.off-three-fifth-800{margin-left:60%}.off-four-fifth-800{margin-left:80%}.off-sixth-800{margin-left:16.66666%}}@media all and (min-width: 900px){.off-none-900{margin-left:0}.off-half-900{margin-left:50%}.off-third-900{margin-left:33.33333%}.off-two-third-900{margin-left:66.66666%}.off-fourth-900{margin-left:25%}.off-three-fourth-900{margin-left:75%}.off-fifth-900{margin-left:20%}.off-two-fifth-900{margin-left:40%}.off-three-fifth-900{margin-left:60%}.off-four-fifth-900{margin-left:80%}.off-sixth-900{margin-left:16.66666%}}@media all and (min-width: 1000px){.off-none-1000{margin-left:0}.off-half-1000{margin-left:50%}.off-third-1000{margin-left:33.33333%}.off-two-third-1000{margin-left:66.66666%}.off-fourth-1000{margin-left:25%}.off-three-fourth-1000{margin-left:75%}.off-fifth-1000{margin-left:20%}.off-two-fifth-1000{margin-left:40%}.off-three-fifth-1000{margin-left:60%}.off-four-fifth-1000{margin-left:80%}.off-sixth-1000{margin-left:16.66666%}}@media all and (min-width: 1100px){.off-none-1100{margin-left:0}.off-half-1100{margin-left:50%}.off-third-1100{margin-left:33.33333%}.off-two-third-1100{margin-left:66.66666%}.off-fourth-1100{margin-left:25%}.off-three-fourth-1100{margin-left:75%}.off-fifth-1100{margin-left:20%}.off-two-fifth-1100{margin-left:40%}.off-three-fifth-1100{margin-left:60%}.off-four-fifth-1100{margin-left:80%}.off-sixth-1100{margin-left:16.66666%}}@media all and (min-width: 1200px){.off-none-1200{margin-left:0}.off-half-1200{margin-left:50%}.off-third-1200{margin-left:33.33333%}.off-two-third-1200{margin-left:66.66666%}.off-fourth-1200{margin-left:25%}.off-three-fourth-1200{margin-left:75%}.off-fifth-1200{margin-left:20%}.off-two-fifth-1200{margin-left:40%}.off-three-fifth-1200{margin-left:60%}.off-four-fifth-1200{margin-left:80%}.off-sixth-1200{margin-left:16.66666%}}@media all and (min-width: 1300px){.off-none-1300{margin-left:0}.off-half-1300{margin-left:50%}.off-third-1300{margin-left:33.33333%}.off-two-third-1300{margin-left:66.66666%}.off-fourth-1300{margin-left:25%}.off-three-fourth-1300{margin-left:75%}.off-fifth-1300{margin-left:20%}.off-two-fifth-1300{margin-left:40%}.off-three-fifth-1300{margin-left:60%}.off-four-fifth-1300{margin-left:80%}.off-sixth-1300{margin-left:16.66666%}}@media all and (min-width: 1400px){.off-none-1400{margin-left:0}.off-half-1400{margin-left:50%}.off-third-1400{margin-left:33.33333%}.off-two-third-1400{margin-left:66.66666%}.off-fourth-1400{margin-left:25%}.off-three-fourth-1400{margin-left:75%}.off-fifth-1400{margin-left:20%}.off-two-fifth-1400{margin-left:40%}.off-three-fifth-1400{margin-left:60%}.off-four-fifth-1400{margin-left:80%}.off-sixth-1400{margin-left:16.66666%}}@media all and (min-width: 1500px){.off-none-1500{margin-left:0}.off-half-1500{margin-left:50%}.off-third-1500{margin-left:33.33333%}.off-two-third-1500{margin-left:66.66666%}.off-fourth-1500{margin-left:25%}.off-three-fourth-1500{margin-left:75%}.off-fifth-1500{margin-left:20%}.off-two-fifth-1500{margin-left:40%}.off-three-fifth-1500{margin-left:60%}.off-four-fifth-1500{margin-left:80%}.off-sixth-1500{margin-left:16.66666%}}@media all and (min-width: 1600px){.off-none-1600{margin-left:0}.off-half-1600{margin-left:50%}.off-third-1600{margin-left:33.33333%}.off-two-third-1600{margin-left:66.66666%}.off-fourth-1600{margin-left:25%}.off-three-fourth-1600{margin-left:75%}.off-fifth-1600{margin-left:20%}.off-two-fifth-1600{margin-left:40%}.off-three-fifth-1600{margin-left:60%}.off-four-fifth-1600{margin-left:80%}.off-sixth-1600{margin-left:16.66666%}}@media all and (min-width: 1700px){.off-none-1700{margin-left:0}.off-half-1700{margin-left:50%}.off-third-1700{margin-left:33.33333%}.off-two-third-1700{margin-left:66.66666%}.off-fourth-1700{margin-left:25%}.off-three-fourth-1700{margin-left:75%}.off-fifth-1700{margin-left:20%}.off-two-fifth-1700{margin-left:40%}.off-three-fifth-1700{margin-left:60%}.off-four-fifth-1700{margin-left:80%}.off-sixth-1700{margin-left:16.66666%}}@media all and (min-width: 1800px){.off-none-1800{margin-left:0}.off-half-1800{margin-left:50%}.off-third-1800{margin-left:33.33333%}.off-two-third-1800{margin-left:66.66666%}.off-fourth-1800{margin-left:25%}.off-three-fourth-1800{margin-left:75%}.off-fifth-1800{margin-left:20%}.off-two-fifth-1800{margin-left:40%}.off-three-fifth-1800{margin-left:60%}.off-four-fifth-1800{margin-left:80%}.off-sixth-1800{margin-left:16.66666%}}@media all and (min-width: 1900px){.off-none-1900{margin-left:0}.off-half-1900{margin-left:50%}.off-third-1900{margin-left:33.33333%}.off-two-third-1900{margin-left:66.66666%}.off-fourth-1900{margin-left:25%}.off-three-fourth-1900{margin-left:75%}.off-fifth-1900{margin-left:20%}.off-two-fifth-1900{margin-left:40%}.off-three-fifth-1900{margin-left:60%}.off-four-fifth-1900{margin-left:80%}.off-sixth-1900{margin-left:16.66666%}}@media all and (min-width: 2000px){.off-none-2000{margin-left:0}.off-half-2000{margin-left:50%}.off-third-2000{margin-left:33.33333%}.off-two-third-2000{margin-left:66.66666%}.off-fourth-2000{margin-left:25%}.off-three-fourth-2000{margin-left:75%}.off-fifth-2000{margin-left:20%}.off-two-fifth-2000{margin-left:40%}.off-three-fifth-2000{margin-left:60%}.off-four-fifth-2000{margin-left:80%}.off-sixth-2000{margin-left:16.66666%}}nav{position:fixed;top:0;left:0;right:0;height:3em;padding:0 .6em;background:#fff;box-shadow:0 0 0.2em rgba(170,170,170,0.2);z-index:10000;transition:all .3s;transform-style:preserve-3d}nav .brand,nav .menu,nav .burger{float:right;position:relative;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}nav .brand{font-weight:700;float:left;padding:0 .6em;max-width:50%;white-space:nowrap;color:inherit}nav .brand *{vertical-align:middle}nav .logo{height:2em;margin-right:.3em}nav .select::after{height:calc(100% - 1px);padding:0;line-height:2.4em}nav .menu>*{margin-right:.6em}nav .burger{display:none}@media all and (max-width: 60em){nav .burger{display:inline-block;cursor:pointer;bottom:-1000em;margin:0;-webkit-tap-highlight-color:transparent}nav .burger ~ .menu,nav .show:checked ~ .burger{position:fixed;min-height:100%;top:0;right:0;bottom:-1000em;margin:0;background:#fff;transition:all .5s ease;transform:none}nav .burger ~ .menu{z-index:11}nav .show:checked ~ .burger{color:transparent;width:100%;border-radius:0;background:rgba(17,17,17,0.2);transition:all .5s ease}nav .show ~ .menu{width:70%;max-width:300px;transform-origin:center right;transition:all .25s ease;transform:scaleX(0)}nav .show ~ .menu>*{transform:translateX(100%);transition:all 0s ease .5s}nav .show:checked ~ .menu>*:nth-child(1){transition:all .5s cubic-bezier(0.645, 0.045, 0.355, 1) 0s}nav .show:checked ~ .menu>*:nth-child(2){transition:all .5s cubic-bezier(0.645, 0.045, 0.355, 1) .1s}nav .show:checked ~ .menu>*:nth-child(3){transition:all .5s cubic-bezier(0.645, 0.045, 0.355, 1) .2s}nav .show:checked ~ .menu>*:nth-child(4){transition:all .5s cubic-bezier(0.645, 0.045, 0.355, 1) .3s}nav .show:checked ~ .menu>*:nth-child(5){transition:all .5s cubic-bezier(0.645, 0.045, 0.355, 1) .4s}nav .show:checked ~ .menu>*:nth-child(6){transition:all .5s cubic-bezier(0.645, 0.045, 0.355, 1) .5s}nav .show:checked ~ .menu{transform:scaleX(1)}nav .show:checked ~ .menu>*{transform:translateX(0);transition:all .5s ease-in-out .6s}nav .burger ~ .menu>*{display:block;margin:.3em;text-align:left;max-width:calc(100% - .6em)}nav .burger ~ .menu>a{padding:.3em .9em}}.stack,.stack .toggle{margin-top:0;margin-bottom:0;display:block;width:100%;text-align:left;border-radius:0}.stack:first-child,.stack:first-child .toggle{border-top-left-radius:.2em;border-top-right-radius:.2em}.stack:last-child,.stack:last-child .toggle{border-bottom-left-radius:.2em;border-bottom-right-radius:.2em}input.stack,textarea.stack,select.stack{transition:border-bottom 0 ease 0;border-bottom-width:0}input.stack:last-child,textarea.stack:last-child,select.stack:last-child{border-bottom-width:1px}input.stack:focus+input,input.stack:focus+textarea,input.stack:focus+select,textarea.stack:focus+input,textarea.stack:focus+textarea,textarea.stack:focus+select,select.stack:focus+input,select.stack:focus+textarea,select.stack:focus+select{border-top-color:#0074d9}.card,.modal .overlay ~ *{position:relative;box-shadow:none;border-radius:.2em;border:1px solid #aaa;overflow:hidden;text-align:left;background:#fff;margin-bottom:.6em;padding:0;transition:all .3s ease}.hidden.card,.modal .overlay ~ .hidden,:checked+.card,.modal .overlay ~ :checked+*,.modal .overlay:checked+*{font-size:0;padding:0;margin:0;border:0}.card>*,.modal .overlay ~ *>*{max-width:100%;display:block}.card>*:last-child,.modal .overlay ~ *>*:last-child{margin-bottom:0}.card header,.modal .overlay ~ * header,.card section,.modal .overlay ~ * section,.card>p,.modal .overlay ~ *>p{padding:.6em .8em}.card section,.modal .overlay ~ * section{padding:.6em .8em 0}.card hr,.modal .overlay ~ * hr{border:none;height:1px;background-color:#aaa}.card header,.modal .overlay ~ * header{font-weight:bold;position:relative;border-bottom:1px solid #aaa}.card header h1,.modal .overlay ~ * header h1,.card header h2,.modal .overlay ~ * header h2,.card header h3,.modal .overlay ~ * header h3,.card header h4,.modal .overlay ~ * header h4,.card header h5,.modal .overlay ~ * header h5,.card header h6,.modal .overlay ~ * header h6{padding:0;margin:0 2em 0 0;line-height:1;display:inline-block;vertical-align:text-bottom}.card header:last-child,.modal .overlay ~ * header:last-child{border-bottom:0}.card footer,.modal .overlay ~ * footer{padding:.8em}.card p,.modal .overlay ~ * p{margin:.3em 0}.card p:first-child,.modal .overlay ~ * p:first-child{margin-top:0}.card p:last-child,.modal .overlay ~ * p:last-child{margin-bottom:0}.card>p,.modal .overlay ~ *>p{margin:0;padding-right:2.5em}.card .close,.modal .overlay ~ * .close{position:absolute;top:.4em;right:.3em;font-size:1.2em;padding:0 .5em;cursor:pointer;width:auto}.card .close:hover,.modal .overlay ~ * .close:hover{color:#ff4136}.card h1+.close,.modal .overlay ~ * h1+.close{margin:.2em}.card h2+.close,.modal .overlay ~ * h2+.close{margin:.1em}.card .dangerous,.modal .overlay ~ * .dangerous{background:#ff4136;float:right}.modal{text-align:center}.modal>input{display:none}.modal>input ~ *{opacity:0;max-height:0;overflow:hidden}.modal .overlay{top:0;left:0;bottom:0;right:0;position:fixed;margin:0;border-radius:0;background:rgba(17,17,17,0.2);transition:all 0.3s;z-index:100000}.modal .overlay:before,.modal .overlay:after{display:none}.modal .overlay ~ *{border:0;position:fixed;top:50%;left:50%;transform:translateX(-50%) translateY(-50%) scale(0.2, 0.2);z-index:1000000;transition:all 0.3s}.modal>input:checked ~ *{display:block;opacity:1;max-height:10000px;transition:all 0.3s}.modal>input:checked ~ .overlay ~ *{max-height:90%;overflow:auto;-webkit-transform:translateX(-50%) translateY(-50%) scale(1, 1);transform:translateX(-50%) translateY(-50%) scale(1, 1)}@media (max-width: 60em){.modal .overlay ~ *{min-width:90%}}.dropimage{position:relative;display:block;padding:0;padding-bottom:56.25%;overflow:hidden;cursor:pointer;border:0;margin:.3em 0;border-radius:.2em;background-color:#ddd;background-size:cover;background-position:center center;background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2NDAiIGhlaWdodD0iNjQwIiB2ZXJzaW9uPSIxLjEiPjxnIHN0eWxlPSJmaWxsOiMzMzMiPjxwYXRoIGQ9Ik0gMTg3IDIzMCBDIDE3NSAyMzAgMTY1IDI0MCAxNjUgMjUyIEwgMTY1IDMwMCBMIDE2NSA0MDggQyAxNjUgNDIwIDE3NSA0MzAgMTg3IDQzMCBMIDQ2MyA0MzAgQyA0NzUgNDMwIDQ4NSA0MjAgNDg1IDQwOCBMIDQ4NSAzMDAgTCA0ODUgMjUyIEMgNDg1IDI0MCA0NzUgMjMwIDQ2MyAyMzAgTCAxODcgMjMwIHogTSAzNjAgMjU2IEEgNzAgNzIgMCAwIDEgNDMwIDMyOCBBIDcwIDcyIDAgMCAxIDM2MCA0MDAgQSA3MCA3MiAwIDAgMSAyOTAgMzI4IEEgNzAgNzIgMCAwIDEgMzYwIDI1NiB6Ii8+PGNpcmNsZSBjeD0iMzYwIiBjeT0iMzMwIiByPSI0MSIvPjxwYXRoIGQ9Im0yMDUgMjI1IDUtMTAgMjAgMCA1IDEwLTMwIDAiLz48cGF0aCBkPSJNMjg1IDIwMEwyNzAgMjI1IDM3NiAyMjUgMzYxIDIwMCAyODUgMjAwek0zMTAgMjA1TDMzNyAyMDUgMzM3IDIxOCAzMTAgMjE4IDMxMCAyMDV6Ii8+PHBhdGggZD0ibTQwNSAyMjUgNS0xMCAyMCAwIDUgMTAtMzAgMCIvPjwvZz48L3N2Zz4=)}.dropimage input{left:0;width:100%;height:100%;border:0;margin:0;padding:0;opacity:0;cursor:pointer;position:absolute}.tabs{position:relative;overflow:hidden}.tabs>label img{float:left;margin-left:.6em}.tabs>.row{width:calc(100% + 2 * .6em);display:table;table-layout:fixed;position:relative;padding-left:0;transition:all .3s;border-spacing:0;margin:0}.tabs>.row:before,.tabs>.row:after{display:none}.tabs>.row>*,.tabs>.row img{display:table-cell;vertical-align:top;margin:0;width:100%}.tabs>input{display:none}.tabs>input+*{width:100%}.tabs>input+label{width:auto}.two.tabs>.row{width:200%;left:-100%}.two.tabs>input:nth-of-type(1):checked ~ .row{margin-left:100%}.two.tabs>label img{width:48%;margin:4% 0 4% 4%}.three.tabs>.row{width:300%;left:-200%}.three.tabs>input:nth-of-type(1):checked ~ .row{margin-left:200%}.three.tabs>input:nth-of-type(2):checked ~ .row{margin-left:100%}.three.tabs>label img{width:30%;margin:5% 0 5% 5%}.four.tabs>.row{width:400%;left:-300%}.four.tabs>input:nth-of-type(1):checked ~ .row{margin-left:300%}.four.tabs>input:nth-of-type(2):checked ~ .row{margin-left:200%}.four.tabs>input:nth-of-type(3):checked ~ .row{margin-left:100%}.four.tabs>label img{width:22%;margin:4% 0 4% 4%}.tabs>label:first-of-type img{margin-left:0}[data-tooltip]{position:relative}[data-tooltip]:after,[data-tooltip]:before{position:absolute;z-index:10;opacity:0;border-width:0;height:0;padding:0;overflow:hidden;transition:opacity .6s ease, height 0s ease .6s;top:calc(100% - 6px);left:0;margin-top:12px}[data-tooltip]:after{margin-left:0;font-size:.8em;background:#111;content:attr(data-tooltip);white-space:nowrap}[data-tooltip]:before{content:'';width:0;height:0;border-width:0;border-style:solid;border-color:transparent transparent #111;margin-top:0;left:10px}[data-tooltip]:hover:after,[data-tooltip]:focus:after,[data-tooltip]:hover:before,[data-tooltip]:focus:before{opacity:1;border-width:6px;height:auto}[data-tooltip]:hover:after,[data-tooltip]:focus:after{padding:.45em .9em}.tooltip-top:after,.tooltip-top:before{top:auto;bottom:calc(100% - 6px);left:0;margin-bottom:12px}.tooltip-top:before{border-color:#111 transparent transparent;margin-bottom:0;left:10px}.tooltip-right:after,.tooltip-right:before{left:100%;margin-left:6px;margin-top:0;top:0}.tooltip-right:before{border-color:transparent #111 transparent transparent;margin-left:-6px;left:100%;top:7px}.tooltip-left:after,.tooltip-left:before{right:100%;margin-right:6px;left:auto;margin-top:0;top:0}.tooltip-left:before{border-color:transparent transparent transparent #111;margin-right:-6px;right:100%;top:7px} diff --git a/firmware/fsdata/fs/css/style.css b/firmware/fsdata/fs/css/style.css new file mode 100644 index 0000000..a26dda5 --- /dev/null +++ b/firmware/fsdata/fs/css/style.css @@ -0,0 +1,62 @@ +main { + padding: 4em 2em 2em 2em; + max-width: 960px; + width: 100%; + margin-left: auto; + margin-right: auto; +} +section { + display: none; +} + +canvas{ + width: 100%; +} + +main[data-page="dashboard"] section[id="dashboard"] { + display: block; +} + +main[data-page="ota"] section[id="ota"] { + display: block; +} + +main[data-page="wifi"] section[id="wifi"] { + display: block; +} + +main[data-page="io"] section[id="io"] { + display: block; +} + +.table { + width: 100%; + display: table; +} +.table>.row{ + display: table-row; +} +.table>.row:nth-child(2n) { + background: rgba(17,17,17,0.05); +} +.table>.row>*{ + display: table-cell; + padding: .3em 2.4em .3em .6em; +} +.table>header.row>*{ + text-align: left; + font-weight: 900; + color: #fff; + background-color: #0074d9; +} + +.table>.row>input{ + border: none; + background: none; + font-weight: 900; +} + +.plain{ + opacity: initial; + width: initial; +} \ No newline at end of file diff --git a/firmware/fsdata/fs/index.html b/firmware/fsdata/fs/index.html new file mode 100644 index 0000000..5e435f7 --- /dev/null +++ b/firmware/fsdata/fs/index.html @@ -0,0 +1,477 @@ + + + + + fiatlux v0.2 + + + + + +
+
+

Status

+
+
+
+
+

System

+
+
+
+ Chip ID + N/A +
+
+ Hostname + N/A +
+
+ Firmware Version + N/A +
+
+ Flash ID + N/A +
+
+ Flash size + N/A KiB +
+
+ Free heap + N/A bytes +
+
+ Uptime + N/A s +
+
+
+
+
+
+
+

Network current connection

+
+
+
+ Mode + N/A +
+
+ Station SSID + N/A +
+
+ Station IP + N/A +
+
+ Station MAC + N/A +
+
+ AP SSID + N/A +
+
+ AP IP + N/A +
+
+ AP MAC + N/A +
+
+
+
+
+
+
+

Power

+
+
+
+ Input + 5V12V +
+
+ Output + 11.2V +
+
+ +
+
+
+
+
+

I/O

+
+
+
+ Channel 1-6 + SPI Dimmer +
+
+ Channel 7-127 + WS2812 via I2S +
+
+
+ +
+
+
+
+
+
+

System

+
+
+

Firmware Update

+
+
+
+ +
+
+ +
+
+
+
+
+

Restart

+
+
+
+ +
+
+
+
+
+

Reset Config

+
+
+
+ +
+
+
+ +
+
+

I/O

+
+
+

Protocols

+
+
+
+ + +
+
+ + +
+
+
+
+
+

Station Mode current connection

+
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + +
+
+
+
+
+

Wifi Settings

+
+
+

AP Mode

+
+
+
+ + +
+
+ + +
+
+ + +
+
+ AP IP + N/A +
+
+ AP MAC + N/A +
+
+ + +
+
+
+
+
+

Station Mode current connection

+
+
+
+ + +
+
+ + +
+
+ + +
+
+ Sation IP + N/A +
+
+ Station MAC + N/A +
+
+ + +
+
+
+
+
+ + + + + diff --git a/firmware/fsdata/fs/js/smoothie_min.js b/firmware/fsdata/fs/js/smoothie_min.js new file mode 100644 index 0000000..87ce47d --- /dev/null +++ b/firmware/fsdata/fs/js/smoothie_min.js @@ -0,0 +1,15 @@ +// MIT License: +// +// Copyright (c) 2010-2013, Joe Walnes +// 2013-2014, Drew Noakes +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +;(function(exports){var Util={extend:function(){arguments[0]=arguments[0]||{};for(var i=1;ithis.maxValue){this.maxValue=value}if(value=0&&this.data[i][0]>timestamp){i-=1}if(i===-1){this.data.splice(0,0,[timestamp,value])}else if(this.data.length>0&&this.data[i][0]===timestamp){if(sumRepeatedTimeStampValues){this.data[i][1]+=value;value=this.data[i][1]}else{this.data[i][1]=value}}else if(i=maxDataSetLength&&this.data[removeCount+1][0]0){timeSeries.resetBoundsTimerId=setInterval(function(){timeSeries.resetBounds()},timeSeries.options.resetBoundsInterval)}};SmoothieChart.prototype.removeTimeSeries=function(timeSeries){var numSeries=this.seriesSet.length;for(var i=0;i0.1||Math.abs(minValueDiff)>0.1;this.currentValueRange+=chartOptions.scaleSmoothing*valueRangeDiff;this.currentVisMinValue+=chartOptions.scaleSmoothing*minValueDiff}this.valueRange={min:chartMinValue,max:chartMaxValue}};SmoothieChart.prototype.render=function(canvas,time){var nowMillis=new Date().getTime();if(!this.isAnimatingScale){var maxIdleMillis=Math.min(1000/6,this.options.millisPerPixel);if(nowMillis-this.lastRenderTimeMillis0){context.beginPath();for(var t=time-(time%chartOptions.grid.millisPerLine);t>=oldestValidTime;t-=chartOptions.grid.millisPerLine){var gx=timeToXPixel(t);if(chartOptions.grid.sharpLines){gx-=0.5}context.moveTo(gx,0);context.lineTo(gx,dimensions.height)}context.stroke();context.closePath()}for(var v=1;v1){if(seriesOptions.fillStyle){context.lineTo(dimensions.width+seriesOptions.lineWidth+1,lastY);context.lineTo(dimensions.width+seriesOptions.lineWidth+1,dimensions.height+seriesOptions.lineWidth+1);context.lineTo(firstX,dimensions.height+seriesOptions.lineWidth);context.fillStyle=seriesOptions.fillStyle;context.fill()}if(seriesOptions.strokeStyle&&seriesOptions.strokeStyle!=='none'){context.stroke()}context.closePath()}context.restore()}if(!chartOptions.labels.disabled&&!isNaN(this.valueRange.min)&&!isNaN(this.valueRange.max)){var maxValueString=chartOptions.yMaxFormatter(this.valueRange.max,chartOptions.labels.precision),minValueString=chartOptions.yMinFormatter(this.valueRange.min,chartOptions.labels.precision),maxLabelPos=chartOptions.scrollBackwards?0:dimensions.width-context.measureText(maxValueString).width-2,minLabelPos=chartOptions.scrollBackwards?0:dimensions.width-context.measureText(minValueString).width-2;context.fillStyle=chartOptions.labels.fillStyle;context.fillText(maxValueString,maxLabelPos,chartOptions.labels.fontSize);context.fillText(minValueString,minLabelPos,dimensions.height-2)}if(chartOptions.timestampFormatter&&chartOptions.grid.millisPerLine>0){var textUntilX=chartOptions.scrollBackwards?context.measureText(minValueString).width:dimensions.width-context.measureText(minValueString).width+4;for(var t=time-(time%chartOptions.grid.millisPerLine);t>=oldestValidTime;t-=chartOptions.grid.millisPerLine){var gx=timeToXPixel(t);if((!chartOptions.scrollBackwards&&gxtextUntilX)){var tx=new Date(t),ts=chartOptions.timestampFormatter(tx),tsWidth=context.measureText(ts).width;textUntilX=chartOptions.scrollBackwards?gx+tsWidth+2:gx-tsWidth-2;context.fillStyle=chartOptions.labels.fillStyle;if(chartOptions.scrollBackwards){context.fillText(ts,gx,dimensions.height-2)}else{context.fillText(ts,gx-tsWidth,dimensions.height-2)}}}}context.restore();};SmoothieChart.timeFormatter=function(date){function pad2(number){return(number<10?'0':'')+number}return pad2(date.getHours())+':'+pad2(date.getMinutes())+':'+pad2(date.getSeconds())};exports.TimeSeries=TimeSeries;exports.SmoothieChart=SmoothieChart})(typeof exports==='undefined'?this:exports); \ No newline at end of file