@@ -67,16 +67,14 @@ espurna::domoticz::Idx convert(const String& value) {
6767} // namespace settings
6868
6969namespace domoticz {
70- namespace internal {
7170namespace {
7271
72+ namespace internal {
73+
7374bool enabled { false };
7475
75- } // namespace
7676} // namespace internal
7777
78- namespace {
79-
8078bool enabled () {
8179 return internal::enabled;
8280}
@@ -89,10 +87,7 @@ void disable() {
8987 internal::enabled = false ;
9088}
9189
92- } // namespace
93-
9490namespace build {
95- namespace {
9691
9792static constexpr ::espurna::domoticz::Idx DefaultIdx;
9893
@@ -103,7 +98,6 @@ constexpr bool enabled() {
10398 return 1 == DOMOTICZ_ENABLED;
10499}
105100
106- } // namespace
107101} // namespace build
108102
109103namespace settings {
@@ -127,8 +121,6 @@ PROGMEM_STRING(LightIdx, "dczLightIdx");
127121
128122} // namespace keys
129123
130- namespace {
131-
132124bool enabled () {
133125 return getSetting (FPSTR (keys::Enabled), build::enabled ());
134126}
@@ -159,24 +151,19 @@ Idx lightIdx() {
159151}
160152#endif
161153
162- } // namespace
163154} // namespace settings
164155
165156#if RELAY_SUPPORT
166157namespace relay {
167158namespace internal {
168- namespace {
169159
170160using RelayMask = std::bitset<RelaysMax>;
171161
172162RelayMask last_active;
173163RelayMask last_status;
174164
175- } // namespace
176165} // namespace internal
177166
178- namespace {
179-
180167void send (Idx, bool );
181168void send ();
182169
@@ -228,13 +215,11 @@ void setup() {
228215 ::relayOnStatusChange (on_status);
229216}
230217
231- } // namespace
232218} // namespace relay
233219#endif
234220
235221#if LIGHT_PROVIDER != LIGHT_PROVIDER_NONE
236222namespace light {
237- namespace {
238223
239224void status (const JsonObject& root, unsigned char nvalue) {
240225 JsonObject& color = root[F (" Color" )];
@@ -281,12 +266,10 @@ void status(const JsonObject& root, unsigned char nvalue) {
281266 lightUpdate ();
282267}
283268
284- } // namespace
285269} // namespace light
286270#endif
287271
288272namespace mqtt {
289- namespace {
290273
291274void subscribe () {
292275 mqttSubscribeRaw (settings::topicOut ().c_str ());
@@ -370,12 +353,10 @@ void setup() {
370353 ::mqttRegister (callback);
371354}
372355
373- } // namespace
374356} // namespace mqtt
375357
376358#if RELAY_SUPPORT
377359namespace relay {
378- namespace {
379360
380361void send (Idx idx, bool value) {
381362 mqtt::send (idx, value ? 1 : 0 );
@@ -390,13 +371,11 @@ void send() {
390371 }
391372}
392373
393- } // namespace
394374} // namespace relay
395375#endif
396376
397377#if SENSOR_SUPPORT
398378namespace sensor {
399- namespace {
400379
401380void send (unsigned char index, const espurna::sensor::Value& value) {
402381 if (!enabled ()) {
@@ -442,13 +421,11 @@ void send(unsigned char index, const espurna::sensor::Value& value) {
442421 }
443422}
444423
445- } // namespace
446424} // namespace sensor
447425#endif // SENSOR_SUPPORT
448426
449427#if WEB_SUPPORT
450428namespace web {
451- namespace {
452429
453430STRING_VIEW_INLINE (Prefix, " dcz" );
454431
@@ -501,14 +478,11 @@ void setup() {
501478 .onKeyCheck (onKeyCheck);
502479}
503480
504- } // namespace
505481} // namespace web
506482#endif // WEB_SUPPORT
507483
508484// ------------------------------------------------------------------------------
509485
510- namespace {
511-
512486void configure () {
513487 auto enabled_in_cfg = settings::enabled ();
514488 if (enabled_in_cfg != enabled ()) {
0 commit comments