From e668d5afd75039fbbbc9a3a8c8357c74c399ccb7 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Thu, 25 Jan 2024 07:50:48 +1300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20STM32=20UID=20followup=20(#26727?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/gcode/host/M115.cpp | 8 ++++---- Marlin/src/libs/hex_print.h | 4 ++-- Marlin/src/pins/stm32f4/pins_OPULO_LUMEN_REV3.h | 5 ----- Marlin/src/pins/stm32f4/pins_OPULO_LUMEN_REV4.h | 5 ----- ini/stm32f4.ini | 4 ++-- 5 files changed, 8 insertions(+), 18 deletions(-) diff --git a/Marlin/src/gcode/host/M115.cpp b/Marlin/src/gcode/host/M115.cpp index cd2bcb0f94..d99737a261 100644 --- a/Marlin/src/gcode/host/M115.cpp +++ b/Marlin/src/gcode/host/M115.cpp @@ -35,7 +35,7 @@ #include "../../feature/caselight.h" #endif -#if !defined(MACHINE_UUID) && HAS_STM32_UID +#if !defined(MACHINE_UUID) && ENABLED(HAS_STM32_UID) #include "../../libs/hex_print.h" #endif @@ -72,7 +72,7 @@ void GcodeSuite::M115() { #if NUM_AXES != XYZ " AXIS_COUNT:" STRINGIFY(NUM_AXES) #endif - #if defined(MACHINE_UUID) || HAS_STM32_UID + #if defined(MACHINE_UUID) || ENABLED(HAS_STM32_UID) " UUID:" #endif #ifdef MACHINE_UUID @@ -80,7 +80,7 @@ void GcodeSuite::M115() { #endif ); - #if !defined(MACHINE_UUID) && HAS_STM32_UID + #if !defined(MACHINE_UUID) && ENABLED(HAS_STM32_UID) /** * STM32-based devices have a 96-bit CPU device serial number. * Used by LumenPnP / OpenPNP to keep track of unique hardware/configurations. @@ -93,7 +93,7 @@ void GcodeSuite::M115() { #else uint16_t * const UID = (uint16_t*)UID_BASE; SERIAL_ECHO( - F("CEDE2A2F-"), hex_word(UID[0]), '-', hex_word(UID[1]), '-', hex_word(UID[2]), '-', + F("CEDE2A2F-"), hex_word(UID[0]), C('-'), hex_word(UID[1]), C('-'), hex_word(UID[2]), C('-'), hex_word(UID[3]), hex_word(UID[4]), hex_word(UID[5]) ); #endif diff --git a/Marlin/src/libs/hex_print.h b/Marlin/src/libs/hex_print.h index 2278ec2c24..4a5cac2b6c 100644 --- a/Marlin/src/libs/hex_print.h +++ b/Marlin/src/libs/hex_print.h @@ -35,8 +35,8 @@ char* _hex_word(const uint16_t w); char* hex_address(const void * const w); char* _hex_long(const uintptr_t l); -template char* hex_word(T w) { return hex_word((uint16_t)w); } -template char* hex_long(T w) { return hex_long((uint32_t)w); } +template char* hex_word(T w) { return _hex_word((uint16_t)w); } +template char* hex_long(T w) { return _hex_long((uint32_t)w); } void print_hex_nybble(const uint8_t n); void print_hex_byte(const uint8_t b); diff --git a/Marlin/src/pins/stm32f4/pins_OPULO_LUMEN_REV3.h b/Marlin/src/pins/stm32f4/pins_OPULO_LUMEN_REV3.h index ae03e3c194..a256d2e7cb 100644 --- a/Marlin/src/pins/stm32f4/pins_OPULO_LUMEN_REV3.h +++ b/Marlin/src/pins/stm32f4/pins_OPULO_LUMEN_REV3.h @@ -45,11 +45,6 @@ // I2C MCP3426 (16-Bit, 240SPS, dual-channel ADC) #define HAS_MCP3426_ADC -// Opulo Lumen uses the CPU serial number -#ifdef STM32F4 - #define HAS_STM32_UID 1 -#endif - // // Servos // diff --git a/Marlin/src/pins/stm32f4/pins_OPULO_LUMEN_REV4.h b/Marlin/src/pins/stm32f4/pins_OPULO_LUMEN_REV4.h index 7df1fb31e6..f7daa4c3ec 100644 --- a/Marlin/src/pins/stm32f4/pins_OPULO_LUMEN_REV4.h +++ b/Marlin/src/pins/stm32f4/pins_OPULO_LUMEN_REV4.h @@ -45,11 +45,6 @@ // I2C MCP3426 (16-Bit, 240SPS, dual-channel ADC) #define HAS_MCP3426_ADC -// Opulo Lumen uses the CPU serial number -#ifdef STM32F4 - #define HAS_STM32_UID 1 -#endif - // // Servos // diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index de0a5c7d37..2ba5742f4f 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -111,7 +111,7 @@ extends = stm32_variant board = marlin_opulo_lumen_rev3 build_flags = ${stm32_variant.build_flags} -DARDUINO_BLACK_F407VE - -DUSBD_USE_CDC_COMPOSITE -DUSE_USB_FS + -DUSBD_USE_CDC_COMPOSITE -DUSE_USB_FS -DHAS_STM32_UID extra_scripts = ${stm32_variant.extra_scripts} # @@ -122,7 +122,7 @@ extends = stm32_variant board = marlin_opulo_lumen_rev4 build_flags = ${stm32_variant.build_flags} -DARDUINO_BLACK_F407VE - -DUSBD_USE_CDC_COMPOSITE -DUSE_USB_FS + -DUSBD_USE_CDC_COMPOSITE -DUSE_USB_FS -DHAS_STM32_UID extra_scripts = ${stm32_variant.extra_scripts} #