Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 29 additions & 8 deletions Marlin/src/gcode/host/M115.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
#include "../../feature/caselight.h"
#endif

#if ENABLED(HAS_STM32_UID) && !defined(MACHINE_UUID)
#include "../../libs/hex_print.h"
#endif

//#define MINIMAL_CAP_LINES // Don't even mention the disabled capabilities

#if ENABLED(EXTENDED_CAPABILITIES_REPORT)
Expand Down Expand Up @@ -59,20 +63,37 @@
* the capability is not present.
*/
void GcodeSuite::M115() {
SERIAL_ECHOLNPGM(
"FIRMWARE_NAME:Marlin " DETAILED_BUILD_VERSION " (" __DATE__ " " __TIME__ ") "
"SOURCE_CODE_URL:" SOURCE_CODE_URL " "
"PROTOCOL_VERSION:" PROTOCOL_VERSION " "
"MACHINE_TYPE:" MACHINE_NAME " "
"EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " "
SERIAL_ECHOPGM("FIRMWARE_NAME:Marlin"
" " DETAILED_BUILD_VERSION " (" __DATE__ " " __TIME__ ")"
" SOURCE_CODE_URL:" SOURCE_CODE_URL
" PROTOCOL_VERSION:" PROTOCOL_VERSION
" MACHINE_TYPE:" MACHINE_NAME
" EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS)
#if NUM_AXES != XYZ
"AXIS_COUNT:" STRINGIFY(NUM_AXES) " "
" AXIS_COUNT:" STRINGIFY(NUM_AXES)
#endif
#ifdef MACHINE_UUID
"UUID:" MACHINE_UUID
" UUID:" MACHINE_UUID
#endif
);

// STM32UID:111122223333
#if ENABLED(HAS_STM32_UID) && !defined(MACHINE_UUID)
// STM32 based devices output the CPU device serial number
// Used by LumenPnP / OpenPNP to keep track of unique hardware/configurations
// https://github.com/opulo-inc/lumenpnp
// Although this code should work on all STM32 based boards
SERIAL_ECHOPGM(" UUID:");
uint32_t *uid_address = (uint32_t*)UID_BASE;
LOOP_L_N(i, 3) {
const uint32_t UID = uint32_t(READ_REG(*(uid_address)));
uid_address += 4U;
for (int B = 24; B >= 0; B -= 8) print_hex_byte(UID >> B);
}
#endif

SERIAL_EOL();

#if ENABLED(EXTENDED_CAPABILITIES_REPORT)

// The port that sent M115
Expand Down
3 changes: 3 additions & 0 deletions Marlin/src/pins/stm32f4/pins_OPULO_LUMEN_REV3.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@

// I2C MCP3426 (16-Bit, 240SPS, dual-channel ADC)
#define HAS_MCP3426_ADC
#ifdef STM32F4
#define HAS_STM32_UID
#endif

//
// Servos
Expand Down