cangrow.sh put build target dir into variable

This commit is contained in:
Marcus 2024-10-24 14:28:11 +02:00
parent 5c019f8df6
commit dc8ba42909
4 changed files with 36 additions and 23 deletions

View file

@ -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="$HOME/.local/bin/arduino-cli"
ACLI_CMD="$ACLI --config-file arduino-cli.yml" ACLI_CMD="$ACLI --config-file arduino-cli.yml"
test -z $BUILDDIR && BUILDDIR="build"
ACLI_CMD="${ACLI_CMD} --output-dir ${BUILDDIR}"
function help() { function help() {
echo "$0 [setup|build|upload|webupload|monitor]" echo "$0 [setup|build|upload|webupload|monitor]"
echo "setup: setup build environment, download arduino-cli, install all dependencies for arduino ide" 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 "upload: upload firmware by serial connection $TTY"
echo "webupload: upload firmware with webupload to $IP" echo "webupload: upload firmware with webupload to $IP"
echo "monitor: serial monitor $TTY" echo "monitor: serial monitor $TTY"
@ -90,21 +92,21 @@ case $1 in
;; ;;
b|build) b|build)
check_acli 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 # esp8266 and esp32 compiler have to use different compile flags for VER and BUILD
if [ "$(echo $BOARD | cut -d : -f1)" == "esp8266" ] if [ "$(echo $BOARD | cut -d : -f1)" == "esp8266" ]
then 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" ] elif [ "$(echo $BOARD | cut -d : -f1)" == "esp32" ]
then 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 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) u|upload)
check_acli check_acli
@ -123,7 +125,7 @@ case $1 in
;; ;;
w|webupload) 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" test -n "$2" && UPLOAD_FILE="$2"
echo ":: Uploading $UPLOAD_FILE to $IP" echo ":: Uploading $UPLOAD_FILE to $IP"

View file

