Skip to content

Commit 4f4e638

Browse files
Replace most remaining ESP_ debug macros (#2305)
In ported libraries there were still some remaining DEBUG_ESP_PORT references. Moved to their RP2040 equivalents.
1 parent 34f386a commit 4f4e638

File tree

9 files changed

+37
-43
lines changed

9 files changed

+37
-43
lines changed

libraries/ArduinoOTA/src/ArduinoOTA.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,22 @@
2222
#include <functional>
2323
#include <WiFiUdp.h>
2424
#include "ArduinoOTA.h"
25-
#include "MD5Builder.h"
25+
#include <MD5Builder.h>
2626
#include <PicoOTA.h>
2727
#include <StreamString.h>
2828

29-
#include "lwip/udp.h"
30-
#include "include/UdpContext.h"
29+
#include <lwip/udp.h>
30+
#include <include/UdpContext.h>
3131

3232
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_MDNS)
3333
#include <LEAmDNS.h>
3434
#endif
3535

36-
//#ifdef DEBUG_ESP_OTA
37-
//#ifdef DEBUG_ESP_PORT
38-
//#define OTA_DEBUG DEBUG_ESP_PORT
39-
//#endif
40-
//#endif
41-
#define OTA_DEBUG Serial
36+
#ifdef DEBUG_RP2040_CORE
37+
#ifdef DEBUG_RP2040_PORT
38+
#define OTA_DEBUG DEBUG_RP2040_PORT
39+
#endif
40+
#endif
4241

4342
ArduinoOTAClass::ArduinoOTAClass() {
4443
}

libraries/DNSServer/src/DNSServer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
#include <lwip/def.h>
2525
#include <Arduino.h>
2626

27-
#ifdef DEBUG_ESP_PORT
28-
#define CONSOLE DEBUG_ESP_PORT
27+
#ifdef DEBUG_RP2040_PORT
28+
#define CONSOLE DEBUG_RP2040_PORT
2929
#else
3030
#define CONSOLE Serial
3131
#endif

libraries/HTTPUpdate/src/HTTPUpdate.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
#include <WiFiUdp.h>
3232
#include <HTTPClient.h>
3333

34-
#ifdef DEBUG_ESP_HTTP_UPDATE
35-
#ifdef DEBUG_ESP_PORT
36-
#define DEBUG_HTTP_UPDATE(fmt, ...) DEBUG_ESP_PORT.printf_P( (PGM_P)PSTR(fmt), ## __VA_ARGS__ )
34+
#ifdef DEBUG_RP2040_CORE
35+
#ifdef DEBUG_RP2040_PORT
36+
#define DEBUG_HTTP_UPDATE(fmt, ...) DEBUG_RP2040_PORT.printf_P( (PGM_P)PSTR(fmt), ## __VA_ARGS__ )
3737
#endif
3838
#endif
3939

