1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-21 07:15:12 +03:00

Merge pull request #3330 from opentx/projectkk2glider/issue_3255_uid_display

Projectkk2glider/issue 3255 uid display
This commit is contained in:
Bertrand Songis 2016-03-19 16:32:26 +01:00
commit 0a7d0119fe
5 changed files with 22 additions and 3 deletions

View file

@ -77,10 +77,16 @@ void menuGeneralVersion(uint8_t event)
exit(0);
#endif
}
if (event == EVT_ENTRY) {
getCPUUniqueID(reusableBuffer.version.id);
}
SIMPLE_MENU(STR_MENUVERSION, menuTabGeneral, e_Vers, 1);
lcd_putsLeft(MENU_HEADER_HEIGHT+1, vers_stamp);
lcd_putsLeft(MENU_HEADER_HEIGHT+4*FH+1, "UID\037\033:");
lcdDrawText(5*FW+3, MENU_HEADER_HEIGHT+4*FH+1, reusableBuffer.version.id);
lcd_putsLeft(MENU_HEADER_HEIGHT+5*FH+1, STR_EEBACKUP);
lcd_putsLeft(MENU_HEADER_HEIGHT+6*FH+1, STR_FACTORYRESET);

View file

@ -1534,6 +1534,13 @@ union ReusableBuffer
char originalName[SD_SCREEN_FILE_LENGTH+1];
} sdmanager;
#endif
#if defined(PCBTARANIS)
struct
{
char id[27];
} version;
#endif
};
extern union ReusableBuffer reusableBuffer;

View file

@ -41,6 +41,8 @@
const pm_char date_stamp[] PROGMEM = "DATE" TAB ": " DATE;
const pm_char time_stamp[] PROGMEM = "TIME" TAB ": " TIME;
const pm_char eeprom_stamp[] PROGMEM = "EEPR" TAB ": " EEPROM_STR;
#elif defined(PCBTARANIS)
const pm_char vers_stamp[] PROGMEM = "FW\037\033: " "opentx-" FLAVOUR "\036VERS\037\033: " VERSION "\036DATE\037\033: " DATE " " TIME "\036EEPR\037\033: " EEPROM_STR;
#else
const pm_char vers_stamp[] PROGMEM = "FW\037\033: " "opentx-" FLAVOUR "\036VERS\037\033: " VERSION "\036DATE\037\033: " DATE "\036TIME\037\033: " TIME "\036EEPR\037\033: " EEPROM_STR;
#endif

View file

@ -157,9 +157,9 @@ char * strAppendUnsigned(char * dest, uint32_t value, uint8_t digits, uint8_t ra
}
uint8_t idx = digits;
while(idx > 0) {
div_t qr = div(value, radix);
dest[--idx] = (qr.rem >= 10 ? 'A'-10 : '0') + qr.rem;
value = qr.quot;
uint32_t rem = value % radix;
dest[--idx] = (rem >= 10 ? 'A'-10 : '0') + rem;
value /= radix;
}
dest[digits] = '\0';
return &dest[digits];

View file

@ -41,7 +41,11 @@ void watchdogInit(unsigned int duration)
void getCPUUniqueID(char * s)
{
#if defined(SIMU)
uint32_t cpu_uid[3] = { 0x12345678, 0xAA55AA55AA, 0x87654321};
#else
uint32_t * cpu_uid = (uint32_t *)0x1FFF7A10;
#endif
char * tmp = strAppendUnsigned(s, cpu_uid[0], 8, 16);
*tmp = ' ';
tmp = strAppendUnsigned(tmp+1, cpu_uid[1], 8, 16);