Update build revision generation

This commit is contained in:
Laura Hausmann 2023-04-21 21:42:16 +02:00
parent f7105a747e
commit bc1353767e
Signed by: zotan
GPG key ID: D044E84C5BE01605
4 changed files with 13 additions and 4 deletions

View file

@ -3,10 +3,13 @@
#pragma ide diagnostic ignored "OCUnusedMacroInspection"
// this should be defined by our build script
#ifndef AFRAPAY_REVISION
#define AFRAPAY_REVISION "unknown"
#ifndef AFRAPAY_GIT_BRANCH
#define AFRAPAY_GIT_BRANCH "?"
#endif
#ifndef AFRAPAY_GIT_COMMIT
#define AFRAPAY_GIT_COMMIT "unknown"
#endif
//MFRC522 pinout (front) 3V3 RST GND IRQ MISO MOSI SCK SDA
//MFRC522 pinout (rear) SDA SCK MOSI MISO IRQ GND RST 3V3
#define PIN_HSPI_RST 4

View file

@ -26,4 +26,4 @@ lib_deps =
check_tool = clangtidy
check_flags =
clangtidy: --config-file=.clang-tidy
build_flags = !echo '-DAFRAPAY_REVISION=\\"'$(git describe --long --always --dirty --exclude=* --abbrev=8)'\\"'
build_flags = !scripts/build_git_rev.sh

View file

@ -0,0 +1,6 @@
#!/bin/bash
branch=$(git rev-parse --abbrev-ref HEAD)
rev=$(git diff --quiet && git describe --long --always --dirty --exclude=* --abbrev=8 || echo "dirty")
echo "-DAFRAPAY_GIT_BRANCH=\\\"$branch\\\" -DAFRAPAY_GIT_COMMIT=\\\"$rev\\\""

View file

@ -129,7 +129,7 @@ void updateOLED(U8G2 u8g2, e_state state, const String& statusText, const String
void updateOLED(const U8G2& u8g2, e_state state) {
String time = DateTime.format(DateFormatter::TIME_ONLY);
if (!digitalRead(PIN_INTERRUPT_CANCEL) || millis()%20000 < 10000)
updateOLED(u8g2, state, time, AFRAPAY_REVISION);
updateOLED(u8g2, state, time, AFRAPAY_GIT_COMMIT);
else
updateOLED(u8g2, state, time, WiFi.localIP().toString());
}