Skip to content

Commit 4095196

Browse files
committed
Renaming all 'DBG_ERROR/WARNING/INFO/DEBUG/VERBOSE macros to DEBUG_ERROR/WARNING/... to avoid name clashes with ídentically named constants within Arduino_DebugUtils
1 parent 59627db commit 4095196

File tree

4 files changed

+42
-42
lines changed

4 files changed

+42
-42
lines changed

src/AIoTC_Config.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,31 +31,31 @@
3131
#endif
3232

3333
#if defined(ARDUINO_AVR_UNO_WIFI_REV2)
34-
#define DBG_ERROR
35-
#define DBG_WARNING
36-
#define DBG_INFO
37-
#define DBG_DEBUG
38-
#define DBG_VERBOSE
34+
#define DEBUG_ERROR
35+
#define DEBUG_WARNING
36+
#define DEBUG_INFO
37+
#define DEBUG_DEBUG
38+
#define DEBUG_VERBOSE
3939
#endif
4040

41-
#ifndef DBG_ERROR
42-
#define DBG_ERROR(fmt, ...) Debug.print(DBG_ERROR, fmt, ## __VA_ARGS__)
41+
#ifndef DEBUG_ERROR
42+
#define DEBUG_ERROR(fmt, ...) Debug.print(DBG_ERROR, fmt, ## __VA_ARGS__)
4343
#endif
4444

45-
#ifndef DBG_WARNING
46-
#define DBG_WARNING(fmt, ...) Debug.print(DBG_WARNING, fmt, ## __VA_ARGS__)
45+
#ifndef DEBUG_WARNING
46+
#define DEBUG_WARNING(fmt, ...) Debug.print(DBG_WARNING, fmt, ## __VA_ARGS__)
4747
#endif
4848

49-
#ifndef DBG_INFO
50-
#define DBG_INFO(fmt, ...) Debug.print(DBG_INFO, fmt, ## __VA_ARGS__)
49+
#ifndef DEBUG_INFO
50+
#define DEBUG_INFO(fmt, ...) Debug.print(DBG_INFO, fmt, ## __VA_ARGS__)
5151
#endif
5252

53-
#ifndef DBG_DEBUG
54-
#define DBG_DEBUG(fmt, ...) Debug.print(DBG_DEBUG, fmt, ## __VA_ARGS__)
53+
#ifndef DEBUG_DEBUG
54+
#define DEBUG_DEBUG(fmt, ...) Debug.print(DBG_DEBUG, fmt, ## __VA_ARGS__)
5555
#endif
5656

57-
#ifndef DBG_VERBOSE
58-
#define DBG_VERBOSE(fmt, ...) //Debug.print(DBG_VERBOSE, fmt, ## __VA_ARGS__)
57+
#ifndef DEBUG_VERBOSE
58+
#define DEBUG_VERBOSE(fmt, ...) //Debug.print(DBG_VERBOSE, fmt, ## __VA_ARGS__)
5959
#endif
6060

