Skip to content

Commit

Permalink
Remove debug printout warnings (#1091)
Browse files Browse the repository at this point in the history
Exposed by #1090, remove ugly printf format warnings while in debug mode
  • Loading branch information
earlephilhower authored Jan 2, 2023
1 parent 0e6ca28 commit 444bb24
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion cores/rp2040/Tone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void tone(uint8_t pin, unsigned int frequency, unsigned long duration) {
if (ret > 0) {
newTone->alarm = ret;
} else {
DEBUGCORE("ERROR: Unable to allocate timer for tone(%d, %d, %d)\n",
DEBUGCORE("ERROR: Unable to allocate timer for tone(%d, %d, %lu)\n",
pin, frequency, duration);
}
}
Expand Down
10 changes: 5 additions & 5 deletions cores/rp2040/wiring_analog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ extern "C" void analogWriteFreq(uint32_t freq) {
return;
}
if (freq < 100) {
DEBUGCORE("ERROR: analogWriteFreq too low (%d)\n", freq);
DEBUGCORE("ERROR: analogWriteFreq too low (%lu)\n", freq);
analogFreq = 100;
} else if (freq > 10'000'000) {
DEBUGCORE("ERROR: analogWriteFreq too high (%d)\n", freq);
DEBUGCORE("ERROR: analogWriteFreq too high (%lu)\n", freq);
analogFreq = 10'000'000;
} else {
analogFreq = freq;
Expand All @@ -64,7 +64,7 @@ extern "C" void analogWriteRange(uint32_t range) {
pwmInitted = 0;
scaleInitted = false;
} else {
DEBUGCORE("ERROR: analogWriteRange out of range (%d)\n", range);
DEBUGCORE("ERROR: analogWriteRange out of range (%lu)\n", range);
}
}

Expand All @@ -90,14 +90,14 @@ extern "C" void analogWrite(pin_size_t pin, int val) {
while (((clock_get_hz(clk_sys) / ((float)analogScale * analogFreq)) > 255.0) && (analogScale < 32678)) {
analogWritePseudoScale++;
analogScale *= 2;
DEBUGCORE("Adjusting analogWrite values PS=%d, scale=%d\n", analogWritePseudoScale, analogScale);
DEBUGCORE("Adjusting analogWrite values PS=%d, scale=%lu\n", analogWritePseudoScale, analogScale);
}
// For high frequencies, we need to scale the output max value down to actually hit the frequency target
analogWriteSlowScale = 1;
while (((clock_get_hz(clk_sys) / ((float)analogScale * analogFreq)) < 1.0) && (analogScale >= 6)) {
analogWriteSlowScale++;
analogScale /= 2;
DEBUGCORE("Adjusting analogWrite values SS=%d, scale=%d\n", analogWriteSlowScale, analogScale);
DEBUGCORE("Adjusting analogWrite values SS=%d, scale=%lu\n", analogWriteSlowScale, analogScale);
}
scaleInitted = true;
}
Expand Down
4 changes: 2 additions & 2 deletions libraries/LittleFS/src/LittleFS.h
Original file line number Diff line number Diff line change
Expand Up @@ -457,14 +457,14 @@ class LittleFSFileImpl : public FileImpl {
if (_creation) {
int rc = lfs_setattr(_fs->getFS(), _name.get(), 'c', (const void *)&_creation, sizeof(_creation));
if (rc < 0) {
DEBUGV("Unable to set creation time on '%s' to %d\n", _name.get(), _creation);
DEBUGV("Unable to set creation time on '%s' to %lld\n", _name.get(), _creation);
}
}
// Add metadata with last write time
time_t now = _timeCallback();
int rc = lfs_setattr(_fs->getFS(), _name.get(), 't', (const void *)&now, sizeof(now));
if (rc < 0) {
DEBUGV("Unable to set last write time on '%s' to %d\n", _name.get(), now);
DEBUGV("Unable to set last write time on '%s' to %lld\n", _name.get(), now);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/SPI/src/SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ void SPIClassRP2040::transfer(const void *txbuf, void *rxbuf, size_t count) {
}

void SPIClassRP2040::beginTransaction(SPISettings settings) {
DEBUGSPI("SPI::beginTransaction(clk=%d, bo=%s\n", _spis.getClockFreq(), (_spis.getBitOrder() == MSBFIRST) ? "MSB" : "LSB");
DEBUGSPI("SPI::beginTransaction(clk=%lu, bo=%s\n", _spis.getClockFreq(), (_spis.getBitOrder() == MSBFIRST) ? "MSB" : "LSB");
if (_initted && settings == _spis) {
DEBUGSPI("SPI: Reusing existing initted SPI\n");
} else {
Expand Down
6 changes: 3 additions & 3 deletions libraries/Updater/src/Updater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ bool UpdaterClass::begin(size_t size, int command) {
_command = command;

#ifdef DEBUG_UPDATER
DEBUG_UPDATER.printf_P(PSTR("[begin] _startAddress: 0x%08X (%d)\n"), _startAddress, _startAddress);
DEBUG_UPDATER.printf_P(PSTR("[begin] _startAddress: 0x%08lX (%lu)\n"), _startAddress, _startAddress);
DEBUG_UPDATER.printf_P(PSTR("[begin] _size: 0x%08zX (%zd)\n"), _size, _size);
#endif

Expand Down Expand Up @@ -188,7 +188,7 @@ bool UpdaterClass::end(bool evenIfRemaining) {
_fp.read((uint8_t *)&sigLen, sizeof(uint32_t));
}
#ifdef DEBUG_UPDATER
DEBUG_UPDATER.printf_P(PSTR("[Updater] sigLen: %d\n"), sigLen);
DEBUG_UPDATER.printf_P(PSTR("[Updater] sigLen: %lu\n"), sigLen);
#endif
if (sigLen != expectedSigLen) {
_setError(UPDATE_ERROR_SIGN);
Expand Down Expand Up @@ -276,7 +276,7 @@ bool UpdaterClass::end(bool evenIfRemaining) {
picoOTA.addFile("firmware.bin");
picoOTA.commit();
#ifdef DEBUG_UPDATER
DEBUG_UPDATER.printf_P(PSTR("Staged: address:0x%08X, size:0x%08zX\n"), _startAddress, _size);
DEBUG_UPDATER.printf_P(PSTR("Staged: address:0x%08lX, size:0x%08zX\n"), _startAddress, _size);
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion libraries/WiFi/src/WiFiMulti.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ uint8_t WiFiMulti::run(uint32_t to) {
for (int i = 0; i < cnt; i++) {
if (WiFi.RSSI(i) > maxRSSID) {
for (auto j = _list.begin(); j != _list.end(); j++) {
DEBUGV("[WIFIMULTI] Checking for '%s' at %d\n", WiFi.SSID(i), WiFi.RSSI(i));
DEBUGV("[WIFIMULTI] Checking for '%s' at %ld\n", WiFi.SSID(i), WiFi.RSSI(i));
if (!strcmp(j->ssid, WiFi.SSID(i))) {
hit = j;
maxRSSID = WiFi.RSSI(i);
Expand Down
2 changes: 1 addition & 1 deletion libraries/WiFi/src/include/ClientContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ class ClientContext {

void _error(err_t err) {
(void) err;
DEBUGV(":er %d 0x%08x\r\n", (int) err, (uint32_t) _datasource);
DEBUGV(":er %d 0x%08lx\r\n", (int) err, (uint32_t) _datasource);
tcp_arg(_pcb, nullptr);
tcp_sent(_pcb, nullptr);
tcp_recv(_pcb, nullptr);
Expand Down

0 comments on commit 444bb24

Please sign in to comment.