updated 3rdparty dependencies

This commit is contained in:
2021-10-03 19:29:09 +02:00
parent 7143376c89
commit ce150920fe
15 changed files with 101 additions and 23 deletions

57
export.sh Normal file
View File

@ -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

View File

@ -6,6 +6,7 @@
// 3rdparty lib includes
#include <tl/expected.hpp>
// forward declares
class EspAsyncOta;

View File

@ -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, 10> {
wifi_stack::wifi_entry { .ssid = config::sta_ssid.value(), .key = config::sta_key.value() },
wifi_stack::wifi_entry { .ssid = {}, .key = {} },

View File

@ -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("<tr><th>STA status</th><td>{}</td></tr>\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

8
open_ide.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
if [[ -z "$IDF_PATH" ]]
then
source export.sh --skip-source-check
fi
qtcreator "deckenlampe" 2>&1 >/dev/null &

View File

@ -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
#