|
|
|
@ -101,6 +101,7 @@ void __attribute__((noreturn)) app_main() |
|
|
|
|
tcpip_adapter_init(); |
|
|
|
|
initialise_wifi(); |
|
|
|
|
|
|
|
|
|
#if 0 |
|
|
|
|
// TODO add proper join procedure
|
|
|
|
|
const char *ssid = "Chlivek_2.4G"; |
|
|
|
|
const char *pass = "slepice123"; |
|
|
|
@ -113,6 +114,7 @@ void __attribute__((noreturn)) app_main() |
|
|
|
|
ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) ); |
|
|
|
|
ESP_ERROR_CHECK( esp_wifi_disconnect() ); |
|
|
|
|
ESP_ERROR_CHECK( esp_wifi_connect() ); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
gui_init(); |
|
|
|
|
knob_init(); |
|
|
|
@ -122,24 +124,6 @@ void __attribute__((noreturn)) app_main() |
|
|
|
|
websrv_init(); |
|
|
|
|
fire_init(); |
|
|
|
|
|
|
|
|
|
nvs_handle nvs; |
|
|
|
|
|
|
|
|
|
ESP_ERROR_CHECK(nvs_open("config", NVS_READWRITE, &nvs)); // must use RW to allow opening nonexistent
|
|
|
|
|
|
|
|
|
|
union uf32 kp, ki, kd; |
|
|
|
|
|
|
|
|
|
// TODO set good defaults
|
|
|
|
|
kp.f = 0.3f; |
|
|
|
|
ki.f = 0.5f; |
|
|
|
|
kd.f = 0.0f; |
|
|
|
|
|
|
|
|
|
nvs_get_u32(nvs, "kp", &kp.u); |
|
|
|
|
nvs_get_u32(nvs, "ki", &ki.u); |
|
|
|
|
nvs_get_u32(nvs, "kd", &kd.u); |
|
|
|
|
|
|
|
|
|
fire_set_tuning(kp.f, ki.f, kd.f); |
|
|
|
|
nvs_close(nvs); |
|
|
|
|
|
|
|
|
|
bool level = 0; |
|
|
|
|
while (1) { |
|
|
|
|
vTaskDelay(pdMS_TO_TICKS(1000)); |
|
|
|
|