Skip to content

Commit 0cd1d9c

Browse files
🩹 Update some hex-printing (MarlinFirmware#27654)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
1 parent ab7137a commit 0cd1d9c

File tree

4 files changed

+13
-16
lines changed

4 files changed

+13
-16
lines changed

Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1795,14 +1795,14 @@ void unified_bed_leveling::smart_fill_mesh() {
17951795
SERIAL_ECHOLNPGM("ubl_state_at_invocation :", ubl_state_at_invocation, "\nubl_state_recursion_chk :", ubl_state_recursion_chk);
17961796
serial_delay(50);
17971797

1798-
SERIAL_ECHOLNPGM("Meshes go from ", hex_address((void*)settings.meshes_start_index()), " to ", hex_address((void*)settings.meshes_end_index()));
1798+
SERIAL_ECHOLNPGM("Meshes go from ", _hex_word(settings.meshes_start_index()), " to ", _hex_word(settings.meshes_end_index()));
17991799
serial_delay(50);
18001800

18011801
SERIAL_ECHOLNPGM("sizeof(unified_bed_leveling) : ", sizeof(unified_bed_leveling));
18021802
SERIAL_ECHOLNPGM("z_value[][] size: ", sizeof(z_values));
18031803
serial_delay(25);
18041804

1805-
SERIAL_ECHOLNPGM("EEPROM free for UBL: ", hex_address((void*)(settings.meshes_end_index() - settings.meshes_start_index())));
1805+
SERIAL_ECHOLNPGM("EEPROM free for UBL: ", _hex_word(settings.meshes_end_index() - settings.meshes_start_index()));
18061806
serial_delay(50);
18071807

18081808
SERIAL_ECHOLNPGM("EEPROM can hold ", settings.calc_num_meshes(), " meshes.\n");

Marlin/src/gcode/parser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ void GCodeParser::parse(char *p) {
348348
if (!has_val && !string_arg) { // No value? First time, keep as string_arg
349349
string_arg = p - 1;
350350
#if ENABLED(DEBUG_GCODE_PARSER)
351-
if (debug) SERIAL_ECHOPGM(" string_arg: ", hex_address((void*)string_arg)); // DEBUG
351+
if (debug) SERIAL_ECHOPGM(" string_arg: ", hex_address(string_arg)); // DEBUG
352352
#endif
353353
}
354354

@@ -359,7 +359,7 @@ void GCodeParser::parse(char *p) {
359359
else if (!string_arg) { // Not A-Z? First time, keep as the string_arg
360360
string_arg = p - 1;
361361
#if ENABLED(DEBUG_GCODE_PARSER)
362-
if (debug) SERIAL_ECHOPGM(" string_arg: ", hex_address((void*)string_arg)); // DEBUG
362+
if (debug) SERIAL_ECHOPGM(" string_arg: ", hex_address(string_arg)); // DEBUG
363363
#endif
364364
}
365365

Marlin/src/gcode/parser.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,8 @@ class GCodeParser {
132132
SBI32(codebits, ind); // parameter exists
133133
param[ind] = ptr ? ptr - command_ptr : 0; // parameter offset or 0
134134
#if ENABLED(DEBUG_GCODE_PARSER)
135-
if (codenum == 800) {
136-
SERIAL_ECHOPGM("Set bit ", ind, " of codebits (", hex_address((void*)(codebits >> 16)));
137-
print_hex_word((uint16_t)(codebits & 0xFFFF));
138-
SERIAL_ECHOLNPGM(") | param = ", param[ind]);
139-
}
135+
if (codenum == 800)
136+
SERIAL_ECHOLNPGM("Set bit ", ind, " of codebits (", _hex_long(codebits), ") | param = ", param[ind]);
140137
#endif
141138
}
142139

Marlin/src/sd/cardreader.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,15 +1089,15 @@ const char* CardReader::diveToFile(const bool update_cwd, MediaFile* &inDirPtr,
10891089
if (path[0] == '/') { // Starting at the root directory?
10901090
inDirPtr = &root;
10911091
atom_ptr++;
1092-
DEBUG_ECHOLNPGM(" CWD to root: ", hex_address((void*)inDirPtr));
1092+
DEBUG_ECHOLNPGM(" CWD to root: ", hex_address(inDirPtr));
10931093
if (update_cwd) workDirDepth = 0; // The cwd can be updated for the benefit of sub-programs
10941094
}
10951095
else
10961096
inDirPtr = &workDir; // Dive from workDir (as set by the UI)
10971097

10981098
startDirPtr = inDirPtr;
10991099

1100-
DEBUG_ECHOLNPGM(" startDirPtr = ", hex_address((void*)startDirPtr));
1100+
DEBUG_ECHOLNPGM(" startDirPtr = ", hex_address(startDirPtr));
11011101

11021102
while (atom_ptr) {
11031103
// Find next subdirectory delimiter
@@ -1113,7 +1113,7 @@ const char* CardReader::diveToFile(const bool update_cwd, MediaFile* &inDirPtr,
11131113

11141114
if (echo) SERIAL_ECHOLN(dosSubdirname);
11151115

1116-
DEBUG_ECHOLNPGM(" sub = ", hex_address((void*)sub));
1116+
DEBUG_ECHOLNPGM(" sub = ", hex_address(sub));
11171117

11181118
// Open inDirPtr (closing first)
11191119
sub->close();
@@ -1125,13 +1125,13 @@ const char* CardReader::diveToFile(const bool update_cwd, MediaFile* &inDirPtr,
11251125

11261126
// Close inDirPtr if not at starting-point
11271127
if (inDirPtr != startDirPtr) {
1128-
DEBUG_ECHOLNPGM(" closing inDirPtr: ", hex_address((void*)inDirPtr));
1128+
DEBUG_ECHOLNPGM(" closing inDirPtr: ", hex_address(inDirPtr));
11291129
inDirPtr->close();
11301130
}
11311131

11321132
// inDirPtr now subDir
11331133
inDirPtr = sub;
1134-
DEBUG_ECHOLNPGM(" inDirPtr = sub: ", hex_address((void*)inDirPtr));
1134+
DEBUG_ECHOLNPGM(" inDirPtr = sub: ", hex_address(inDirPtr));
11351135

11361136
// Update workDirParents and workDirDepth
11371137
if (update_cwd) {
@@ -1142,15 +1142,15 @@ const char* CardReader::diveToFile(const bool update_cwd, MediaFile* &inDirPtr,
11421142

11431143
// Point sub at the other scratch object
11441144
sub = (inDirPtr != &newDir1) ? &newDir1 : &newDir2;
1145-
DEBUG_ECHOLNPGM(" swapping sub = ", hex_address((void*)sub));
1145+
DEBUG_ECHOLNPGM(" swapping sub = ", hex_address(sub));
11461146

11471147
// Next path atom address
11481148
atom_ptr = name_end + 1;
11491149
}
11501150

11511151
if (update_cwd) {
11521152
workDir = *inDirPtr;
1153-
DEBUG_ECHOLNPGM(" final workDir = ", hex_address((void*)inDirPtr));
1153+
DEBUG_ECHOLNPGM(" final workDir = ", hex_address(inDirPtr));
11541154
flag.workDirIsRoot = (workDirDepth == 0);
11551155
TERN_(SDCARD_SORT_ALPHA, presort());
11561156
}

0 commit comments

Comments
 (0)