22 * @file artnetnode4_inline_impl.h
33 *
44 */
5- /* Copyright (C) 2025 by Arjan van Vught mailto:info@gd32-dmx.org
5+ /* Copyright (C) 2025-2026 by Arjan van Vught mailto:info@gd32-dmx.org
66 *
77 * Permission is hereby granted, free of charge, to any person obtaining a copy
88 * of this software and associated documentation files (the "Software"), to deal
2929#include < cstdint>
3030
3131#include " artnetnode.h"
32- #include " firmware/debug/debug_debug.h"
32+ #include " firmware/debug/debug_debug.h"
3333#include " dmxnode.h"
3434#include " e131bridge.h"
3535#include " artnetstore.h"
3636#include " artnetdisplay.h"
3737
38- inline void ArtNetNode::SetUniverse4 (uint32_t port_index)
39- {
38+ inline void ArtNetNode::SetUniverse4 (uint32_t port_index) {
4039 DEBUG_ENTRY ();
4140
42- if (node_.port [port_index].protocol != artnet::PortProtocol::kSacn )
43- {
41+ if (node_.port [port_index].protocol != artnet::PortProtocol::kSacn ) {
4442 DEBUG_EXIT ();
4543 return ;
4644 }
4745
4846 auto universe = node_.port [port_index].port_address ;
4947
50- if (IsMapUniverse0 ())
51- {
48+ if (IsMapUniverse0 ()) {
5249 universe++;
5350 }
5451
55- if (universe == 0 )
56- {
52+ if (universe == 0 ) {
5753 DEBUG_EXIT ();
5854 return ;
5955 }
@@ -63,12 +59,10 @@ inline void ArtNetNode::SetUniverse4(uint32_t port_index)
6359 DEBUG_EXIT ();
6460}
6561
66- inline void ArtNetNode::SetDirection4 (uint32_t port_index)
67- {
62+ inline void ArtNetNode::SetDirection4 (uint32_t port_index) {
6863 DEBUG_ENTRY ();
6964
70- if (node_.port [port_index].protocol != artnet::PortProtocol::kSacn )
71- {
65+ if (node_.port [port_index].protocol != artnet::PortProtocol::kSacn ) {
7266 DEBUG_EXIT ();
7367 return ;
7468 }
@@ -78,87 +72,71 @@ inline void ArtNetNode::SetDirection4(uint32_t port_index)
7872 DEBUG_EXIT ();
7973}
8074
81- inline void ArtNetNode::SetPortProtocol4 (uint32_t port_index, artnet::PortProtocol port_protocol)
82- {
75+ inline void ArtNetNode::SetPortProtocol4 (uint32_t port_index, artnet::PortProtocol port_protocol) {
8376 DEBUG_PRINTF (" port_index=%u, PortProtocol=%s" , port_index, artnet::GetProtocolMode (port_protocol, false ));
8477
8578 assert (port_index < dmxnode::kMaxPorts );
8679
87- if (node_.port [port_index].protocol == port_protocol)
88- {
80+ if (node_.port [port_index].protocol == port_protocol) {
8981 DEBUG_EXIT ();
9082 return ;
9183 }
9284
9385 node_.port [port_index].protocol = port_protocol;
9486
95- if (port_protocol == artnet::PortProtocol::kSacn )
96- {
97- if (node_.port [port_index].direction == dmxnode::PortDirection::kOutput )
98- {
87+ if (port_protocol == artnet::PortProtocol::kSacn ) {
88+ if (node_.port [port_index].direction == dmxnode::PortDirection::kOutput ) {
9989 output_port_[port_index].good_output |= artnet::GoodOutput::kOutputIsSacn ;
10090 }
10191
10292 SetUniverse4 (port_index);
10393 E131Bridge::SetDirection (port_index, node_.port [port_index].direction );
104- }
105- else
106- {
107- if (node_.port [port_index].direction == dmxnode::PortDirection::kOutput )
108- {
94+ } else {
95+ if (node_.port [port_index].direction == dmxnode::PortDirection::kOutput ) {
10996 output_port_[port_index].good_output &= static_cast <uint8_t >(~artnet::GoodOutput::kOutputIsSacn );
11097 }
11198
11299 E131Bridge::SetDirection (port_index, dmxnode::PortDirection::kDisable );
113100 }
114101
115- if (state_.status == artnet::Status::kOn )
116- {
102+ if (state_.status == artnet::Status::kOn ) {
117103 artnet::store::SaveProtocol (port_index, port_protocol);
118104 artnet::display::Protocol (port_index, port_protocol);
119105 }
120106
121107 DEBUG_EXIT ();
122108}
123109
124- inline artnet::PortProtocol ArtNetNode::GetPortProtocol4 (uint32_t port_index) const
125- {
110+ inline artnet::PortProtocol ArtNetNode::GetPortProtocol4 (uint32_t port_index) const {
126111 assert (port_index < dmxnode::kMaxPorts );
127112 return node_.port [port_index].protocol ;
128113}
129114
130- inline void ArtNetNode::SetPriority4 (uint32_t port_index, uint8_t priority)
131- {
115+ inline void ArtNetNode::SetPriority4 (uint32_t port_index, uint8_t priority) {
132116 E131Bridge::SetPriority (port_index, priority);
133117}
134118
135- inline void ArtNetNode::SetPriority4 (uint32_t priority)
136- {
119+ inline void ArtNetNode::SetPriority4 (uint32_t priority) {
137120 art_poll_reply_.acn_priority = static_cast <uint8_t >(priority);
138121
139- for (uint32_t port_index = 0 ; port_index < dmxnode::kMaxPorts ; port_index++)
140- {
122+ for (uint32_t port_index = 0 ; port_index < dmxnode::kMaxPorts ; port_index++) {
141123 E131Bridge::SetPriority (port_index, static_cast <uint8_t >(priority));
142124 }
143125}
144126
145- inline uint8_t ArtNetNode::GetPriority4 (uint32_t port_index) const
146- {
127+ inline uint8_t ArtNetNode::GetPriority4 (uint32_t port_index) const {
147128 return E131Bridge::GetPriority (port_index);
148129}
149130
150- inline uint8_t ArtNetNode::GetGoodOutput4 (uint32_t port_index)
151- {
131+ inline uint8_t ArtNetNode::GetGoodOutput4 (uint32_t port_index) {
152132 assert (port_index < dmxnode::kMaxPorts );
153133
154134 uint16_t universe;
155135 const auto kIsActive = E131Bridge::GetUniverse (port_index, universe, dmxnode::PortDirection::kOutput );
156136
157- DEBUG_PRINTF (" Port %u, Active %c, Universe %d, %s" , port_index, kIsActive ? ' Y' : ' N' , universe,
158- dmxnode::GetMergeMode (E131Bridge::GetMergeMode (port_index), true ));
137+ DEBUG_PRINTF (" Port %u, Active %c, Universe %d, %s" , port_index, kIsActive ? ' Y' : ' N' , universe, dmxnode::GetMergeMode (E131Bridge::GetMergeMode (port_index), true ));
159138
160- if (kIsActive )
161- {
139+ if (kIsActive ) {
162140 uint8_t status = artnet::GoodOutput::kOutputIsSacn ;
163141 status = status | (E131Bridge::IsTransmitting (port_index) ? artnet::GoodOutput::kDataIsBeingTransmitted : artnet::GoodOutput::kOutputNone );
164142 status = status | (E131Bridge::IsMerging (port_index) ? artnet::GoodOutput::kOutputIsMerging : artnet::GoodOutput::kOutputNone );
@@ -168,27 +146,23 @@ inline uint8_t ArtNetNode::GetGoodOutput4(uint32_t port_index)
168146 return 0 ;
169147}
170148
171- inline void ArtNetNode::SetLedBlinkMode4 (hal::statusled::Mode mode)
172- {
149+ inline void ArtNetNode::SetLedBlinkMode4 (hal::statusled::Mode mode) {
173150 static hal::statusled::Mode s_mode;
174151
175- if (s_mode != mode)
176- {
152+ if (s_mode != mode) {
177153 s_mode = mode;
178154 DEBUG_PRINTF (" mode=%u" , static_cast <uint32_t >(mode));
179155 }
180156
181- E131Bridge::SetEnableDataIndicator (mode == hal::statusled::Mode::NORMAL );
157+ E131Bridge::SetEnableDataIndicator (mode == hal::statusled::Mode::kNormal );
182158
183- for (uint32_t port_index = 0 ; port_index < dmxnode::kMaxPorts ; port_index++)
184- {
185- if (E131Bridge::IsTransmitting (port_index))
186- {
159+ for (uint32_t port_index = 0 ; port_index < dmxnode::kMaxPorts ; port_index++) {
160+ if (E131Bridge::IsTransmitting (port_index)) {
187161 return ;
188162 }
189163 }
190164
191165 hal::statusled::SetMode (mode);
192166}
193167
194- #endif // ARTNETNODE4_INLINE_IMPL_H_
168+ #endif // ARTNETNODE4_INLINE_IMPL_H_
0 commit comments