From 986760af33a33902dd99cf506815c2e48397274c Mon Sep 17 00:00:00 2001 From: nekomona Date: Mon, 31 Jul 2023 01:29:30 +0800 Subject: [PATCH] Add remote command to feature flag list --- src/network/featureflags.h | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/network/featureflags.h b/src/network/featureflags.h index b1be622a2..4a31315da 100644 --- a/src/network/featureflags.h +++ b/src/network/featureflags.h @@ -26,20 +26,21 @@ #include #include +#include "debug.h" /** * Bit packed flags, enum values start with 0 and indicate which bit it is. - * + * * Change the enums and `flagsEnabled` inside to extend. */ struct ServerFeatures { public: enum EServerFeatureFlags: uint32_t { // Server can parse bundle packets: `PACKET_BUNDLE` = 100 (0x64). - PROTOCOL_BUNDLE_SUPPORT, - + PROTOCOL_BUNDLE_SUPPORT = 0, + // Add new flags here - + BITS_TOTAL, }; @@ -73,15 +74,18 @@ class FirmwareFeatures { public: enum EFirmwareFeatureFlags: uint32_t { // EXAMPLE_FEATURE, - + REMOTE_COMMAND = 0, // Add new flags here - + BITS_TOTAL, }; // Flags to send static constexpr const std::initializer_list flagsEnabled = { // EXAMPLE_FEATURE, +#ifdef USE_REMOTE_COMMAND + REMOTE_COMMAND, +#endif // Add enabled flags here }; @@ -89,7 +93,7 @@ class FirmwareFeatures { static constexpr auto flags = []{ constexpr uint32_t flagsLength = EFirmwareFeatureFlags::BITS_TOTAL / 8 + 1; std::array packed{}; - + for (uint32_t bit : flagsEnabled) { packed[bit / 8] |= 1 << (bit % 8); } @@ -98,4 +102,4 @@ class FirmwareFeatures { }(); }; -#endif \ No newline at end of file +#endif