6161
/******************************************************************************

src/ArduinoIoTCloudLPWAN.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ void ArduinoIoTCloudLPWAN::update()
8787

8888
void ArduinoIoTCloudLPWAN::printDebugInfo()
8989
{
90-
DBG_INFO(F("***** Arduino IoT Cloud LPWAN - configuration info *****"));
91-
DBG_INFO(F("Thing ID: %s"), getThingId().c_str());
90+
DEBUG_INFO(F("***** Arduino IoT Cloud LPWAN - configuration info *****"));
91+
DEBUG_INFO(F("Thing ID: %s"), getThingId().c_str());
9292
}
9393

9494
/******************************************************************************
@@ -106,16 +106,16 @@ ArduinoIoTCloudLPWAN::State ArduinoIoTCloudLPWAN::handle_ConnectPhy()
106106
ArduinoIoTCloudLPWAN::State ArduinoIoTCloudLPWAN::handle_SyncTime()
107107
{
108108
unsigned long const internal_posix_time = _time_service.getTime();
109-
DBG_VERBOSE(F("ArduinoIoTCloudLPWAN::%s internal clock configured to posix timestamp %d"), __FUNCTION__, internal_posix_time);
110-
DBG_INFO(F("Connected to Arduino IoT Cloud"));
109+
DEBUG_VERBOSE(F("ArduinoIoTCloudLPWAN::%s internal clock configured to posix timestamp %d"), __FUNCTION__, internal_posix_time);
110+
DEBUG_INFO(F("Connected to Arduino IoT Cloud"));
111111
return State::Connected;
112112
}
113113

114114
ArduinoIoTCloudLPWAN::State ArduinoIoTCloudLPWAN::handle_Connected()
115115
{
116116
if (!connected())
117117
{
118-
DBG_ERROR(F("ArduinoIoTCloudLPWAN::%s connection to gateway lost"), __FUNCTION__);
118+
DEBUG_ERROR(F("ArduinoIoTCloudLPWAN::%s connection to gateway lost"), __FUNCTION__);
119119
return State::ConnectPhy;
120120
}
121121

src/ArduinoIoTCloudTCP.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,15 @@ int ArduinoIoTCloudTCP::begin(String brokerAddress, uint16_t brokerPort)
118118
#endif /* OTA_ENABLED */
119119

120120
#ifdef BOARD_HAS_OFFLOADED_ECCX08
121-
if (!ECCX08.begin()) { DBG_ERROR(F("Cryptography processor failure. Make sure you have a compatible board.")); return 0; }
122-
if (!CryptoUtil::readDeviceId(ECCX08, getDeviceId(), ECCX08Slot::DeviceId)) { DBG_ERROR(F("Cryptography processor read failure.")); return 0; }
121+
if (!ECCX08.begin()) { DEBUG_ERROR(F("Cryptography processor failure. Make sure you have a compatible board.")); return 0; }
122+
if (!CryptoUtil::readDeviceId(ECCX08, getDeviceId(), ECCX08Slot::DeviceId)) { DEBUG_ERROR(F("Cryptography processor read failure.")); return 0; }
123123
ECCX08.end();
124124
#endif
125125

