Skip to content

Commit dad3f8c

Browse files
committed
Format json_config_rdmsensors.cpp
Update copyright year to 2025-2026 and apply code style/formatting changes in json_config_rdmsensors.cpp (brace placement, indentation and spacing). No functional or behavioral changes were made.
1 parent 72e75e5 commit dad3f8c

1 file changed

Lines changed: 30 additions & 37 deletions

File tree

lib-rdmsensor/src/json/json_config_rdmsensors.cpp

Lines changed: 30 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @file json_config_rdmsensors.cpp
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
@@ -31,45 +31,38 @@
3131
#include "configstore.h"
3232
#include "common/utils/utils_hex.h"
3333

34-
namespace json::config
35-
{
36-
uint32_t GetRdmSensors(char* buffer, uint32_t length)
37-
{
38-
return json::helpers::Serialize(buffer, length, [&](JsonDoc& doc) {
39-
char a[32];
40-
for (size_t types = 0; types < json::RdmSensorsParams::KeysSize(); types++)
41-
{
42-
a[0] = '[';
43-
uint32_t k = 1;
44-
for (uint32_t j = 0; j < common::store::rdm::sensors::kMaxDevices; j++)
45-
{
46-
if ((k + 3) > 31) break;
47-
const auto kType = ConfigStore::Instance().RdmSensorsIndexedGetType(j);
48-
if (kType == types)
49-
{
50-
const auto kAddress = ConfigStore::Instance().RdmSensorsIndexedGetAddress(j);
51-
if (kAddress != 0)
52-
{
53-
a[k++] = common::hex::ToCharLowercase(kAddress >> 4);
54-
a[k++] = common::hex::ToCharLowercase(kAddress);
55-
a[k++] = ',';
56-
}
57-
}
58-
}
59-
60-
if (a[k - 1] == ',') k -= 1;
61-
62-
a[k++] = ']';
63-
a[k] = '\0';
64-
65-
const auto& keys = json::RdmSensorsParams::Keys();
66-
doc[keys[types].GetName()] = a;
67-
}
34+
namespace json::config {
35+
uint32_t GetRdmSensors(char* buffer, uint32_t length) {
36+
return json::helpers::Serialize(buffer, length, [&](JsonDoc& doc) {
37+
char a[32];
38+
for (size_t types = 0; types < json::RdmSensorsParams::KeysSize(); types++) {
39+
a[0] = '[';
40+
uint32_t k = 1;
41+
for (uint32_t j = 0; j < common::store::rdm::sensors::kMaxDevices; j++) {
42+
if ((k + 3) > 31) break;
43+
const auto kType = ConfigStore::Instance().RdmSensorsIndexedGetType(j);
44+
if (kType == types) {
45+
const auto kAddress = ConfigStore::Instance().RdmSensorsIndexedGetAddress(j);
46+
if (kAddress != 0) {
47+
a[k++] = common::hex::ToCharLowercase(kAddress >> 4);
48+
a[k++] = common::hex::ToCharLowercase(kAddress);
49+
a[k++] = ',';
50+
}
51+
}
52+
}
53+
54+
if (a[k - 1] == ',') k -= 1;
55+
56+
a[k++] = ']';
57+
a[k] = '\0';
58+
59+
const auto& keys = json::RdmSensorsParams::Keys();
60+
doc[keys[types].GetName()] = a;
61+
}
6862
});
6963
}
7064

71-
void SetRdmSensors(const char* buffer, uint32_t buffer_size)
72-
{
65+
void SetRdmSensors(const char* buffer, uint32_t buffer_size) {
7366
::json::RdmSensorsParams rdmsensors_params;
7467
rdmsensors_params.Store(buffer, buffer_size);
7568
}

0 commit comments

Comments
 (0)