feat: Add PR number to version string on PR builds (#1887)

* Add PR number to version string

* Testing another way

* Decide according to GitHub ref type how to parse and where to output.
Prioritize EDGETX_VERSION_TAG, if set, else resort to EDGETX_VERSION_SUFFIX, if set.
Adjust also firmware_version and boot_version strings and adjist bootloader title.

* Consider also B/W.

* B&W: omit GIT SHA if tagged, otherwise own line
Omit GIT SHA from version string if a tagged version.
Otherwise, show on own line since is too long for 128x64 B&W displays.

Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
This commit is contained in:
Risto
2022-04-25 11:42:19 +10:00
committed by GitHub
co-authored by Peter Feerick
parent 2a3fc748bb
commit ddad99eab1
5 changed files with 72 additions and 27 deletions
+33 -14
View File
@@ -44,23 +44,31 @@
#endif
#if defined(COLORLCD)
const char fw_stamp[] = "FW" TAB ": edgetx-" FLAVOUR;
#if defined(RADIOMASTER_RELEASE) || defined(JUMPER_RELEASE)
const char vers_stamp[] = "VERS" TAB ": Factory firmware (" GIT_STR ")";
#else
const char vers_stamp[] = "VERS" TAB ": " VERSION DISPLAY_VERSION " (" GIT_STR ")";
#endif
const char date_stamp[] = "DATE" TAB ": " DATE;
const char time_stamp[] = "TIME" TAB ": " TIME;
const char cfgv_stamp[] = "CFGV" TAB ": " CFGV_STR;
const char fw_stamp[] = "FW" TAB ": edgetx-" FLAVOUR;
#if defined(RADIOMASTER_RELEASE) || defined(JUMPER_RELEASE)
const char vers_stamp[] = "VERS" TAB ": Factory firmware (" GIT_STR ")";
#else
#if defined(VERSION_TAG)
const char vers_stamp[] = "VERS" TAB ": " VERSION_TAG DISPLAY_VERSION " (" GIT_STR ")";
#else
const char vers_stamp[] = "VERS" TAB ": " VERSION "-" VERSION_SUFFIX DISPLAY_VERSION " (" GIT_STR ")";
#endif
#endif
const char date_stamp[] = "DATE" TAB ": " DATE;
const char time_stamp[] = "TIME" TAB ": " TIME;
const char cfgv_stamp[] = "CFGV" TAB ": " CFGV_STR;
#elif defined(BOARD_NAME)
const char vers_stamp[] = "FW" TAB ": edgetx-" BOARD_NAME "\036VERS" TAB ": " VERSION DISPLAY_VERSION " (" GIT_STR ")" "\036DATE" TAB ": " DATE " " TIME "\036CFGV" TAB ": " CFGV_STR;
const char vers_stamp[] = "FW" TAB ": edgetx-" BOARD_NAME "\036VERS" TAB ": " VERSION DISPLAY_VERSION " (" GIT_STR ")" "\036DATE" TAB ": " DATE " " TIME "\036CFGV" TAB ": " CFGV_STR;
#elif defined(RADIOMASTER_RELEASE)
const char vers_stamp[] = "FW" TAB ": edgetx-" FLAVOUR "\036VERS" TAB ": RM Factory (" GIT_STR ")" "\036BUILT BY : EdgeTX" "\036DATE" TAB ": " DATE " " TIME "\036CFGV" TAB ": " CFGV_STR;
const char vers_stamp[] = "FW" TAB ": edgetx-" FLAVOUR "\036VERS" TAB ": RM Factory (" GIT_STR ")" "\036BUILT BY : EdgeTX" "\036DATE" TAB ": " DATE " " TIME "\036CFGV" TAB ": " CFGV_STR;
#elif defined(JUMPER_RELEASE)
const char vers_stamp[] = "FW" TAB ": edgetx-" FLAVOUR "\036VERS" TAB ": Factory (" GIT_STR ")" "\036BUILT BY : EdgeTX" "\036DATE" TAB ": " DATE " " TIME "\036CFGV" TAB ": " CFGV_STR;
const char vers_stamp[] = "FW" TAB ": edgetx-" FLAVOUR "\036VERS" TAB ": Factory (" GIT_STR ")" "\036BUILT BY : EdgeTX" "\036DATE" TAB ": " DATE " " TIME "\036CFGV" TAB ": " CFGV_STR;
#else
const char vers_stamp[] = "FW" TAB ": edgetx-" FLAVOUR "\036VERS" TAB ": " VERSION DISPLAY_VERSION " (" GIT_STR ")" "\036DATE" TAB ": " DATE " " TIME "\036CFGV" TAB ": " CFGV_STR;
#if defined(VERSION_TAG)
const char vers_stamp[] = "FW" TAB ": edgetx-" FLAVOUR "\036VERS" TAB ": " VERSION_TAG DISPLAY_VERSION "\036DATE" TAB ": " DATE " " TIME "\036CFGV" TAB ": " CFGV_STR;
#else
const char vers_stamp[] = "FW" TAB ": edgetx-" FLAVOUR "\036VERS" TAB ": " VERSION "-" VERSION_SUFFIX DISPLAY_VERSION "\036GIT#" TAB ": " GIT_STR "\036DATE" TAB ": " DATE " " TIME "\036CFGV" TAB ": " CFGV_STR;
#endif
#endif
/**
@@ -68,11 +76,22 @@
* @return
*/
#if defined(STM32) && !defined(SIMU)
#if defined(COLORLCD)
#if defined(VERSION_TAG)
__SECTION_USED(".fwversiondata") const char firmware_version[] = "edgetx-" FLAVOUR "-" VERSION_TAG DISPLAY_VERSION " (" GIT_STR ")";
__SECTION_USED(".bootversiondata") const char boot_version[] = "edgetx-" FLAVOUR "-" VERSION_TAG DISPLAY_VERSION " (" GIT_STR ")";
#else
__SECTION_USED(".fwversiondata") const char firmware_version[] = "edgetx-" FLAVOUR "-" VERSION "-" VERSION_SUFFIX DISPLAY_VERSION " (" GIT_STR ")";
__SECTION_USED(".bootversiondata") const char boot_version[] = "edgetx-" FLAVOUR "-" VERSION "-" VERSION_SUFFIX DISPLAY_VERSION " (" GIT_STR ")";
#endif
#else
/* 128x64 does not have enough real estate to display more than basic VERSION */
__SECTION_USED(".fwversiondata") const char firmware_version[] = "edgetx-" FLAVOUR "-" VERSION DISPLAY_VERSION " (" GIT_STR ")";
__SECTION_USED(".bootversiondata") const char boot_version[] = "edgetx-" FLAVOUR "-" VERSION DISPLAY_VERSION " (" GIT_STR ")";
#endif
/**
* Tries to find opentx version in the first 1024 byte of either firmware/bootloader (the one not running) or the buffer
* Tries to find EdgeTX or OpenTX version in the first 1024 byte of either firmware/bootloader (the one not running) or the buffer
* @param buffer If non-null find the firmware version in the buffer instead
*/
const char * getFirmwareVersion(const char * buffer)