126126
#ifdef BOARD_HAS_ECCX08
127-
if (!ECCX08.begin()) { DBG_ERROR(F("Cryptography processor failure. Make sure you have a compatible board.")); return 0; }
128-
if (!CryptoUtil::readDeviceId(ECCX08, getDeviceId(), ECCX08Slot::DeviceId)) { DBG_ERROR(F("Cryptography processor read failure.")); return 0; }
129-
if (!CryptoUtil::reconstructCertificate(_eccx08_cert, getDeviceId(), ECCX08Slot::Key, ECCX08Slot::CompressedCertificate, ECCX08Slot::SerialNumberAndAuthorityKeyIdentifier)) { DBG_ERROR(F("Cryptography certificate reconstruction failure.")); return 0; }
127+
if (!ECCX08.begin()) { DEBUG_ERROR(F("Cryptography processor failure. Make sure you have a compatible board.")); return 0; }
128+
if (!CryptoUtil::readDeviceId(ECCX08, getDeviceId(), ECCX08Slot::DeviceId)) { DEBUG_ERROR(F("Cryptography processor read failure.")); return 0; }
129+
if (!CryptoUtil::reconstructCertificate(_eccx08_cert, getDeviceId(), ECCX08Slot::Key, ECCX08Slot::CompressedCertificate, ECCX08Slot::SerialNumberAndAuthorityKeyIdentifier)) { DEBUG_ERROR(F("Cryptography certificate reconstruction failure.")); return 0; }
130130
_sslClient.setClient(_connection->getClient());
131131
_sslClient.setEccSlot(static_cast<int>(ECCX08Slot::Key), _eccx08_cert.bytes(), _eccx08_cert.length());
132132
#elif defined(BOARD_ESP)
@@ -159,7 +159,7 @@ int ArduinoIoTCloudTCP::begin(String brokerAddress, uint16_t brokerPort)
159159
String const nina_fw_version = WiFi.firmwareVersion();
160160
if (nina_fw_version < "1.4.1") {
161161
_ota_cap = false;
162-
DBG_WARNING(F("ArduinoIoTCloudTCP::%s In order to be ready for cloud OTA, NINA firmware needs to be >= 1.4.1, current %s"), __FUNCTION__, nina_fw_version.c_str());
162+
DEBUG_WARNING(F("ArduinoIoTCloudTCP::%s In order to be ready for cloud OTA, NINA firmware needs to be >= 1.4.1, current %s"), __FUNCTION__, nina_fw_version.c_str());
163163
}
164164
else {
165165
_ota_cap = true;
@@ -196,10 +196,10 @@ int ArduinoIoTCloudTCP::connected()
196196

197197
void ArduinoIoTCloudTCP::printDebugInfo()
198198
{
199-
DBG_INFO(F("***** Arduino IoT Cloud - configuration info *****"));
200-
DBG_INFO(F("Device ID: %s"), getDeviceId().c_str());
201-
DBG_INFO(F("Thing ID: %s"), getThingId().c_str());
202-
DBG_INFO(F("MQTT Broker: %s:%d"), _brokerAddress.c_str(), _brokerPort);
199+
DEBUG_INFO(F("***** Arduino IoT Cloud - configuration info *****"));
200+
DEBUG_INFO(F("Device ID: %s"), getDeviceId().c_str());
201+
DEBUG_INFO(F("Thing ID: %s"), getThingId().c_str());
202+
DEBUG_INFO(F("MQTT Broker: %s:%d"), _brokerAddress.c_str(), _brokerPort);
203203
}
204204

205205
/******************************************************************************
@@ -217,7 +217,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_ConnectPhy()
217217
ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_SyncTime()
218218
{
219219
unsigned long const internal_posix_time = _time_service.getTime();
220-
DBG_VERBOSE(F("ArduinoIoTCloudTCP::%s internal clock configured to posix timestamp %d"), __FUNCTION__, internal_posix_time);
220+
DEBUG_VERBOSE(F("ArduinoIoTCloudTCP::%s internal clock configured to posix timestamp %d"), __FUNCTION__, internal_posix_time);
221221
return State::ConnectMqttBroker;
222222
}
223223

@@ -226,28 +226,28 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_ConnectMqttBroker()
226226
if (_mqttClient.connect(_brokerAddress.c_str(), _brokerPort))
227227
return State::SubscribeMqttTopics;
228228

229-
DBG_ERROR(F("ArduinoIoTCloudTCP::%s could not connect to %s:%d"), __FUNCTION__, _brokerAddress.c_str(), _brokerPort);
229+
DEBUG_ERROR(F("ArduinoIoTCloudTCP::%s could not connect to %s:%d"), __FUNCTION__, _brokerAddress.c_str(), _brokerPort);
230230
return State::ConnectPhy;
231231
}
232232

233233
ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_SubscribeMqttTopics()
234234
{
235235
if (!_mqttClient.subscribe(_dataTopicIn))
236236
{
237-
DBG_ERROR(F("ArduinoIoTCloudTCP::%s could not subscribe to %s"), __FUNCTION__, _dataTopicIn.c_str());
237+
DEBUG_ERROR(F("ArduinoIoTCloudTCP::%s could not subscribe to %s"), __FUNCTION__, _dataTopicIn.c_str());
238238
return State::SubscribeMqttTopics;
239239
}
240240

241241
if (_shadowTopicIn != "")
242242
{
243243
if (!_mqttClient.subscribe(_shadowTopicIn))
244244
{
245-
DBG_ERROR(F("ArduinoIoTCloudTCP::%s could not subscribe to %s"), __FUNCTION__, _shadowTopicIn.c_str());
245+
DEBUG_ERROR(F("ArduinoIoTCloudTCP::%s could not subscribe to %s"), __FUNCTION__, _shadowTopicIn.c_str());
246246
return State::SubscribeMqttTopics;
247247
}
248248
}
249249

250-
DBG_INFO(F("Connected to Arduino IoT Cloud"));
250+
DEBUG_INFO(F("Connected to Arduino IoT Cloud"));
251251
execCloudEventCallback(ArduinoIoTCloudEvent::CONNECT);
252252

253253
if (_shadowTopicIn != "")
@@ -262,7 +262,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_RequestLastValues()
262262
unsigned long const now = millis();
263263
if ((now - _lastSyncRequestTickTime) > TIMEOUT_FOR_LASTVALUES_SYNC)
264264
{
265-
DBG_VERBOSE(F("ArduinoIoTCloudTCP::%s [%d] last values requested"), __FUNCTION__, now);
265+
DEBUG_VERBOSE(F("ArduinoIoTCloudTCP::%s [%d] last values requested"), __FUNCTION__, now);
266266
requestLastValue();
267267
_lastSyncRequestTickTime = now;
268268
}
@@ -274,7 +274,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_Connected()
274274
{
275275
if (!_mqttClient.connected())
276276
{
277-
DBG_ERROR(F("ArduinoIoTCloudTCP::%s MQTT client connection lost"), __FUNCTION__);
277+
DEBUG_ERROR(F("ArduinoIoTCloudTCP::%s MQTT client connection lost"), __FUNCTION__);
278278

279279
/* Forcefully disconnect MQTT client and trigger a reconnection. */
280280
_mqttClient.stop();
@@ -354,7 +354,7 @@ void ArduinoIoTCloudTCP::handleMessage(int length)
354354

355355
if ((_shadowTopicIn == topic) && (_state == State::RequestLastValues))
356356
{
357-
DBG_VERBOSE(F("ArduinoIoTCloudTCP::%s [%d] last values received"), __FUNCTION__, millis());
357+
DEBUG_VERBOSE(F("ArduinoIoTCloudTCP::%s [%d] last values received"), __FUNCTION__, millis());
358358
CBORDecoder::decode(_property_container, (uint8_t*)bytes, length, true);
359359
sendPropertiesToCloud();
360360
execCloudEventCallback(ArduinoIoTCloudEvent::SYNC);
@@ -404,7 +404,7 @@ int ArduinoIoTCloudTCP::write(String const topic, byte const data[], int const l
404404
#if OTA_ENABLED
405405
void ArduinoIoTCloudTCP::onOTARequest()
406406
{
407-
DBG_VERBOSE(F("ArduinoIoTCloudTCP::%s _ota_url = %s"), __FUNCTION__, _ota_url.c_str());
407+
DEBUG_VERBOSE(F("ArduinoIoTCloudTCP::%s _ota_url = %s"), __FUNCTION__, _ota_url.c_str());
408408

409409
/* Status flag to prevent the reset from being executed
410410
* when HTTPS download is not supported.
@@ -420,7 +420,7 @@ void ArduinoIoTCloudTCP::onOTARequest()
420420
uint8_t nina_ota_err_code = 0;
421421
if (!WiFiStorage.downloadOTA(_ota_url.c_str(), &nina_ota_err_code))
422422
{
423-
DBG_ERROR(F("ArduinoIoTCloudTCP::%s error download to nina: %d"), __FUNCTION__, nina_ota_err_code);
423+
DEBUG_ERROR(F("ArduinoIoTCloudTCP::%s error download to nina: %d"), __FUNCTION__, nina_ota_err_code);
424424
_ota_error = static_cast<int>(OTAError::DownloadFailed);
425425
return;
426426
}

src/utility/ota/FlashSHA256.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ String FlashSHA256::calc(uint32_t const start_addr, uint32_t const max_flash_siz
100100
sha256_str += buf;
101101
});
102102
/* Do some debug printout. */
103-
DBG_VERBOSE("SHA256: %d bytes read", flash_addr);
104-
DBG_VERBOSE("SHA256: HASH(%d) = %s", strlen(sha256_str.c_str()), sha256_str.c_str());
103+
DEBUG_VERBOSE("SHA256: %d bytes read", flash_addr);
104+
DEBUG_VERBOSE("SHA256: HASH(%d) = %s", strlen(sha256_str.c_str()), sha256_str.c_str());
105105
return sha256_str;
106106
}
107107

0 commit comments

Comments
 (0)