mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
pkg/*: replace #if ENABLE_DEBUG with IS_ACTIVE
This commit is contained in:
parent
bf88a24fb4
commit
9dd3b7a3ec
@ -164,20 +164,16 @@ static void _on_scan_evt(uint8_t type, const ble_addr_t *addr, int8_t rssi,
|
||||
|
||||
static void _evt_dbg(const char *msg, int handle, const uint8_t *addr)
|
||||
{
|
||||
#if ENABLE_DEBUG
|
||||
printf("[autoconn] %s (%i|", msg, handle);
|
||||
if (addr) {
|
||||
bluetil_addr_print(addr);
|
||||
if (IS_ACTIVE(ENABLE_DEBUG)) {
|
||||
printf("[autoconn] %s (%i|", msg, handle);
|
||||
if (addr) {
|
||||
bluetil_addr_print(addr);
|
||||
}
|
||||
else {
|
||||
printf("n/a");
|
||||
}
|
||||
puts(")");
|
||||
}
|
||||
else {
|
||||
printf("n/a");
|
||||
}
|
||||
puts(")");
|
||||
#else
|
||||
(void)msg;
|
||||
(void)handle;
|
||||
(void)addr;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void _on_netif_evt(int handle, nimble_netif_event_t event,
|
||||
|
@ -110,17 +110,13 @@ uint8_t ot_call_command(char* command, void *arg, void* answer)
|
||||
|
||||
void output_bytes(const char* name, const uint8_t *aBytes, uint8_t aLength)
|
||||
{
|
||||
#if ENABLE_DEBUG
|
||||
DEBUG("%s: ", name);
|
||||
for (int i = 0; i < aLength; i++) {
|
||||
DEBUG("%02x", aBytes[i]);
|
||||
if (IS_ACTIVE(ENABLE_DEBUG)) {
|
||||
DEBUG("%s: ", name);
|
||||
for (int i = 0; i < aLength; i++) {
|
||||
DEBUG("%02x", aBytes[i]);
|
||||
}
|
||||
DEBUG("\n");
|
||||
}
|
||||
DEBUG("\n");
|
||||
#else
|
||||
(void)name;
|
||||
(void)aBytes;
|
||||
(void)aLength;
|
||||
#endif
|
||||
}
|
||||
|
||||
OT_COMMAND ot_channel(otInstance* ot_instance, void* arg, void* answer) {
|
||||
|
@ -159,7 +159,7 @@ void recv_pkt(otInstance *aInstance, netdev_t *dev)
|
||||
|
||||
/* Get RSSI from a radio driver. RSSI should be in [dBm] */
|
||||
Rssi = (int8_t)rx_info.rssi;
|
||||
if (ENABLE_DEBUG) {
|
||||
if (IS_ACTIVE(ENABLE_DEBUG)) {
|
||||
DEBUG("Received message: len %d\n", (int) sReceiveFrame.mLength);
|
||||
for (int i = 0; i < sReceiveFrame.mLength; ++i) {
|
||||
DEBUG("%x ", sReceiveFrame.mPsdu[i]);
|
||||
@ -216,7 +216,7 @@ void otPlatRadioSetExtendedAddress(otInstance *aInstance, const otExtAddress *aE
|
||||
for (unsigned i = 0; i < IEEE802154_LONG_ADDRESS_LEN; i++) {
|
||||
reversed_addr[i] = (uint8_t) ((uint8_t *)aExtAddress)[IEEE802154_LONG_ADDRESS_LEN - 1 - i];
|
||||
}
|
||||
if (ENABLE_DEBUG) {
|
||||
if (IS_ACTIVE(ENABLE_DEBUG)) {
|
||||
for (unsigned i = 0; i < IEEE802154_LONG_ADDRESS_LEN; ++i) {
|
||||
DEBUG("%x ", (uint8_t) ((uint8_t *)reversed_addr)[i]);
|
||||
}
|
||||
@ -344,7 +344,7 @@ otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aPacket)
|
||||
};
|
||||
|
||||
/*Set channel and power based on transmit frame */
|
||||
if (ENABLE_DEBUG) {
|
||||
if (IS_ACTIVE(ENABLE_DEBUG)) {
|
||||
DEBUG("otPlatRadioTransmit->channel: %i, length %d\n",
|
||||
(int) aPacket->mChannel, (int)aPacket->mLength);
|
||||
for (size_t i = 0; i < aPacket->mLength; ++i) {
|
||||
|
@ -88,8 +88,7 @@ static int mqtt_read(struct Network *n, unsigned char *buf, int len,
|
||||
}
|
||||
} while (rc < len && xtimer_now64().ticks64 < send_tick && rc >= 0);
|
||||
|
||||
#ifdef ENABLE_DEBUG
|
||||
if (IS_USED(MODULE_LWIP) && rc > 0) {
|
||||
if (IS_ACTIVE(ENABLE_DEBUG) && IS_USED(MODULE_LWIP) && rc > 0) {
|
||||
DEBUG("MQTT buf asked for %d, available to read %d\n",
|
||||
rc, tsrb_avail(&tsrb_lwip_tcp));
|
||||
for (int i = 0; i < rc; i++) {
|
||||
@ -97,7 +96,6 @@ static int mqtt_read(struct Network *n, unsigned char *buf, int len,
|
||||
}
|
||||
DEBUG("\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -712,7 +712,7 @@ void *_semtech_loramac_event_loop(void *arg)
|
||||
/* save the uplink counter */
|
||||
_save_uplink_counter(mac);
|
||||
#endif
|
||||
if (ENABLE_DEBUG) {
|
||||
if (IS_ACTIVE(ENABLE_DEBUG)) {
|
||||
switch (confirm->McpsRequest) {
|
||||
case MCPS_UNCONFIRMED:
|
||||
{
|
||||
@ -755,7 +755,7 @@ void *_semtech_loramac_event_loop(void *arg)
|
||||
break;
|
||||
}
|
||||
|
||||
if (ENABLE_DEBUG) {
|
||||
if (IS_ACTIVE(ENABLE_DEBUG)) {
|
||||
switch (indication->McpsIndication) {
|
||||
case MCPS_UNCONFIRMED:
|
||||
DEBUG("[semtech-loramac] MCPS indication Unconfirmed\n");
|
||||
|
@ -117,19 +117,19 @@ static int _event(struct dtls_context_t *ctx, session_t *session,
|
||||
|
||||
sock_dtls_t *sock = dtls_get_app_data(ctx);
|
||||
msg_t msg = { .type = code, .content.ptr = session };
|
||||
#ifdef ENABLE_DEBUG
|
||||
switch (code) {
|
||||
case DTLS_EVENT_CONNECT:
|
||||
DEBUG("sock_dtls: event connect\n");
|
||||
break;
|
||||
case DTLS_EVENT_CONNECTED:
|
||||
DEBUG("sock_dtls: event connected\n");
|
||||
break;
|
||||
case DTLS_EVENT_RENEGOTIATE:
|
||||
DEBUG("sock_dtls: event renegotiate\n");
|
||||
break;
|
||||
if (IS_ACTIVE(ENABLE_DEBUG)) {
|
||||
switch (code) {
|
||||
case DTLS_EVENT_CONNECT:
|
||||
DEBUG("sock_dtls: event connect\n");
|
||||
break;
|
||||
case DTLS_EVENT_CONNECTED:
|
||||
DEBUG("sock_dtls: event connected\n");
|
||||
break;
|
||||
case DTLS_EVENT_RENEGOTIATE:
|
||||
DEBUG("sock_dtls: event renegotiate\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif /* ENABLE_DEBUG */
|
||||
if (!level && (code != DTLS_EVENT_CONNECT)) {
|
||||
mbox_put(&sock->mbox, &msg);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user