From dc8ba4290903aed363302f284af54c91d1ea7569 Mon Sep 17 00:00:00 2001 From: Marcus Date: Thu, 24 Oct 2024 14:28:11 +0200 Subject: [PATCH] cangrow.sh put build target dir into variable --- Arduino/CanGrow/cangrow.sh | 16 ++++++++------- .../include/Webserver/File_cangrow_CSS.h | 20 +++++++++++++------ .../CanGrow/include/Webserver/Page_system.h | 11 +++++----- .../include/Webserver/Page_system_HTML.h | 12 +++++++---- 4 files changed, 36 insertions(+), 23 deletions(-) diff --git a/Arduino/CanGrow/cangrow.sh b/Arduino/CanGrow/cangrow.sh index e7a1749..74a87bb 100755 --- a/Arduino/CanGrow/cangrow.sh +++ b/Arduino/CanGrow/cangrow.sh @@ -11,11 +11,13 @@ BUILD="$(git rev-parse --short HEAD)-$(echo $BOARD | cut -d : -f1)-$(date '+%Y%m ACLI="$HOME/.local/bin/arduino-cli" ACLI_CMD="$ACLI --config-file arduino-cli.yml" +test -z $BUILDDIR && BUILDDIR="build" +ACLI_CMD="${ACLI_CMD} --output-dir ${BUILDDIR}" function help() { echo "$0 [setup|build|upload|webupload|monitor]" echo "setup: setup build environment, download arduino-cli, install all dependencies for arduino ide" - echo "build: build firmware binary. will be saved into build/" + echo "build: build firmware binary. will be saved into ${BUILDDIR}/" echo "upload: upload firmware by serial connection $TTY" echo "webupload: upload firmware with webupload to $IP" echo "monitor: serial monitor $TTY" @@ -90,21 +92,21 @@ case $1 in ;; b|build) check_acli - echo ":: Building firmware $VER $BUILD, target dir: $(pwd)/build/" + echo ":: Building firmware $VER $BUILD, target dir: ${BUILDDIR}/" - test -d build || mkdir build + test -d ${BUILDDIR} || mkdir ${BUILDDIR} # esp8266 and esp32 compiler have to use different compile flags for VER and BUILD if [ "$(echo $BOARD | cut -d : -f1)" == "esp8266" ] then - ${ACLI_CMD} --no-color compile -b ${BOARD} --build-property "build.extra_flags=-DCANGROW_VER=\"${VER}\" -DCANGROW_BUILD=\"${BUILD}\"" "CanGrow.ino" --output-dir build/ || exit 1 + ${ACLI_CMD} --no-color compile -b ${BOARD} --build-property "build.extra_flags=-DCANGROW_VER=\"${VER}\" -DCANGROW_BUILD=\"${BUILD}\"" "CanGrow.ino" || exit 1 elif [ "$(echo $BOARD | cut -d : -f1)" == "esp32" ] then - ${ACLI_CMD} --no-color compile -b ${BOARD} --build-property "build.defines=-DCANGROW_VER=\"${VER}\" -DCANGROW_BUILD=\"${BUILD}\"" "CanGrow.ino" --output-dir build/ || exit 1 + ${ACLI_CMD} --no-color compile -b ${BOARD} --build-property "build.defines=-DCANGROW_VER=\"${VER}\" -DCANGROW_BUILD=\"${BUILD}\"" "CanGrow.ino" || exit 1 fi - cp build/CanGrow.ino.bin build/CanGrow_v${VER}_${BUILD}.bin + cp ${BUILDDIR}/CanGrow.ino.bin ${BUILDDIR}/CanGrow_v${VER}_${BUILD}.bin ;; u|upload) check_acli @@ -123,7 +125,7 @@ case $1 in ;; w|webupload) - test -z "$2" && UPLOAD_FILE="$(pwd)/build/CanGrow.ino.bin" + test -z "$2" && UPLOAD_FILE="${BUILDDIR}/CanGrow.ino.bin" test -n "$2" && UPLOAD_FILE="$2" echo ":: Uploading $UPLOAD_FILE to $IP" diff --git a/Arduino/CanGrow/include/Webserver/File_cangrow_CSS.h b/Arduino/CanGrow/include/Webserver/File_cangrow_CSS.h index 91778c7..505da66 100644 --- a/Arduino/CanGrow/include/Webserver/File_cangrow_CSS.h +++ b/Arduino/CanGrow/include/Webserver/File_cangrow_CSS.h @@ -32,11 +32,12 @@ const char* File_cangrow_CSS PROGMEM = R"(body { color: #cae0d0; background-color: #1d211e; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; + text-align: center; } .footer { color: #343B35; - text-align: center; + /*text-align: center;*/ } .center { @@ -53,6 +54,7 @@ const char* File_cangrow_CSS PROGMEM = R"(body { h1, h2, h3, h4, h5 { text-align: center; } + a:link, a:visited { color: #04AA6D; } @@ -70,7 +72,7 @@ a:active { margin: auto; margin-bottom: 5px; font-weight: bold; - text-align: center; + /*text-align: center;*/ text-decoration: none; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.5); } @@ -89,16 +91,17 @@ a:active { } .nav { background: #333; - width: 100%%; + /*width: 100%%; */ margin: auto; margin-bottom: 10px; padding: 0; position: relative; border-radius: 3px; + display: inline-block; } .subnav { - text-align: center; + /*text-align: center;*/ margin: auto; margin-bottom: 10px; padding: 0; @@ -106,6 +109,11 @@ a:active { border-radius: 3px; } +.subnavTitle { + font-size: 1em; + margin-top: -15px; + /*text-align: center;*/ +} .nav li { display: inline-block; list-style: none; @@ -158,7 +166,7 @@ a:active { color: #fff; border-radius: 3px; padding: 6px 12px; - text-align: center; + /*text-align: center;*/ text-decoration: none; display: inline-block; border: none; @@ -178,7 +186,7 @@ input[type=text], input[type=date], input[type=number], input[type=password], se @media only screen and (min-width: 1820px) { .center, .nav { - width: 60%%; min-width: 420px; + /*width: 60%%; min-width: 420px;*/ } .subnav li { display: ''; diff --git a/Arduino/CanGrow/include/Webserver/Page_system.h b/Arduino/CanGrow/include/Webserver/Page_system.h index 379c17a..e0c5183 100644 --- a/Arduino/CanGrow/include/Webserver/Page_system.h +++ b/Arduino/CanGrow/include/Webserver/Page_system.h @@ -30,6 +30,9 @@ #include "Page_system_HTML.h" +/* + * Main system page + */ // https://techtutorialsx.com/2018/07/23/esp32-arduino-http-server-template-processing-with-multiple-placeholders/ @@ -68,7 +71,6 @@ void WebPage_system(AsyncWebServerRequest *request) { request->send_P(200, "text/html", Page_system_HTML, Proc_WebPage_system_POST); Serial.println(":: [Webserver:system:output] [POST] hello"); - if(request->hasParam("config.system.ntpOffset", true)) { const AsyncWebParameter* p_ntpOffset = request->getParam("config.system.ntpOffset", true); Serial.printf(":: [Webserver:system] POST[%s]: %s\n", p_ntpOffset->name().c_str(), p_ntpOffset->value().c_str()); @@ -85,14 +87,11 @@ void WebPage_system(AsyncWebServerRequest *request) { // we need a restart to apply the new settings needRestart = true; Serial.println(":: [Webserver:system] config saved"); - request->send_P(200, "text/html", Page_wifi_HTML, Proc_WebPage_system_POST); + request->send_P(200, "text/html", Page_system_HTML, Proc_WebPage_system_POST); } else { Serial.println("!! [Webserver:system] ERROR saving config "); - request->send_P(200, "text/html", Page_wifi_HTML, Proc_WebPage_system_POST_ERR); + request->send_P(200, "text/html", Page_system_HTML, Proc_WebPage_system_POST_ERR); } - - - } else { request->send_P(200, "text/html", Page_system_HTML, Proc_WebPage_system); } diff --git a/Arduino/CanGrow/include/Webserver/Page_system_HTML.h b/Arduino/CanGrow/include/Webserver/Page_system_HTML.h index d6c2849..8540c3a 100644 --- a/Arduino/CanGrow/include/Webserver/Page_system_HTML.h +++ b/Arduino/CanGrow/include/Webserver/Page_system_HTML.h @@ -65,7 +65,8 @@ const char* Page_system_HTML_SUBNAV PROGMEM = R"(