Update build revision generation
This commit is contained in:
parent
f7105a747e
commit
bc1353767e
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
6
AfRApay.MateCard/scripts/build_git_rev.sh
Executable file
6
AfRApay.MateCard/scripts/build_git_rev.sh
Executable 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\\\""
|
|
@ -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());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue