From 00f1d3e08c0745033cd6dc65448fa40a9c7c4dc5 Mon Sep 17 00:00:00 2001 From: Cellie Date: Sun, 1 Apr 2018 20:42:53 +0200 Subject: [PATCH] Version number is now generated by git. Compiling from the Arduino IDE does not work anymore. Use the 'compile.sh' script to verify the sketch. Use the 'flash.sh' script to compile and upload the sketch. --- aquacontrol32.ino | 9 ++------- compile.sh | 5 +++++ flash.sh | 5 +++++ webservertask.ino | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) create mode 100755 compile.sh create mode 100755 flash.sh diff --git a/aquacontrol32.ino b/aquacontrol32.ino index af77940..9e92e01 100644 --- a/aquacontrol32.ino +++ b/aquacontrol32.ino @@ -9,12 +9,7 @@ #include /* https://github.com/me-no-dev/ESPAsyncTCP */ #include /* https://github.com/me-no-dev/ESPAsyncWebServer */ #include /* https://github.com/PaulStoffregen/XPT2046_Touchscreen */ - - -/************************************************************************** - which version is this -**************************************************************************/ -#define SKETCH_VERSION "1.0.0" +#include "gitTagVersion.h" /************************************************************************** @@ -301,7 +296,7 @@ void setup() btStop(); //Serial.begin( 115200 ); - ESP_LOGI( TAG, "aquacontrol32 V%s", SKETCH_VERSION ); + ESP_LOGI( TAG, "aquacontrol32 V%s", sketchVersion ); ESP_LOGI( TAG, "ESP32 SDK: %s", ESP.getSdkVersion() ); SPI.begin( SPI_SCK_PIN, SPI_MISO_PIN, SPI_MOSI_PIN ); diff --git a/compile.sh b/compile.sh new file mode 100755 index 0000000..373786e --- /dev/null +++ b/compile.sh @@ -0,0 +1,5 @@ +echo -n 'const char * sketchVersion = "' > gitTagVersion.h +git --no-pager describe --tags --always --dirty | tr --delete '\n' >>gitTagVersion.h +echo -n '";' >> gitTagVersion.h +~/arduino-1.8.5/arduino --verify test.ino +rm gitTagVersion.h diff --git a/flash.sh b/flash.sh new file mode 100755 index 0000000..4041286 --- /dev/null +++ b/flash.sh @@ -0,0 +1,5 @@ +echo -n 'const char * sketchVersion = "' > gitTagVersion.h +git --no-pager describe --tags --always --dirty | tr --delete '\n' >>gitTagVersion.h +echo -n '";' >> gitTagVersion.h +~/arduino-1.8.5/arduino --upload test.ino --pref custom_DebugLevel=esp32_none +rm gitTagVersion.h diff --git a/webservertask.ino b/webservertask.ino index 2481aaf..b71dc48 100644 --- a/webservertask.ino +++ b/webservertask.ino @@ -300,7 +300,7 @@ void webServerTask ( void * pvParameters ) else if ( request->hasArg( "version" ) ) { - snprintf( content, sizeof( content ), "Version %s - compile date: %s", SKETCH_VERSION, __DATE__ ); + snprintf( content, sizeof( content ), "Version %s - compile date: %s", sketchVersion, __DATE__ ); } else