Skip to content

Commit a4070b9

Browse files
committed
Apply formatting, style fixes and bump copyright
Change .clang-format to use Attach brace style and apply resulting style updates across firmware sources. Reformat main.cpp files in gd32_dmx_usb_pro and gd32_rdm_responder (brace placement, single-line initializers, remove extra whitespace, preprocessor spacing). Also update copyright year to 2026. No functional logic changes.
1 parent 97f4ee5 commit a4070b9

3 files changed

Lines changed: 18 additions & 34 deletions

File tree

.clang-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ AllowShortFunctionsOnASingleLine: Inline
1414
AllowShortIfStatementsOnASingleLine: true
1515
AllowShortLoopsOnASingleLine: true
1616

17-
BreakBeforeBraces: Allman
17+
BreakBeforeBraces: Attach
1818

1919
DerivePointerAlignment: false
2020

gd32_dmx_usb_pro/firmware/main.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,14 @@
3838
#define ALIGNED __attribute__((aligned(4)))
3939
#endif
4040

41-
static constexpr char kWidgetModeNames[4][12] ALIGNED =
42-
{
41+
static constexpr char kWidgetModeNames[4][12] ALIGNED = {
4342
"DMX_RDM",
4443
"DMX",
4544
"RDM",
4645
"RDM_SNIFFER"
4746
};
4847

49-
static constexpr rdm::device::InfoData kDeviceLabel ALIGNED =
50-
{
51-
const_cast<char*>("GD32F103RC DMX USB Pro"),
52-
22
53-
};
48+
static constexpr rdm::device::InfoData kDeviceLabel ALIGNED = {const_cast<char*>("GD32F103RC DMX USB Pro"), 22};
5449

5550
int main() // NOLINT
5651
{
@@ -80,14 +75,12 @@ int main() // NOLINT
8075

8176
hal::WatchdogInit();
8277

83-
if (kWidgetMode == widget::Mode::kRdmSniffer)
84-
{
78+
if (kWidgetMode == widget::Mode::kRdmSniffer) {
8579
widget.SetPortDirection(0, dmx::PortDirection::kInput, true);
8680
widget.SnifferFillTransmitBuffer(); // Prevent missing first frame
8781
}
8882

89-
for (;;)
90-
{
83+
for (;;) {
9184
hal::WatchdogFeed();
9285
widget.Run();
9386
hal::Run();

gd32_rdm_responder/firmware/main.cpp

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @file main.cpp
33
*/
4-
/* Copyright (C) 2021-2025 by Arjan van Vught mailto:info@gd32-dmx.org
4+
/* Copyright (C) 2021-2026 by Arjan van Vught mailto:info@gd32-dmx.org
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
@@ -47,10 +47,8 @@
4747
#include "remoteconfig.h"
4848
#endif
4949

50-
namespace hal
51-
{
52-
void RebootHandler()
53-
{
50+
namespace hal {
51+
void RebootHandler() {
5452
PixelDmx::Get().Blackout();
5553
}
5654
} // namespace hal
@@ -60,9 +58,9 @@ int main() // NOLINT
6058
hal::Init();
6159
DisplayUdf display;
6260
ConfigStore config_store;
63-
#if !defined(NO_EMAC)
61+
#if !defined(NO_EMAC)
6462
network::Init();
65-
#endif
63+
#endif
6664
FirmwareVersion fw(kSoftwareVersion, __DATE__, __TIME__);
6765

6866
const auto kIsConfigMode = IsConfigMode();
@@ -80,13 +78,12 @@ int main() // NOLINT
8078
PixelTestPattern pixel_test_pattern(kTestPattern, 1);
8179

8280
PixelDmxParamsRdm pixeldmx_paramsrdm;
83-
81+
8482
#if defined(CONFIG_RDM_MANUFACTURER_PIDS_SET)
8583
static constexpr auto kPersonalityCount = static_cast<uint32_t>(pixel::LedType::kUndefined);
8684
RDMPersonality* personalities[kPersonalityCount];
8785

88-
for (uint32_t index = 0; index < kPersonalityCount; index++)
89-
{
86+
for (uint32_t index = 0; index < kPersonalityCount; index++) {
9087
const auto* description = pixel::GetTypeName(static_cast<pixel::LedType>(index));
9188
personalities[index] = new RDMPersonality(description, &pixeldmx);
9289
}
@@ -95,7 +92,7 @@ int main() // NOLINT
9592
#else
9693
char description[rdm::personality::DESCRIPTION_MAX_LENGTH];
9794
pixeldmx::paramsdmx::SetPersonalityDescription(description);
98-
95+
9996
RDMPersonality* personalities[2] = {new RDMPersonality(description, &pixeldmx), new RDMPersonality("Config mode", &pixeldmx_paramsrdm)};
10097
RDMResponder rdm_responder(personalities, 2);
10198
#endif
@@ -104,17 +101,13 @@ int main() // NOLINT
104101
rdm_responder.DmxDisableOutput(!kIsConfigMode && (kTestPattern != pixelpatterns::Pattern::kNone));
105102
rdm_responder.Print();
106103

107-
if (kIsConfigMode)
108-
{
104+
if (kIsConfigMode) {
109105
pixeldmx_paramsrdm.Print();
110-
}
111-
else
112-
{
106+
} else {
113107
pixeldmx.Print();
114108
}
115109

116-
if (kIsConfigMode)
117-
{
110+
if (kIsConfigMode) {
118111
puts("Config mode");
119112
}
120113

@@ -132,8 +125,7 @@ int main() // NOLINT
132125

133126
common::firmware::pixeldmx::Show(7);
134127

135-
if (kIsConfigMode)
136-
{
128+
if (kIsConfigMode) {
137129
display.ClearLine(3);
138130
display.ClearLine(4);
139131
display.Write(4, "Config Mode");
@@ -143,8 +135,7 @@ int main() // NOLINT
143135
hal::statusled::SetMode(hal::statusled::Mode::NORMAL);
144136
hal::WatchdogInit();
145137

146-
for (;;)
147-
{
138+
for (;;) {
148139
hal::WatchdogFeed();
149140
rdm_responder.Run();
150141
#if !defined(NO_EMAC)

0 commit comments

Comments
 (0)