Skip to content

Commit

Permalink
Merge pull request #998 from vector76/to_hex_redundant
Browse files Browse the repository at this point in the history
Uniform (and not redundant) treatment of "0x" with to_hex()
  • Loading branch information
MitchBradley authored Aug 15, 2023
2 parents 1d4e2a0 + 715a092 commit c9f94bf
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion FluidNC/esp32/sdspi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#define CHECK_EXECUTE_RESULT(err, str) \
do { \
if ((err) != ESP_OK) { \
log_error(str << " code 0x" << to_hex(err)); \
log_error(str << " code " << to_hex(err)); \
goto cleanup; \
} \
} while (0)
Expand Down
4 changes: 2 additions & 2 deletions FluidNC/esp32/tmc_spi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
// This is executed in the object context so it has access to class
// data such as the CS pin that switchCSpin() uses
void TMC2130Stepper::write(uint8_t reg, uint32_t data) {
log_verbose("TMC reg 0x" << to_hex(reg) << " write 0x" << to_hex(data));
log_verbose("TMC reg " << to_hex(reg) << " write " << to_hex(data));
tmc_spi_bus_setup();

switchCSpin(0);
Expand Down Expand Up @@ -88,7 +88,7 @@ uint32_t TMC2130Stepper::read(uint8_t reg) {
data += (uint32_t)in[dummy_in_bytes + 4];
switchCSpin(1);

log_verbose("TMC reg 0x" << to_hex(reg) << " read 0x" << to_hex(data) << " status 0x" << to_hex(status));
log_verbose("TMC reg " << to_hex(reg) << " read " << to_hex(data) << " status " << to_hex(status));

return data;
}
14 changes: 7 additions & 7 deletions FluidNC/src/Motors/TMC2209Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ namespace MotorDrivers {
}

// dump the registers. This is helpful for people migrating to the Pro version
log_verbose("CHOPCONF: 0x" << to_hex(tmc2209->CHOPCONF()));
log_verbose("COOLCONF: 0x" << to_hex(tmc2209->COOLCONF()));
log_verbose("TPWMTHRS: 0x" << to_hex(tmc2209->TPWMTHRS()));
log_verbose("TCOOLTHRS: 0x" << to_hex(tmc2209->TCOOLTHRS()));
log_verbose("GCONF: 0x" << to_hex(tmc2209->GCONF()));
log_verbose("PWMCONF: 0x" << to_hex(tmc2209->PWMCONF()));
log_verbose("IHOLD_IRUN: 0x" << to_hex(tmc2209->IHOLD_IRUN()));
log_verbose("CHOPCONF: " << to_hex(tmc2209->CHOPCONF()));
log_verbose("COOLCONF: " << to_hex(tmc2209->COOLCONF()));
log_verbose("TPWMTHRS: " << to_hex(tmc2209->TPWMTHRS()));
log_verbose("TCOOLTHRS: " << to_hex(tmc2209->TCOOLTHRS()));
log_verbose("GCONF: " << to_hex(tmc2209->GCONF()));
log_verbose("PWMCONF: " << to_hex(tmc2209->PWMCONF()));
log_verbose("IHOLD_IRUN: " << to_hex(tmc2209->IHOLD_IRUN()));

_cs_pin.synchronousWrite(false);
}
Expand Down
14 changes: 7 additions & 7 deletions FluidNC/src/Motors/TMC5160Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ namespace MotorDrivers {
}
}
// dump the registers. This is helpful for people migrating to the Pro version
log_verbose("CHOPCONF: 0x" << to_hex(tmc5160->CHOPCONF()));
log_verbose("COOLCONF: 0x" << to_hex(tmc5160->COOLCONF()));
log_verbose("THIGH: 0x" << to_hex(tmc5160->THIGH()));
log_verbose("TCOOLTHRS: 0x" << to_hex(tmc5160->TCOOLTHRS()));
log_verbose("GCONF: 0x" << to_hex(tmc5160->GCONF()));
log_verbose("PWMCONF: 0x" << to_hex(tmc5160->PWMCONF()));
log_verbose("IHOLD_IRUN: 0x" << to_hex(tmc5160->IHOLD_IRUN()));
log_verbose("CHOPCONF: " << to_hex(tmc5160->CHOPCONF()));
log_verbose("COOLCONF: " << to_hex(tmc5160->COOLCONF()));
log_verbose("THIGH: " << to_hex(tmc5160->THIGH()));
log_verbose("TCOOLTHRS: " << to_hex(tmc5160->TCOOLTHRS()));
log_verbose("GCONF: " << to_hex(tmc5160->GCONF()));
log_verbose("PWMCONF: " << to_hex(tmc5160->PWMCONF()));
log_verbose("IHOLD_IRUN: " << to_hex(tmc5160->IHOLD_IRUN()));
}

// Report diagnostic and tuning info
Expand Down
4 changes: 2 additions & 2 deletions FluidNC/src/Motors/TrinamicBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ namespace MotorDrivers {

bool TrinamicBase::checkVersion(uint8_t expected, uint8_t got) {
if (expected != got) {
log_error(axisName() << " TMC driver not detected - expected 0x" << to_hex(expected) << " got 0x" << to_hex(got));
log_error(axisName() << " TMC driver not detected - expected " << to_hex(expected) << " got " << to_hex(got));
return false;
}
log_info(axisName() << " driver test passed");
Expand Down Expand Up @@ -146,7 +146,7 @@ namespace MotorDrivers {
// Display the stepper library version message once, before the first
// TMC config message.
if (_instances.empty()) {
log_debug("TMCStepper Library Ver. 0x" << to_hex(TMCSTEPPER_VERSION));
log_debug("TMCStepper Library Ver. " << to_hex(TMCSTEPPER_VERSION));
auto timer = xTimerCreate("Stallguard", 200, true, nullptr, read_sg);
// Timer failure is not fatal because you can still use the system
if (!timer) {
Expand Down
2 changes: 1 addition & 1 deletion FluidNC/src/OLED.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void OLED::init() {
if (_error) {
return;
}
log_info("OLED I2C address:" << to_hex(_address) << " width: " << _width << " height: " << _height);
log_info("OLED I2C address: " << to_hex(_address) << " width: " << _width << " height: " << _height);
_oled = new SSD1306_I2C(_address, _geometry, config->_i2c[_i2c_num], 400000);
_oled->init();

Expand Down

0 comments on commit c9f94bf

Please sign in to comment.