Skip to content

Commit 9b020df

Browse files
committed
Refactor debug macros to use function-style and update calls
Replaces DEBUG_ENTRY and DEBUG_EXIT macros with function-style DEBUG_ENTRY() and DEBUG_EXIT() for improved consistency and clarity. Updates all usages across the codebase to match the new macro definitions, enhancing code readability and maintainability.
1 parent e1df2f4 commit 9b020df

65 files changed

Lines changed: 431 additions & 411 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

common/include/common/utils/utils_hash.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @file hash.h
2+
* @file utils_hash.h
33
*
44
*/
55
/* Copyright (C) 2025 by Arjan van Vught mailto:info@gd32-dmx.org

common/include/firmware/debug/debug_printbits.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @file debug_print_bits.h
2+
* @file debug_printbits.h
33
*
44
*/
55
/* Copyright (C) 2025 by Arjan van Vught mailto:info@gd32-dmx.org

common/include/json/json_format_helpers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @file format_helpers.h
2+
* @file json_format_helpers.h
33
*
44
*/
55
/* Copyright (C) 2025 by Arjan van Vught mailto:info@gd32-dmx.org

common/include/json/json_jsondoc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @file jsondoc.h
2+
* @file json_jsondoc.h
33
*
44
*/
55
/* Copyright (C) 2025 by Arjan van Vught mailto:info@gd32-dmx.org

gd32_rdm_responder/lib/rdmidentify.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ static pixelpatterns::Pattern s_pattern;
3434

3535
void RDMIdentify::On(Mode mode)
3636
{
37-
DEBUG_ENTRY
37+
DEBUG_ENTRY();
3838
DEBUG_PRINTF("Mode=%u, s_isOn=%d", static_cast<uint32_t>(mode), s_is_on);
3939

4040
if ((mode == Mode::kLoud) && (!s_is_on))
@@ -45,12 +45,12 @@ void RDMIdentify::On(Mode mode)
4545
RDMResponder::Get()->DmxDisableOutput(true);
4646
}
4747

48-
DEBUG_EXIT
48+
DEBUG_EXIT();
4949
}
5050

5151
void RDMIdentify::Off([[maybe_unused]] Mode mode)
5252
{
53-
DEBUG_ENTRY
53+
DEBUG_ENTRY();
5454
DEBUG_PRINTF("Mode=%u, s_isOn=%d", static_cast<uint32_t>(mode), s_is_on);
5555

5656
if (s_is_on)
@@ -60,5 +60,5 @@ void RDMIdentify::Off([[maybe_unused]] Mode mode)
6060
RDMResponder::Get()->DmxDisableOutput(pixelpatterns::Pattern::kNone != s_pattern);
6161
}
6262

63-
DEBUG_EXIT
63+
DEBUG_EXIT();
6464
}

lib-configstore/device/gd32/ram/storedevice.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,17 @@ static constexpr uint32_t kBsramSize = 4096U;
3737

3838
StoreDevice::StoreDevice()
3939
{
40-
DEBUG_ENTRY
40+
DEBUG_ENTRY();
4141

4242
detected_ = true;
4343

4444
printf("StoreDevice: BSRAM with total %d bytes [%d kB]\n", GetSize(), GetSize() / 1024U);
45-
DEBUG_EXIT
45+
DEBUG_EXIT();
4646
}
4747

48-
StoreDevice::~StoreDevice(){DEBUG_ENTRY
48+
StoreDevice::~StoreDevice(){DEBUG_ENTRY();
4949

50-
DEBUG_EXIT}
50+
DEBUG_EXIT();}
5151

5252
uint32_t StoreDevice::GetSize() const
5353
{
@@ -61,34 +61,34 @@ uint32_t StoreDevice::GetSectorSize() const
6161

6262
bool StoreDevice::Read(__attribute__((unused)) uint32_t offset, __attribute__((unused)) uint32_t length, __attribute__((unused)) uint8_t* buffer, storedevice::Result& result)
6363
{
64-
DEBUG_ENTRY
64+
DEBUG_ENTRY();
6565
DEBUG_PRINTF("offset=%p[%d], len=%u[%d], data=%p[%d]", offset, (((uint32_t)(offset) & 0x3) == 0), length, (((uint32_t)(length) & 0x3) == 0), buffer, (((uint32_t)(buffer) & 0x3) == 0));
6666
assert((offset + length) <= BSRAM_SIZE);
6767

6868
result = storedevice::Result::kOk;
6969

70-
DEBUG_EXIT
70+
DEBUG_EXIT();
7171
return true;
7272
}
7373

7474
bool StoreDevice::Erase(__attribute__((unused)) uint32_t offset, __attribute__((unused)) uint32_t length, storedevice::Result& result)
7575
{
76-
DEBUG_ENTRY
76+
DEBUG_ENTRY();
7777

7878
result = storedevice::Result::kOk;
7979

80-
DEBUG_EXIT
80+
DEBUG_EXIT();
8181
return true;
8282
}
8383

8484
bool StoreDevice::Write(__attribute__((unused)) uint32_t offset, __attribute__((unused)) uint32_t length, __attribute__((unused)) const uint8_t* buffer, storedevice::Result& result)
8585
{
86-
DEBUG_ENTRY
86+
DEBUG_ENTRY();
8787
DEBUG_PRINTF("offset=%p[%d], len=%u[%d], data=%p[%d]", offset, (((uint32_t)(offset) & 0x3) == 0), length, (((uint32_t)(length) & 0x3) == 0), buffer, (((uint32_t)(buffer) & 0x3) == 0));
8888
assert((offset + length) <= BSRAM_SIZE);
8989

9090
result = storedevice::Result::kOk;
9191

92-
DEBUG_EXIT
92+
DEBUG_EXIT();
9393
return true;
9494
}

lib-configstore/device/gd32/rom/storedevice.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@
3131

3232
StoreDevice::StoreDevice()
3333
{
34-
DEBUG_ENTRY
34+
DEBUG_ENTRY();
3535

3636
detected_ = FlashCode::IsDetected();
3737

38-
DEBUG_EXIT
38+
DEBUG_EXIT();
3939
}
4040

4141
StoreDevice::~StoreDevice()
4242
{
43-
DEBUG_ENTRY
44-
DEBUG_EXIT
43+
DEBUG_ENTRY();
44+
DEBUG_EXIT();
4545
}
4646

4747
uint32_t StoreDevice::GetSize() const
@@ -56,39 +56,39 @@ uint32_t StoreDevice::GetSectorSize() const
5656

5757
bool StoreDevice::Read(uint32_t offset, uint32_t length, uint8_t* buffer, storedevice::Result& result)
5858
{
59-
DEBUG_ENTRY
59+
DEBUG_ENTRY();
6060

6161
flashcode::Result flashrom_result;
6262
const auto kState = FlashCode::Read(offset, length, buffer, flashrom_result);
6363

6464
result = static_cast<storedevice::Result>(flashrom_result);
6565

66-
DEBUG_EXIT
66+
DEBUG_EXIT();
6767
return kState;
6868
}
6969

7070
bool StoreDevice::Erase(uint32_t offset, uint32_t length, storedevice::Result& result)
7171
{
72-
DEBUG_ENTRY
72+
DEBUG_ENTRY();
7373

7474
flashcode::Result flashrom_result;
7575
const auto kState = FlashCode::Erase(offset, length, flashrom_result);
7676

7777
result = static_cast<storedevice::Result>(flashrom_result);
7878

79-
DEBUG_EXIT
79+
DEBUG_EXIT();
8080
return kState;
8181
}
8282

8383
bool StoreDevice::Write(uint32_t offset, uint32_t length, const uint8_t* buffer, storedevice::Result& result)
8484
{
85-
DEBUG_ENTRY
85+
DEBUG_ENTRY();
8686

8787
flashcode::Result flashrom_result;
8888
const auto kState = FlashCode::Write(offset, length, buffer, flashrom_result);
8989

9090
result = static_cast<storedevice::Result>(flashrom_result);
9191

92-
DEBUG_EXIT
92+
DEBUG_EXIT();
9393
return kState;
9494
}

lib-configstore/device/i2c/storedevice.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static constexpr auto kRomSize = 4096U;
4848

4949
StoreDevice::StoreDevice() : AT24C32(storedevice::kI2CIndex)
5050
{
51-
DEBUG_ENTRY
51+
DEBUG_ENTRY();
5252

5353
detected_ = AT24C32::IsConnected();
5454

@@ -61,10 +61,10 @@ StoreDevice::StoreDevice() : AT24C32(storedevice::kI2CIndex)
6161
printf("StoreDevice: AT24C32 total %u bytes [%u kB]\n", GetSize(), GetSize() / 1024U);
6262
}
6363

64-
DEBUG_EXIT
64+
DEBUG_EXIT();
6565
}
6666

67-
StoreDevice::~StoreDevice(){DEBUG_ENTRY DEBUG_EXIT}
67+
StoreDevice::~StoreDevice(){DEBUG_ENTRY(); DEBUG_EXIT();}
6868

6969
uint32_t StoreDevice::GetSize() const
7070
{
@@ -78,36 +78,36 @@ uint32_t StoreDevice::GetSectorSize() const
7878

7979
bool StoreDevice::Read(uint32_t offset, uint32_t length, uint8_t* buffer, storedevice::Result& result)
8080
{
81-
DEBUG_ENTRY
81+
DEBUG_ENTRY();
8282
assert((offset + length) <= storedevice::ROM_SIZE);
8383

8484
AT24C32::Read(offset, buffer, length);
8585

8686
result = storedevice::Result::kOk;
8787

88-
DEBUG_EXIT
88+
DEBUG_EXIT();
8989
return true;
9090
}
9191

9292
bool StoreDevice::Erase([[maybe_unused]] uint32_t offset, [[maybe_unused]] uint32_t length, storedevice::Result& result)
9393
{
94-
DEBUG_ENTRY
94+
DEBUG_ENTRY();
9595

9696
result = storedevice::Result::kOk;
9797

98-
DEBUG_EXIT
98+
DEBUG_EXIT();
9999
return true;
100100
}
101101

102102
bool StoreDevice::Write(uint32_t offset, uint32_t length, const uint8_t* buffer, storedevice::Result& result)
103103
{
104-
DEBUG_ENTRY
104+
DEBUG_ENTRY();
105105
assert((offset + length) <= ROM_SIZE);
106106

107107
AT24C32::Write(offset, buffer, length);
108108

109109
result = storedevice::Result::kOk;
110110

111-
DEBUG_EXIT
111+
DEBUG_EXIT();
112112
return true;
113113
}

lib-configstore/device/spi/storedevice.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
StoreDevice::StoreDevice()
3838
{
39-
DEBUG_ENTRY
39+
DEBUG_ENTRY();
4040

4141
if (!spi_flash_probe())
4242
{
@@ -49,10 +49,10 @@ StoreDevice::StoreDevice()
4949
detected_ = true;
5050
}
5151

52-
DEBUG_EXIT
52+
DEBUG_EXIT();
5353
}
5454

55-
StoreDevice::~StoreDevice(){DEBUG_ENTRY DEBUG_EXIT}
55+
StoreDevice::~StoreDevice(){DEBUG_ENTRY(); DEBUG_EXIT();}
5656

5757
uint32_t StoreDevice::GetSize() const
5858
{
@@ -66,33 +66,33 @@ uint32_t StoreDevice::GetSectorSize() const
6666

6767
bool StoreDevice::Read(uint32_t offset, uint32_t length, uint8_t* buffer, storedevice::Result& result)
6868
{
69-
DEBUG_ENTRY
69+
DEBUG_ENTRY();
7070

7171
result = spi_flash_cmd_read_fast(offset, length, buffer) ? storedevice::Result::kOk : storedevice::Result::kError;
7272

7373
DEBUG_PRINTF("result=%d", static_cast<int>(result));
74-
DEBUG_EXIT
74+
DEBUG_EXIT();
7575
return true;
7676
}
7777

7878
bool StoreDevice::Erase(uint32_t offset, uint32_t length, storedevice::Result& result)
7979
{
80-
DEBUG_ENTRY
80+
DEBUG_ENTRY();
8181

8282
result = spi_flash_cmd_erase(offset, length) ? storedevice::Result::kOk : storedevice::Result::kError;
8383

8484
DEBUG_PRINTF("result=%d", static_cast<int>(result));
85-
DEBUG_EXIT
85+
DEBUG_EXIT();
8686
return true;
8787
}
8888

8989
bool StoreDevice::Write(uint32_t offset, uint32_t length, const uint8_t* buffer, storedevice::Result& result)
9090
{
91-
DEBUG_ENTRY
91+
DEBUG_ENTRY();
9292

9393
result = spi_flash_cmd_write_multi(offset, length, buffer) ? storedevice::Result::kOk : storedevice::Result::kError;
9494

9595
DEBUG_PRINTF("result=%d", static_cast<int>(result));
96-
DEBUG_EXIT
96+
DEBUG_EXIT();
9797
return true;
9898
}

lib-configstore/include/configstore.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class ConfigStore : StoreDevice
6060
public:
6161
ConfigStore()
6262
{
63-
DEBUG_ENTRY
63+
DEBUG_ENTRY();
6464

6565
assert(s_this == nullptr);
6666
s_this = this;
@@ -109,7 +109,7 @@ class ConfigStore : StoreDevice
109109
// Set global
110110
Global::Instance().SetUtcOffsetIfValid(store->global.utc_offset);
111111

112-
DEBUG_EXIT
112+
DEBUG_EXIT();
113113
}
114114

115115
ConfigStore(const ConfigStore&) = delete;
@@ -528,51 +528,51 @@ class ConfigStore : StoreDevice
528528

529529
static void Timer([[maybe_unused]] TimerHandle_t timer_handle)
530530
{
531-
DEBUG_ENTRY
531+
DEBUG_ENTRY();
532532

533533
if (!Instance().Commit())
534534
{
535535
Instance().TimerStop();
536536

537-
DEBUG_EXIT
537+
DEBUG_EXIT();
538538
return;
539539
}
540540

541-
DEBUG_EXIT
541+
DEBUG_EXIT();
542542
}
543543

544544
void TimerStart()
545545
{
546-
DEBUG_ENTRY
546+
DEBUG_ENTRY();
547547
DEBUG_PRINTF("s_timer_id=%d", s_timer_id);
548548

549549
if (s_timer_id != kTimerIdNone)
550550
{
551-
DEBUG_EXIT
551+
DEBUG_EXIT();
552552
return;
553553
}
554554

555555
s_timer_id = SoftwareTimerAdd(100, Timer);
556556

557557
DEBUG_PRINTF("s_timer_id=%d", s_timer_id);
558-
DEBUG_EXIT
558+
DEBUG_EXIT();
559559
}
560560

561561
void TimerStop()
562562
{
563-
DEBUG_ENTRY
563+
DEBUG_ENTRY();
564564
DEBUG_PRINTF("s_timer_id=%d", s_timer_id);
565565

566566
if (s_timer_id == kTimerIdNone)
567567
{
568568
return;
569-
DEBUG_EXIT
569+
DEBUG_EXIT();
570570
}
571571

572572
SoftwareTimerDelete(s_timer_id);
573573

574574
DEBUG_PRINTF("s_timer_id=%d", s_timer_id);
575-
DEBUG_EXIT
575+
DEBUG_EXIT();
576576
}
577577

578578
bool Flash()

0 commit comments

Comments
 (0)