From 307103f95a0375c23cec04d46541fa290d503025 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Mon, 31 Oct 2016 18:47:15 +0100 Subject: [PATCH 1/2] 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. --- Multiprotocol/Multiprotocol.ino | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Multiprotocol/Multiprotocol.ino b/Multiprotocol/Multiprotocol.ino index fc965f5..cf7900e 100644 --- a/Multiprotocol/Multiprotocol.ino +++ b/Multiprotocol/Multiprotocol.ino @@ -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); From 20cb173f8ea366486e7e1c27ac97fcefe350de3e Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Mon, 31 Oct 2016 18:48:00 +0100 Subject: [PATCH 2/2] Default to defining STM32_BOARD when compiling for arm --- Multiprotocol/_Config.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Multiprotocol/_Config.h b/Multiprotocol/_Config.h index 5421a84..4f772d3 100644 --- a/Multiprotocol/_Config.h +++ b/Multiprotocol/_Config.h @@ -22,7 +22,9 @@ /********************/ //Uncomment one of the line below if you have a different module not based on the original Multi Atmega328p design which includes the 4-in-1. //If you don't know then leave them commented. -//#define STM32_BOARD +#ifdef __arm__ +#define STM32_BOARD +#endif /*******************/