libraries/SD/src/SD.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
SD.h - A thin shim for Arduino ESP8266 Filesystems
2+
SD.h - A thin shim for Arduino RP2040 Filesystems
33
Copyright (c) 2019 Earle F. Philhower, III. All rights reserved.
44
55
This library is free software; you can redistribute it and/or
@@ -139,9 +139,9 @@ class SDClass {
139139

140140
size_t size() {
141141
uint64_t sz = size64();
142-
#ifdef DEBUG_ESP_PORT
142+
#ifdef DEBUG_RP2040_PORT
143143
if (sz > std::numeric_limits<uint32_t>::max()) {
144-
DEBUG_ESP_PORT.printf_P(PSTR("WARNING: SD card size overflow (%lld >= 4GB). Please update source to use size64().\n"), (long long)sz);
144+
DEBUG_RP2040_PORT.printf_P(PSTR("WARNING: SD card size overflow (%lld >= 4GB). Please update source to use size64().\n"), (long long)sz);
145145
}
146146
#endif
147147
return (size_t)sz;

libraries/SDFS/src/SDFS.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ class SDFSImpl : public FSImpl {
115115
info.pageSize = i.pageSize;
116116
info.maxOpenFiles = i.maxOpenFiles;
117117
info.maxPathLength = i.maxPathLength;
118-
#ifdef DEBUG_ESP_PORT
118+
#ifdef DEBUG_RP2040_PORT
119119
if (i.totalBytes > std::numeric_limits<uint32_t>::max()) {
120120
// This catches both total and used cases, since used must always be < total.
121-
DEBUG_ESP_PORT.printf_P(PSTR("WARNING: SD card size overflow (%lld >= 4GB). Please update source to use info64().\n"), (long long)i.totalBytes);
121+
DEBUG_RP2040_PORT.printf_P(PSTR("WARNING: SD card size overflow (%lld >= 4GB). Please update source to use info64().\n"), (long long)i.totalBytes);
122122
}
123123
#endif
124124
info.totalBytes = (size_t)i.totalBytes;

libraries/WiFi/src/CertStoreBearSSL.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
#include <memory>
2222

2323

24-
#if defined(DEBUG_ESP_SSL) && defined(DEBUG_ESP_PORT)
25-
#define DEBUG_BSSL(fmt, ...) DEBUG_ESP_PORT.printf_P((PGM_P)PSTR( "BSSL:" fmt), ## __VA_ARGS__)
24+
#if defined(DEBUG_RP2040_CORE) && defined(DEBUG_RP2040_PORT)
25+
#define DEBUG_BSSL(fmt, ...) DEBUG_RP2040_PORT.printf_P((PGM_P)PSTR( "BSSL:" fmt), ## __VA_ARGS__)
2626
#else
2727
#define DEBUG_BSSL(...)
2828
#endif

libraries/WiFi/src/WiFiClientSecureBearSSL.cpp

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,14 @@
2929
#include "WiFiClientSecureBearSSL.h"
3030
#include "WiFiNTP.h"
3131
#include "StackThunk.h"
32-
#include "lwip/opt.h"
33-
#include "lwip/ip.h"
34-
#include "lwip/tcp.h"
35-
#include "lwip/inet.h"
36-
#include "lwip/netif.h"
32+
#include <lwip/opt.h>
33+
#include <lwip/ip.h>
34+
#include <lwip/tcp.h>
35+
#include <lwip/inet.h>
36+
#include <lwip/netif.h>
3737
#include <include/ClientContext.h>
38-
//#include "c_types.h"
39-
//#include <mmu_iram.h>
40-
//#include <umm_malloc/umm_malloc.h>
41-
//#include <umm_malloc/umm_heap_select.h>
42-
#if 1
43-
#if !CORE_MOCK
38+
39+
#if !defined(CORE_MOCK)
4440

4541
// The BearSSL thunks in use for now
4642
#define br_ssl_engine_recvapp_ack thunk_br_ssl_engine_recvapp_ack
@@ -52,11 +48,10 @@
5248
#define br_ssl_engine_sendrec_ack thunk_br_ssl_engine_sendrec_ack
5349
#define br_ssl_engine_sendrec_buf thunk_br_ssl_engine_sendrec_buf
5450

55-
#endif
5651
#endif
5752

58-
#if defined(DEBUG_ESP_SSL) && defined(DEBUG_ESP_PORT)
59-
#define DEBUG_BSSL(fmt, ...) DEBUG_ESP_PORT.printf_P((PGM_P)PSTR( "BSSL:" fmt), ## __VA_ARGS__)
53+
#if defined(DEBUG_RP2040_CORE) && defined(DEBUG_RP2040_PORT)
54+
#define DEBUG_BSSL(fmt, ...) DEBUG_RP2040_PORT.printf_P((PGM_P)PSTR( "BSSL:" fmt), ## __VA_ARGS__)
6055
#else
6156
#define DEBUG_BSSL(...)
6257
#endif
@@ -721,12 +716,12 @@ extern "C" {
721716
if (!xc->done_cert) {
722717
br_sha1_update(&xc->sha1_cert, buf, len);
723718
br_x509_decoder_push(&xc->ctx, (const void*)buf, len);
724-
#if defined(DEBUG_ESP_SSL) && defined(DEBUG_ESP_PORT)
719+
#if defined(DEBUG_RP2040_CORE) && defined(DEBUG_RP2040_PORT)
725720
DEBUG_BSSL("CERT: ");
726721
for (size_t i = 0; i < len; i++) {
727-
DEBUG_ESP_PORT.printf_P(PSTR("%02x "), buf[i] & 0xff);
722+
DEBUG_RP2040_PORT.printf_P(PSTR("%02x "), buf[i] & 0xff);
728723
}
729-
DEBUG_ESP_PORT.printf_P(PSTR("\n"));
724+
DEBUG_RP2040_PORT.printf_P(PSTR("\n"));
730725
#endif
731726
}
732727
}
@@ -750,7 +745,7 @@ extern "C" {
750745
char res[20];
751746
br_sha1_out(&xc->sha1_cert, res);
752747
if (xc->match_fingerprint && memcmp(res, xc->match_fingerprint, sizeof(res))) {
753-
#ifdef DEBUG_ESP_SSL
748+
#if defined(DEBUG_RP2040_CORE) && defined(DEBUG_RP2040_PORT)
754749
DEBUG_BSSL("insecure_end_chain: Received cert FP doesn't match\n");
755750
char buff[3 * sizeof(res) + 1]; // 3 chars per byte XX_, and null
756751
buff[0] = 0;
@@ -1143,7 +1138,7 @@ bool WiFiClientSecureCtx::_connectSSL(const char* hostName) {
11431138
}
11441139
}
11451140

1146-
#ifdef DEBUG_ESP_SSL
1141+
#if defined(DEBUG_RP2040_CORE) && defined(DEBUG_RP2040_PORT)
11471142
// BearSSL will reject all connections unless an authentication option is set, warn in DEBUG builds
11481143
if (!_use_insecure && !_use_fingerprint && !_use_self_signed && !_knownkey && !_certStore && !_ta) {
11491144
DEBUG_BSSL("Connection *will* fail, no authentication method is setup\n");
@@ -1213,7 +1208,7 @@ bool WiFiClientSecureCtx::_connectSSL(const char* hostName) {
12131208
}
12141209

12151210
auto ret = _wait_for_handshake();
1216-
#ifdef DEBUG_ESP_SSL
1211+
#if defined(DEBUG_RP2040_CORE) && defined(DEBUG_RP2040_PORT)
12171212
if (!ret) {
12181213
char err[256];
12191214
getLastSSLError(err, sizeof(err));

libraries/WiFi/src/include/UdpContext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class UdpContext {
171171
_on_rx = handler;
172172
}
173173

174-
#ifdef DEBUG_ESP_CORE
174+
#ifdef DEBUG_RP2040_CORE
175175
// this helper is ready to be used when debugging UDP
176176
void printChain(const pbuf* pb, const char* msg, size_t n) const {
177177
// printf the pb pbuf chain, buffered and all at once

libraries/lwIP_Ethernet/src/LwipIntfCB.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ extern "C" void netif_status_changed(struct netif* netif) {
3939

4040
bool LwipIntf::stateChangeSysCB(LwipIntf::CBType&& cb) {
4141
if (netifStatusChangeListLength >= NETIF_STATUS_CB_SIZE) {
42-
#if defined(DEBUG_ESP_CORE)
42+
#if defined(DEBUG_RP2040_CORE)
4343
DEBUGV("NETIF_STATUS_CB_SIZE is too low\n");
4444
#endif
4545
return false;

0 commit comments

Comments
 (0)