Skip to content

Commit

Permalink
🩹 Update some hex-printing (MarlinFirmware#27654)
Browse files Browse the repository at this point in the history
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
  • Loading branch information
classicrocker883 and thinkyhead authored Jan 26, 2025
1 parent ab7137a commit 0cd1d9c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1795,14 +1795,14 @@ void unified_bed_leveling::smart_fill_mesh() {
SERIAL_ECHOLNPGM("ubl_state_at_invocation :", ubl_state_at_invocation, "\nubl_state_recursion_chk :", ubl_state_recursion_chk);
serial_delay(50);

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

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

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

SERIAL_ECHOLNPGM("EEPROM can hold ", settings.calc_num_meshes(), " meshes.\n");
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ void GCodeParser::parse(char *p) {
if (!has_val && !string_arg) { // No value? First time, keep as string_arg
string_arg = p - 1;
#if ENABLED(DEBUG_GCODE_PARSER)
if (debug) SERIAL_ECHOPGM(" string_arg: ", hex_address((void*)string_arg)); // DEBUG
if (debug) SERIAL_ECHOPGM(" string_arg: ", hex_address(string_arg)); // DEBUG
#endif
}

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

Expand Down
7 changes: 2 additions & 5 deletions Marlin/src/gcode/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,8 @@ class GCodeParser {
SBI32(codebits, ind); // parameter exists
param[ind] = ptr ? ptr - command_ptr : 0; // parameter offset or 0
#if ENABLED(DEBUG_GCODE_PARSER)
if (codenum == 800) {
SERIAL_ECHOPGM("Set bit ", ind, " of codebits (", hex_address((void*)(codebits >> 16)));
print_hex_word((uint16_t)(codebits & 0xFFFF));
SERIAL_ECHOLNPGM(") | param = ", param[ind]);
}
if (codenum == 800)
SERIAL_ECHOLNPGM("Set bit ", ind, " of codebits (", _hex_long(codebits), ") | param = ", param[ind]);
#endif
}

Expand Down
14 changes: 7 additions & 7 deletions Marlin/src/sd/cardreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1089,15 +1089,15 @@ const char* CardReader::diveToFile(const bool update_cwd, MediaFile* &inDirPtr,
if (path[0] == '/') { // Starting at the root directory?
inDirPtr = &root;
atom_ptr++;
DEBUG_ECHOLNPGM(" CWD to root: ", hex_address((void*)inDirPtr));
DEBUG_ECHOLNPGM(" CWD to root: ", hex_address(inDirPtr));
if (update_cwd) workDirDepth = 0; // The cwd can be updated for the benefit of sub-programs
}
else
inDirPtr = &workDir; // Dive from workDir (as set by the UI)

startDirPtr = inDirPtr;

DEBUG_ECHOLNPGM(" startDirPtr = ", hex_address((void*)startDirPtr));
DEBUG_ECHOLNPGM(" startDirPtr = ", hex_address(startDirPtr));

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

if (echo) SERIAL_ECHOLN(dosSubdirname);

DEBUG_ECHOLNPGM(" sub = ", hex_address((void*)sub));
DEBUG_ECHOLNPGM(" sub = ", hex_address(sub));

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

// Close inDirPtr if not at starting-point
if (inDirPtr != startDirPtr) {
DEBUG_ECHOLNPGM(" closing inDirPtr: ", hex_address((void*)inDirPtr));
DEBUG_ECHOLNPGM(" closing inDirPtr: ", hex_address(inDirPtr));
inDirPtr->close();
}

// inDirPtr now subDir
inDirPtr = sub;
DEBUG_ECHOLNPGM(" inDirPtr = sub: ", hex_address((void*)inDirPtr));
DEBUG_ECHOLNPGM(" inDirPtr = sub: ", hex_address(inDirPtr));

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

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

// Next path atom address
atom_ptr = name_end + 1;
}

if (update_cwd) {
workDir = *inDirPtr;
DEBUG_ECHOLNPGM(" final workDir = ", hex_address((void*)inDirPtr));
DEBUG_ECHOLNPGM(" final workDir = ", hex_address(inDirPtr));
flag.workDirIsRoot = (workDirDepth == 0);
TERN_(SDCARD_SORT_ALPHA, presort());
}
Expand Down

0 comments on commit 0cd1d9c

Please sign in to comment.