mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-07-12 09:47:54 +00:00
Use STM32 device ID as default ID for Multiprotocol. Has the advantage that this is persistent even the flash emulated EEPROM is wiped by reprogramming.
This commit is contained in:
parent
199d2cf851
commit
307103f95a
@ -1017,7 +1017,14 @@ static uint32_t random_id(uint16_t adress, uint8_t create_new)
|
||||
return id;
|
||||
}
|
||||
// Generate a random ID
|
||||
#if defined STM32_BOARD
|
||||
#define STM32_UUID ((uint32_t *)0x1FFFF7E8)
|
||||
if (!create_new)
|
||||
id = STM32_UUID[0] ^ STM32_UUID[1] ^ STM32_UUID[2];
|
||||
else
|
||||
#else
|
||||
id = random(0xfefefefe) + ((uint32_t)random(0xfefefefe) << 16);
|
||||
#endif
|
||||
for(uint8_t i=0;i<4;i++)
|
||||
{
|
||||
eeprom_write_byte((EE_ADDR)adress+i,id);
|
||||
|
Loading…
x
Reference in New Issue
Block a user