diff --git a/components/Adafruit_BMP085_Unified b/components/Adafruit_BMP085_Unified index c2b9b3e..922bc7c 160000 --- a/components/Adafruit_BMP085_Unified +++ b/components/Adafruit_BMP085_Unified @@ -1 +1 @@ -Subproject commit c2b9b3e15c61b017c8efea895ece7e3baa38da7e +Subproject commit 922bc7c5430b56bddd67f0fd8744caefcf1980e1 diff --git a/components/Adafruit_TSL2561 b/components/Adafruit_TSL2561 index 98cf7b8..3051ce4 160000 --- a/components/Adafruit_TSL2561 +++ b/components/Adafruit_TSL2561 @@ -1 +1 @@ -Subproject commit 98cf7b89b9c34ae99714f701aa53eea9c605f145 +Subproject commit 3051ce4a775abc26957705b469249b7fbf428871 diff --git a/components/DHT-sensor-library b/components/DHT-sensor-library index 5b9e875..8df4678 160000 --- a/components/DHT-sensor-library +++ b/components/DHT-sensor-library @@ -1 +1 @@ -Subproject commit 5b9e8755b68f642e296fab1fa7b0c214bf9a08bd +Subproject commit 8df46788bcd234442e39342f54bf085ff9b63946 diff --git a/components/arduino-esp32 b/components/arduino-esp32 index a84e053..b0223be 160000 --- a/components/arduino-esp32 +++ b/components/arduino-esp32 @@ -1 +1 @@ -Subproject commit a84e0538ff20f1fbcd20fb47c836a67557677d89 +Subproject commit b0223be116f6176d4ef2eae405d776ba044aaf27 diff --git a/components/cpputils b/components/cpputils index faeacdc..47417e7 160000 --- a/components/cpputils +++ b/components/cpputils @@ -1 +1 @@ -Subproject commit faeacdcfbfcfcf0804d64d839eb5ee14a5d84c35 +Subproject commit 47417e77b70b9d37e16b8fb1f2ec3643c5c0bdab diff --git a/components/esp-nimble-cpp b/components/esp-nimble-cpp index 7f853fa..641f297 160000 --- a/components/esp-nimble-cpp +++ b/components/esp-nimble-cpp @@ -1 +1 @@ -Subproject commit 7f853fa04b8caca7d86e815485fe24f8118b3263 +Subproject commit 641f297120097974827ad3fe1a1e7d6024969e9c diff --git a/components/espcpputils b/components/espcpputils index 1ef4a9e..234dbb2 160000 --- a/components/espcpputils +++ b/components/espcpputils @@ -1 +1 @@ -Subproject commit 1ef4a9ea561947fa327c59e54a0cef79f6817c46 +Subproject commit 234dbb23fbe73ddd43e59598e571187413c64ad5 diff --git a/components/esphttpdutils b/components/esphttpdutils index a787113..148e02b 160000 --- a/components/esphttpdutils +++ b/components/esphttpdutils @@ -1 +1 @@ -Subproject commit a78711317ba4a5d5ee0ebf9e047a3609919ef898 +Subproject commit 148e02b6ca6c5580027d56c8288f328b782f5554 diff --git a/components/espwifistack b/components/espwifistack index 717d877..dc31bac 160000 --- a/components/espwifistack +++ b/components/espwifistack @@ -1 +1 @@ -Subproject commit 717d877a44056c51e4a3ab777c4279c3d7a2e220 +Subproject commit dc31bacf984170245d8e523a3d329e8762fa04db diff --git a/export.sh b/export.sh new file mode 100644 index 0000000..6074efa --- /dev/null +++ b/export.sh @@ -0,0 +1,57 @@ +if [[ $_ == $0 ]] && [[ "$1" != "--skip-source-check" ]] +then + echo "export.sh has to be sourced, not run in a subshell" + echo ". export.sh" + exit 1 +fi + +GOE_ROOT="$(dirname "$BASH_SOURCE")" + +if [[ ! -f "${GOE_ROOT}/esp-idf/export.sh" ]] +then + echo "esp-idf is missing, please check out all needed submodules!" + echo "git submodule update --init --recursive" + return +fi + +. ${GOE_ROOT}/esp-idf/export.sh + +complete -W "$(./switchconf.sh --list)" ./switchconf.sh + +GOE_INIT_FAILED= + +if [[ -e "build" ]] && [[ ! -L "build" ]] +then + echo "ERROR: build folder exists but isnt a symlink!" + GOE_INIT_FAILED=1 +fi + +if [[ -e "sdkconfig" ]] +then + if [[ ! -L "sdkconfig" ]] + then + echo "ERROR: sdkconfig exists but isnt a symlink!" + GOE_INIT_FAILED=1 + fi +else + echo "ERROR: sdkconfig does not exist" + GOE_INIT_FAILED=1 +fi + +if [[ -e "config.cmake" ]] +then + if [[ ! -L "config.cmake" ]] + then + echo "ERROR: config.cmake exists but isnt a symlink!" + GOE_INIT_FAILED=1 + fi +else + echo "ERROR: config.cmake does not exist" + GOE_INIT_FAILED=1 +fi + +if [[ ! -z "$GOE_INIT_FAILED" ]] +then + echo "run ./switchconf.sh to fix all listed issues" + return +fi diff --git a/main/myota.h b/main/myota.h index ffd065f..137928f 100644 --- a/main/myota.h +++ b/main/myota.h @@ -6,6 +6,7 @@ // 3rdparty lib includes #include + // forward declares class EspAsyncOta; diff --git a/main/mywifi.cpp b/main/mywifi.cpp index 25f534a..a23497e 100644 --- a/main/mywifi.cpp +++ b/main/mywifi.cpp @@ -23,9 +23,9 @@ namespace { wifi_stack::config makeWifiConfig() { return wifi_stack::config { - .wifiEnabled = true, .hostname = config::hostname.value(), .sta = { + .enabled = true, .wifis = std::array { wifi_stack::wifi_entry { .ssid = config::sta_ssid.value(), .key = config::sta_key.value() }, wifi_stack::wifi_entry { .ssid = {}, .key = {} }, diff --git a/main/webserver.cpp b/main/webserver.cpp index f984203..e569d06 100644 --- a/main/webserver.cpp +++ b/main/webserver.cpp @@ -153,7 +153,7 @@ esp_err_t webserver_root_handler(httpd_req_t *req) if (const auto result = webserver_otaform_display(req, body); result != ESP_OK) return result; - CALL_AND_EXIT(webserver_resp_send_succ, req, "text/html", body) + CALL_AND_EXIT(webserver_resp_send, req, esphttpdutils::ResponseStatus::Ok, "text/html", body) } esp_err_t webserver_otainfo_display(httpd_req_t *req, std::string &body) @@ -244,7 +244,7 @@ esp_err_t webserver_wifi_display(httpd_req_t *req, std::string &body) { const auto staStatus = wifi_stack::get_sta_status(); body += fmt::format("STA status{}\n", wifi_stack::toString(staStatus)); - if (staStatus == wifi_stack::WiFiStaStatus::WL_CONNECTED) + if (staStatus == wifi_stack::WiFiStaStatus::CONNECTED) { if (const auto result = wifi_stack::get_sta_ap_info(); result) { @@ -575,7 +575,7 @@ esp_err_t webserver_on_handler(httpd_req_t *req) { constexpr const char *msg = "lamp support not enabled!"; ESP_LOGW(TAG, "%s", msg); - CALL_AND_EXIT(webserver_resp_send_err, req, HTTPD_400_BAD_REQUEST, "text/plain", msg) + CALL_AND_EXIT(webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg) } const bool state = (lampState = true); @@ -584,7 +584,7 @@ esp_err_t webserver_on_handler(httpd_req_t *req) if (mqttConnected) mqttVerbosePub(config::topic_lamp_status.value(), state ? "ON" : "OFF", 0, 1); - CALL_AND_EXIT(webserver_resp_send_succ, req, "text/plain", "ON called...") + CALL_AND_EXIT(webserver_resp_send, req, esphttpdutils::ResponseStatus::Ok, "text/plain", "ON called...") } esp_err_t webserver_off_handler(httpd_req_t *req) @@ -593,7 +593,7 @@ esp_err_t webserver_off_handler(httpd_req_t *req) { constexpr const char *msg = "lamp support not enabled!"; ESP_LOGW(TAG, "%s", msg); - CALL_AND_EXIT(webserver_resp_send_err, req, HTTPD_400_BAD_REQUEST, "text/plain", msg) + CALL_AND_EXIT(webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg) } const bool state = (lampState = false); @@ -602,7 +602,7 @@ esp_err_t webserver_off_handler(httpd_req_t *req) if (mqttConnected) mqttVerbosePub(config::topic_lamp_status.value(), state ? "ON" : "OFF", 0, 1); - CALL_AND_EXIT(webserver_resp_send_succ, req, "text/plain", "OFF called...") + CALL_AND_EXIT(webserver_resp_send, req, esphttpdutils::ResponseStatus::Ok, "text/plain", "OFF called...") } esp_err_t webserver_toggle_handler(httpd_req_t *req) @@ -611,7 +611,7 @@ esp_err_t webserver_toggle_handler(httpd_req_t *req) { constexpr const char *msg = "lamp support not enabled!"; ESP_LOGW(TAG, "%s", msg); - CALL_AND_EXIT(webserver_resp_send_err, req, HTTPD_400_BAD_REQUEST, "text/plain", msg) + CALL_AND_EXIT(webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg) } const bool state = (lampState = !lampState); @@ -620,14 +620,14 @@ esp_err_t webserver_toggle_handler(httpd_req_t *req) if (mqttConnected) mqttVerbosePub(config::topic_lamp_status.value(), state ? "ON" : "OFF", 0, 1); - CALL_AND_EXIT(webserver_resp_send_succ, req, "text/plain", "TOGGLE called...") + CALL_AND_EXIT(webserver_resp_send, req, esphttpdutils::ResponseStatus::Ok, "text/plain", "TOGGLE called...") } esp_err_t webserver_reboot_handler(httpd_req_t *req) { shouldReboot = true; - CALL_AND_EXIT(webserver_resp_send_succ, req, "text/plain", "REBOOT called...") + CALL_AND_EXIT(webserver_resp_send, req, esphttpdutils::ResponseStatus::Ok, "text/plain", "REBOOT called...") } esp_err_t webserver_ota_handler(httpd_req_t *req) @@ -643,13 +643,13 @@ esp_err_t webserver_ota_handler(httpd_req_t *req) char urlBufEncoded[256]; if (const auto result = httpd_query_key_value(query.data(), "url", urlBufEncoded, sizeof(urlBufEncoded)); result == ESP_ERR_NOT_FOUND) { - CALL_AND_EXIT(webserver_resp_send_err, req, HTTPD_400_BAD_REQUEST, "text/plain", "url parameter missing") + CALL_AND_EXIT(webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", "url parameter missing") } else if (result != ESP_OK) { const auto msg = fmt::format("httpd_query_key_value() {} failed with {}", "url", esp_err_to_name(result)); ESP_LOGE(TAG, "%.*s", msg.size(), msg.data()); - CALL_AND_EXIT(webserver_resp_send_err, req, HTTPD_400_BAD_REQUEST, "text/plain", msg) + CALL_AND_EXIT(webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg) } char urlBuf[257]; @@ -660,10 +660,10 @@ esp_err_t webserver_ota_handler(httpd_req_t *req) if (const auto result = triggerOta(url); !result) { ESP_LOGE(TAG, "%.*s", result.error().size(), result.error().data()); - CALL_AND_EXIT(webserver_resp_send_err, req, HTTPD_400_BAD_REQUEST, "text/plain", result.error()) + CALL_AND_EXIT(webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", result.error()) } - CALL_AND_EXIT(webserver_resp_send_succ, req, "text/plain", "OTA called...") + CALL_AND_EXIT(webserver_resp_send, req, esphttpdutils::ResponseStatus::Ok, "text/plain", "OTA called...") } } // namespace } // namespace deckenlampe diff --git a/open_ide.sh b/open_ide.sh new file mode 100755 index 0000000..d4be42e --- /dev/null +++ b/open_ide.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +if [[ -z "$IDF_PATH" ]] +then + source export.sh --skip-source-check +fi + +qtcreator "deckenlampe" 2>&1 >/dev/null & diff --git a/sdkconfig b/sdkconfig index ccd63cf..25c7b78 100644 --- a/sdkconfig +++ b/sdkconfig @@ -156,6 +156,18 @@ CONFIG_ARDUINO_SELECTIVE_COMPILATION=y CONFIG_ARDUINO_SELECTIVE_Wire=y # end of Arduino Configuration +# +# espcpputils settings +# +# CONFIG_ESPCPPUTILS_LOG_LOCAL_LEVEL_NONE is not set +# CONFIG_ESPCPPUTILS_LOG_LOCAL_LEVEL_ERROR is not set +# CONFIG_ESPCPPUTILS_LOG_LOCAL_LEVEL_WARN is not set +CONFIG_ESPCPPUTILS_LOG_LOCAL_LEVEL_INFO=y +# CONFIG_ESPCPPUTILS_LOG_LOCAL_LEVEL_DEBUG is not set +# CONFIG_ESPCPPUTILS_LOG_LOCAL_LEVEL_VERBOSE is not set +CONFIG_ESPCPPUTILS_LOG_LOCAL_LEVEL=3 +# end of espcpputils settings + # # Simple WiFi Stack settings #