Skip to content

Commit e668d5a

Browse files
ellenspthinkyhead
andauthored
🔧 STM32 UID followup (MarlinFirmware#26727)
Co-authored-by: Scott Lahteine <[email protected]>
1 parent a222827 commit e668d5a

File tree

5 files changed

+8
-18
lines changed

5 files changed

+8
-18
lines changed

Marlin/src/gcode/host/M115.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#include "../../feature/caselight.h"
3636
#endif
3737

38-
#if !defined(MACHINE_UUID) && HAS_STM32_UID
38+
#if !defined(MACHINE_UUID) && ENABLED(HAS_STM32_UID)
3939
#include "../../libs/hex_print.h"
4040
#endif
4141

@@ -72,15 +72,15 @@ void GcodeSuite::M115() {
7272
#if NUM_AXES != XYZ
7373
" AXIS_COUNT:" STRINGIFY(NUM_AXES)
7474
#endif
75-
#if defined(MACHINE_UUID) || HAS_STM32_UID
75+
#if defined(MACHINE_UUID) || ENABLED(HAS_STM32_UID)
7676
" UUID:"
7777
#endif
7878
#ifdef MACHINE_UUID
7979
MACHINE_UUID
8080
#endif
8181
);
8282

83-
#if !defined(MACHINE_UUID) && HAS_STM32_UID
83+
#if !defined(MACHINE_UUID) && ENABLED(HAS_STM32_UID)
8484
/**
8585
* STM32-based devices have a 96-bit CPU device serial number.
8686
* Used by LumenPnP / OpenPNP to keep track of unique hardware/configurations.
@@ -93,7 +93,7 @@ void GcodeSuite::M115() {
9393
#else
9494
uint16_t * const UID = (uint16_t*)UID_BASE;
9595
SERIAL_ECHO(
96-
F("CEDE2A2F-"), hex_word(UID[0]), '-', hex_word(UID[1]), '-', hex_word(UID[2]), '-',
96+
F("CEDE2A2F-"), hex_word(UID[0]), C('-'), hex_word(UID[1]), C('-'), hex_word(UID[2]), C('-'),
9797
hex_word(UID[3]), hex_word(UID[4]), hex_word(UID[5])
9898
);
9999
#endif

Marlin/src/libs/hex_print.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ char* _hex_word(const uint16_t w);
3535
char* hex_address(const void * const w);
3636
char* _hex_long(const uintptr_t l);
3737

38-
template<typename T> char* hex_word(T w) { return hex_word((uint16_t)w); }
39-
template<typename T> char* hex_long(T w) { return hex_long((uint32_t)w); }
38+
template<typename T> char* hex_word(T w) { return _hex_word((uint16_t)w); }
39+
template<typename T> char* hex_long(T w) { return _hex_long((uint32_t)w); }
4040

4141
void print_hex_nybble(const uint8_t n);
4242
void print_hex_byte(const uint8_t b);

Marlin/src/pins/stm32f4/pins_OPULO_LUMEN_REV3.h

-5
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@
4545
// I2C MCP3426 (16-Bit, 240SPS, dual-channel ADC)
4646
#define HAS_MCP3426_ADC
4747

48-
// Opulo Lumen uses the CPU serial number
49-
#ifdef STM32F4
50-
#define HAS_STM32_UID 1
51-
#endif
52-
5348
//
5449
// Servos
5550
//

Marlin/src/pins/stm32f4/pins_OPULO_LUMEN_REV4.h

-5
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@
4545
// I2C MCP3426 (16-Bit, 240SPS, dual-channel ADC)
4646
#define HAS_MCP3426_ADC
4747

48-
// Opulo Lumen uses the CPU serial number
49-
#ifdef STM32F4
50-
#define HAS_STM32_UID 1
51-
#endif
52-
5348
//
5449
// Servos
5550
//

ini/stm32f4.ini

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ extends = stm32_variant
111111
board = marlin_opulo_lumen_rev3
112112
build_flags = ${stm32_variant.build_flags}
113113
-DARDUINO_BLACK_F407VE
114-
-DUSBD_USE_CDC_COMPOSITE -DUSE_USB_FS
114+
-DUSBD_USE_CDC_COMPOSITE -DUSE_USB_FS -DHAS_STM32_UID
115115
extra_scripts = ${stm32_variant.extra_scripts}
116116

117117
#
@@ -122,7 +122,7 @@ extends = stm32_variant
122122
board = marlin_opulo_lumen_rev4
123123
build_flags = ${stm32_variant.build_flags}
124124
-DARDUINO_BLACK_F407VE
125-
-DUSBD_USE_CDC_COMPOSITE -DUSE_USB_FS
125+
-DUSBD_USE_CDC_COMPOSITE -DUSE_USB_FS -DHAS_STM32_UID
126126
extra_scripts = ${stm32_variant.extra_scripts}
127127

128128
#

0 commit comments

Comments
 (0)