Skip to content

Commit

Permalink
Version number is now generated by git.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
CelliesProjects committed Apr 1, 2018
1 parent 583cdfe commit 00f1d3e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
9 changes: 2 additions & 7 deletions aquacontrol32.ino
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@
#include <AsyncTCP.h> /* https://github.com/me-no-dev/ESPAsyncTCP */
#include <ESPAsyncWebServer.h> /* https://github.com/me-no-dev/ESPAsyncWebServer */
#include <XPT2046_Touchscreen.h> /* https://github.com/PaulStoffregen/XPT2046_Touchscreen */


/**************************************************************************
which version is this
**************************************************************************/
#define SKETCH_VERSION "1.0.0"
#include "gitTagVersion.h"


/**************************************************************************
Expand Down Expand Up @@ -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 );
Expand Down
5 changes: 5 additions & 0 deletions compile.sh
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions flash.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion webservertask.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 00f1d3e

Please sign in to comment.