@ -32,11 +32,12 @@ const char* File_cangrow_CSS PROGMEM = R"(body {
color: #cae0d0; color: #cae0d0;
background-color: #1d211e; background-color: #1d211e;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
text-align: center;
} }
.footer { .footer {
color: #343B35; color: #343B35;
text-align: center; /*text-align: center;*/
} }
.center { .center {
@ -53,6 +54,7 @@ const char* File_cangrow_CSS PROGMEM = R"(body {
h1, h2, h3, h4, h5 { h1, h2, h3, h4, h5 {
text-align: center; text-align: center;
} }
a:link, a:visited { a:link, a:visited {
color: #04AA6D; color: #04AA6D;
} }
@ -70,7 +72,7 @@ a:active {
margin: auto; margin: auto;
margin-bottom: 5px; margin-bottom: 5px;
font-weight: bold; font-weight: bold;
text-align: center; /*text-align: center;*/
text-decoration: none; text-decoration: none;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.5); text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.5);
} }
@ -89,16 +91,17 @@ a:active {
} }
.nav { .nav {
background: #333; background: #333;
width: 100%%; /*width: 100%%; */
margin: auto; margin: auto;
margin-bottom: 10px; margin-bottom: 10px;
padding: 0; padding: 0;
position: relative; position: relative;
border-radius: 3px; border-radius: 3px;
display: inline-block;
} }
.subnav { .subnav {
text-align: center; /*text-align: center;*/
margin: auto; margin: auto;
margin-bottom: 10px; margin-bottom: 10px;
padding: 0; padding: 0;
@ -106,6 +109,11 @@ a:active {
border-radius: 3px; border-radius: 3px;
} }
.subnavTitle {
font-size: 1em;
margin-top: -15px;
/*text-align: center;*/
}
.nav li { .nav li {
display: inline-block; display: inline-block;
list-style: none; list-style: none;
@ -158,7 +166,7 @@ a:active {
color: #fff; color: #fff;
border-radius: 3px; border-radius: 3px;
padding: 6px 12px; padding: 6px 12px;
text-align: center; /*text-align: center;*/
text-decoration: none; text-decoration: none;
display: inline-block; display: inline-block;
border: none; 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) { @media only screen and (min-width: 1820px) {
.center, .nav { .center, .nav {
width: 60%%; min-width: 420px; /*width: 60%%; min-width: 420px;*/
} }
.subnav li { .subnav li {
display: ''; display: '';

View file

@ -30,6 +30,9 @@
#include "Page_system_HTML.h" #include "Page_system_HTML.h"
/*
* Main system page
*/
// https://techtutorialsx.com/2018/07/23/esp32-arduino-http-server-template-processing-with-multiple-placeholders/ // 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); request->send_P(200, "text/html", Page_system_HTML, Proc_WebPage_system_POST);
Serial.println(":: [Webserver:system:output] [POST] hello"); Serial.println(":: [Webserver:system:output] [POST] hello");
if(request->hasParam("config.system.ntpOffset", true)) { if(request->hasParam("config.system.ntpOffset", true)) {
const AsyncWebParameter* p_ntpOffset = request->getParam("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()); 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 // we need a restart to apply the new settings
needRestart = true; needRestart = true;
Serial.println(":: [Webserver:system] config saved"); 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 { } else {
Serial.println("!! [Webserver:system] ERROR saving config "); 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 { } else {
request->send_P(200, "text/html", Page_system_HTML, Proc_WebPage_system); request->send_P(200, "text/html", Page_system_HTML, Proc_WebPage_system);
} }

View file

@ -65,7 +65,8 @@ const char* Page_system_HTML_SUBNAV PROGMEM = R"(<ul class='subnav'>
* Subpage update * Subpage update
*/ */
const char* Page_system_update_HTML PROGMEM = R"(%HEADER% const char* Page_system_update_HTML PROGMEM = R"(%HEADER%
<h2>&#x1F504; Firmware update</h2> <h2>&#9881; System settings</h2>
<h3>&#x1F504; Firmware update</h3>
Version: %CGVER% <br> Version: %CGVER% <br>
Build : %CGBUILD% <br> Build : %CGBUILD% <br>
@ -95,7 +96,8 @@ Please see messages on serial monitor for more information and go back to <a hre
* Subpage restart * Subpage restart
*/ */
const char* Page_system_restart_HTML PROGMEM = R"(%HEADER% const char* Page_system_restart_HTML PROGMEM = R"(%HEADER%
<h1>&#10071; Restart CanGrow</h1> <h2>&#9881; System settings</h2>
<h3>&#10071; Restart CanGrow</h3>
<div class='warnmsg'> <div class='warnmsg'>
%RESTART_MSG% %RESTART_MSG%
</div> </div>
@ -115,7 +117,8 @@ const char* Page_system_restart_HTML_RESTART_MSG_POST PROGMEM = R"(Restarting...
* Subpage wipe * Subpage wipe
*/ */
const char* Page_system_wipe_HTML PROGMEM = R"(%HEADER% const char* Page_system_wipe_HTML PROGMEM = R"(%HEADER%
<h1>&#x1F4A3; Factory reset</h1> <h2>&#9881; System settings</h2>
<h3>&#x1F4A3; Factory reset</h3>
<div class='warnmsg'> <div class='warnmsg'>
%WIPE_MSG% %WIPE_MSG%
</div> </div>
@ -136,6 +139,7 @@ const char* Page_system_wipe_HTML_WIPE_MSG_POST PROGMEM = R"(Restarting...)";
* Subpage wipe * Subpage wipe
*/ */
const char* Page_system_output_HTML PROGMEM = R"(%HEADER% const char* Page_system_output_HTML PROGMEM = R"(%HEADER%
<h1>&#9889; Output configuration</h1> <h2>&#9881; System settings</h2>
<div class='subnavTitle'>&#9889; Output configuration</div>
%FOOTER%)"; %FOOTER%)";