File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed
Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change 2626
2727#include < cstring>
2828#include < algorithm>
29+ #include " debug.h"
2930
3031/* *
3132 * Bit packed flags, enum values start with 0 and indicate which bit it is.
32- *
33+ *
3334 * Change the enums and `flagsEnabled` inside to extend.
3435*/
3536struct ServerFeatures {
3637public:
3738 enum EServerFeatureFlags: uint32_t {
3839 // Server can parse bundle packets: `PACKET_BUNDLE` = 100 (0x64).
39- PROTOCOL_BUNDLE_SUPPORT,
40-
40+ PROTOCOL_BUNDLE_SUPPORT = 0 ,
41+
4142 // Add new flags here
42-
43+
4344 BITS_TOTAL,
4445 };
4546
@@ -73,23 +74,26 @@ class FirmwareFeatures {
7374public:
7475 enum EFirmwareFeatureFlags: uint32_t {
7576 // EXAMPLE_FEATURE,
76-
77+ REMOTE_COMMAND = 0 ,
7778 // Add new flags here
78-
79+
7980 BITS_TOTAL,
8081 };
8182
8283 // Flags to send
8384 static constexpr const std::initializer_list<EFirmwareFeatureFlags> flagsEnabled = {
8485 // EXAMPLE_FEATURE,
86+ #ifdef USE_REMOTE_COMMAND
87+ REMOTE_COMMAND,
88+ #endif
8589
8690 // Add enabled flags here
8791 };
8892
8993 static constexpr auto flags = []{
9094 constexpr uint32_t flagsLength = EFirmwareFeatureFlags::BITS_TOTAL / 8 + 1 ;
9195 std::array<uint8_t , flagsLength> packed{};
92-
96+
9397 for (uint32_t bit : flagsEnabled) {
9498 packed[bit / 8 ] |= 1 << (bit % 8 );
9599 }
@@ -98,4 +102,4 @@ class FirmwareFeatures {
98102 }();
99103};
100104
101- #endif
105+ #endif
You can’t perform that action at this time.
0 commit comments