|
1 | 1 | /** |
2 | 2 | * @file dmxsendparams.cpp |
3 | 3 | */ |
4 | | -/* Copyright (C) 2025 by Arjan van Vught mailto:info@gd32-dmx.org */ |
5 | | - |
| 4 | +/* Copyright (C) 2025-2026 by Arjan van Vught mailto:infogd32-dmx.org |
| 5 | + * |
| 6 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | + * of this software and associated documentation files (the "Software"), to deal |
| 8 | + * in the Software without restriction, including without limitation the rights |
| 9 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 10 | + * copies of the Software, and to permit persons to whom the Software is |
| 11 | + * furnished to do so, subject to the following conditions: |
| 12 | +
|
| 13 | + * The above copyright notice and this permission notice shall be included in |
| 14 | + * all copies or substantial portions of the Software. |
| 15 | +
|
| 16 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 22 | + * THE SOFTWARE. |
| 23 | + */ |
6 | 24 |
|
7 | 25 | #ifdef DEBUG_DMXSENDPARAMS |
8 | 26 | #undef NDEBUG |
@@ -40,37 +58,35 @@ DmxSendParams::DmxSendParams() |
40 | 58 |
|
41 | 59 | void DmxSendParams::SetBreakTime(const char* val, uint32_t len) |
42 | 60 | { |
43 | | - ParseAndApply<uint16_t>(val, len, [](uint16_t v) { |
44 | | - store_dmx_send.break_time = v > dmx::transmit::kBreakTimeMin ? v : dmx::transmit::kBreakTimeMin; |
45 | | - }); |
| 61 | + ParseAndApply<uint16_t>(val, len, [](uint16_t v) { store_dmx_send.break_time = v > dmx::transmit::kBreakTimeMin ? v : dmx::transmit::kBreakTimeMin; }); |
46 | 62 | } |
47 | 63 |
|
48 | 64 | void DmxSendParams::SetMabTime(const char* val, uint32_t len) |
49 | 65 | { |
50 | | - ParseAndApply<uint16_t>(val, len, [](uint16_t v) { |
51 | | - store_dmx_send.mab_time = v > dmx::transmit::kMabTimeMin ? v : dmx::transmit::kMabTimeMin; |
52 | | - }); |
| 66 | + ParseAndApply<uint16_t>(val, len, [](uint16_t v) { store_dmx_send.mab_time = v > dmx::transmit::kMabTimeMin ? v : dmx::transmit::kMabTimeMin; }); |
53 | 67 | } |
54 | 68 |
|
55 | 69 | void DmxSendParams::SetRefreshRate(const char* val, uint32_t len) |
56 | 70 | { |
57 | | - ParseAndApply<uint16_t>(val, len, [](uint16_t v) { |
58 | | - store_dmx_send.refresh_rate = v; |
59 | | - }); |
| 71 | + ParseAndApply<uint16_t>(val, len, [](uint16_t v) { store_dmx_send.refresh_rate = v; }); |
60 | 72 | } |
61 | 73 |
|
62 | 74 | void DmxSendParams::SetSlotsCount(const char* val, uint32_t len) |
63 | 75 | { |
64 | | - ParseAndApply<uint16_t>(val, len, [](uint16_t v) { |
65 | | - if (v >= 2 && v < dmx::kChannelsMax) { |
66 | | - store_dmx_send.slots_count = RounddownSlots(v); |
67 | | - } else { |
68 | | - store_dmx_send.slots_count = RounddownSlots(dmx::kChannelsMax); |
69 | | - } |
70 | | - }); |
| 76 | + ParseAndApply<uint16_t>(val, len, |
| 77 | + [](uint16_t v) |
| 78 | + { |
| 79 | + if (v >= 2 && v < dmx::kChannelsMax) |
| 80 | + { |
| 81 | + store_dmx_send.slots_count = RounddownSlots(v); |
| 82 | + } |
| 83 | + else |
| 84 | + { |
| 85 | + store_dmx_send.slots_count = RounddownSlots(dmx::kChannelsMax); |
| 86 | + } |
| 87 | + }); |
71 | 88 | } |
72 | 89 |
|
73 | | - |
74 | 90 | void DmxSendParams::Store(const char* buffer, uint32_t buffer_size) |
75 | 91 | { |
76 | 92 | ParseJsonWithTable(buffer, buffer_size, kDmxSendKeys); |
|
0 commit comments