Skip to content

Commit

Permalink
tweak, move
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Sep 16, 2022
1 parent 32831ce commit 24ac040
Showing 1 changed file with 26 additions and 39 deletions.
65 changes: 26 additions & 39 deletions Marlin/src/gcode/host/M115.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,38 @@
* 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 MB(INDEX_REV03) && defined(STM32F4)
// 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(" STM32UID:");
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);
print_hex_long(UID);
}
#endif

SERIAL_EOL();

#if ENABLED(EXTENDED_CAPABILITIES_REPORT)

// The port that sent M115
Expand Down Expand Up @@ -196,37 +214,6 @@ void GcodeSuite::M115() {
// CONFIG_EXPORT
cap_line(F("CONFIG_EXPORT"), ENABLED(CONFIGURATION_EMBEDDING));




#if MB(INDEX_REV03)
#ifdef STM32F4
//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("Cap:");
SERIAL_ECHOF(F("STM32UID"));
SERIAL_CHAR(':');

uint32_t * uid_address=(uint32_t *)UID_BASE;
for (int loop = 0; loop <3; loop++ ) {

uint32_t UID;
UID = (uint32_t)(READ_REG(*(uid_address)));
uid_address+=4U;

// Output the 32bit value as HEX characters
for (int B = 24; B >= 8; B -= 8) {
print_hex_byte(UID >> B);
}
print_hex_byte(UID);
}
SERIAL_EOL();
#endif
#endif

// Machine Geometry
#if ENABLED(M115_GEOMETRY_REPORT)
const xyz_pos_t bmin = { 0, 0, 0 },
Expand Down

0 comments on commit 24ac040

Please sign in to comment.