mirror of
https://github.com/EdgeTX/edgetx.git
synced 2025-07-24 16:55:15 +03:00
Fixes #3255
This commit is contained in:
parent
364bf6ac23
commit
7ebebb312a
7 changed files with 50 additions and 14 deletions
|
@ -841,7 +841,7 @@ endif()
|
|||
if(CPU_FAMILY STREQUAL STM32)
|
||||
add_custom_target(flash
|
||||
COMMAND dfu-util --alt 0 --dfuse-address 0x08000000 -D firmware.bin
|
||||
DEPENDS firmware.bin
|
||||
DEPENDS firmware
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
endif()
|
||||
|
|
|
@ -280,6 +280,13 @@ int cliDisplay(const char ** argv)
|
|||
else if (!strcmp(argv[1], "volume")) {
|
||||
serialPrint("volume = %d", getVolume());
|
||||
}
|
||||
#if defined(CPUSTM32)
|
||||
else if (!strcmp(argv[1], "uid")) {
|
||||
char str[LEN_CPU_UID+1];
|
||||
getCPUUniqueID(str);
|
||||
serialPrint("uid = %s", str);
|
||||
}
|
||||
#endif
|
||||
#if defined(PCBFLAMENCO)
|
||||
else if (!strcmp(argv[1], "bq24195")) {
|
||||
{
|
||||
|
|
|
@ -155,13 +155,14 @@ char * strAppendNumber(char * dest, unsigned int value, uint8_t digits, uint8_t
|
|||
tmp /= radix;
|
||||
}
|
||||
}
|
||||
dest[digits] = '\0';
|
||||
while(digits > 0) {
|
||||
uint8_t idx = digits;
|
||||
while(idx > 0) {
|
||||
div_t qr = div(value, radix);
|
||||
dest[--digits] = (qr.rem >= 10 ? 'A' : '0') + qr.rem;
|
||||
dest[--idx] = (qr.rem >= 10 ? 'A'-10 : '0') + qr.rem;
|
||||
value = qr.quot;
|
||||
}
|
||||
return dest + digits;
|
||||
dest[digits] = '\0';
|
||||
return &dest[digits];
|
||||
}
|
||||
|
||||
#if defined(CPUARM) || defined(SDCARD)
|
||||
|
|
|
@ -39,6 +39,16 @@ void watchdogInit(unsigned int duration)
|
|||
IWDG->KR = 0xCCCC ; // start
|
||||
}
|
||||
|
||||
void getCPUUniqueID(char * s)
|
||||
{
|
||||
uint32_t * cpu_uid = (uint32_t *)0x1FFF7A10;
|
||||
char * tmp = strAppendNumber(s, cpu_uid[0], 8, 16);
|
||||
*tmp = ' ';
|
||||
tmp = strAppendNumber(tmp+1, cpu_uid[1], 8, 16);
|
||||
*tmp = ' ';
|
||||
strAppendNumber(tmp+1, cpu_uid[2], 8, 16);
|
||||
}
|
||||
|
||||
// Start TIMER7 at 2000000Hz
|
||||
void init2MhzTimer()
|
||||
{
|
||||
|
|
|
@ -116,6 +116,10 @@ void delay_ms(uint16_t nb);
|
|||
}
|
||||
#endif
|
||||
|
||||
// CPU Unique ID
|
||||
#define LEN_CPU_UID (3*8+2)
|
||||
void getCPUUniqueID(char * s);
|
||||
|
||||
// SD driver
|
||||
#if !defined(SIMU) || defined(SIMU_DISKIO)
|
||||
uint32_t sdIsHC(void);
|
||||
|
|
|
@ -39,6 +39,16 @@ void watchdogInit(unsigned int duration)
|
|||
IWDG->KR = 0xCCCC ; // start
|
||||
}
|
||||
|
||||
void getCPUUniqueID(char * s)
|
||||
{
|
||||
uint32_t * cpu_uid = (uint32_t *)0x1FFF7A10;
|
||||
char * tmp = strAppendNumber(s, cpu_uid[0], 8, 16);
|
||||
*tmp = ' ';
|
||||
tmp = strAppendNumber(tmp+1, cpu_uid[1], 8, 16);
|
||||
*tmp = ' ';
|
||||
strAppendNumber(tmp+1, cpu_uid[2], 8, 16);
|
||||
}
|
||||
|
||||
// Starts TIMER at 2MHz
|
||||
void init2MhzTimer()
|
||||
{
|
||||
|
|
|
@ -144,6 +144,10 @@ void delay(uint32_t ms);
|
|||
}
|
||||
#endif
|
||||
|
||||
// CPU Unique ID
|
||||
#define LEN_CPU_UID (3*8+2)
|
||||
void getCPUUniqueID(char * s);
|
||||
|
||||
// SD driver
|
||||
#if !defined(SIMU) || defined(SIMU_DISKIO)
|
||||
uint32_t sdIsHC(void);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue