Skip to content

Fix WiFi CRUD for hidden networks, add stepper wizard and advanced mode#426

Open
hhvrc wants to merge 1 commit intodevelopfrom
feat/wifi-crud-fixes-and-advanced-mode
Open

Fix WiFi CRUD for hidden networks, add stepper wizard and advanced mode#426
hhvrc wants to merge 1 commit intodevelopfrom
feat/wifi-crud-fixes-and-advanced-mode

Conversation

@hhvrc
Copy link
Contributor

@hhvrc hhvrc commented Mar 3, 2026

Summary

  • Firmware WiFi CRUD fixes: WiFiManager::Save() and Forget() no longer require the network to be in scan results, enabling hidden network support and forgetting networks that have gone out of range. The connect field from WifiNetworkSaveCommand is now properly passed through.
  • Stepper wizard: Replaces the old flat config page with a guided 3-step wizard (WiFi -> Hardware -> Account) as the default view.
  • Advanced mode: Header toggle switches to a flat "all config on one page" view with new OTA, Backend, and Captive Portal sections plus 9 new FlatBuffer serializers.

Test plan

  • Flash firmware, verify hidden network save/forget works via captive portal
  • Verify the connect flag: saving with connect=false should not trigger a connection attempt
  • Toggle between Setup (wizard) and Advanced mode via header button
  • Verify all wizard steps render and navigation works (WiFi gate on step 1)
  • Verify all advanced sections render: WiFi, Hardware, Account, Backend, OTA, Captive Portal
  • Test OTA controls: toggle enabled, change channel, save CDN domain, check for updates
  • Test account unlink button in advanced mode
  • Confirm pnpm check, pnpm build, and pio run -e ci-build all pass

🤖 Generated with Claude Code

Firmware: WiFiManager::Save() and Forget() no longer require the network
to be in scan results, enabling hidden network support and forgetting
out-of-range networks. The connect field from WifiNetworkSaveCommand is
now passed through to the handler.

Frontend: Replace the flat config page with a stepper wizard (WiFi ->
Hardware -> Account) as the default view. Add an Advanced mode toggle in
the header that shows a flat page with all config sections including new
OTA, Backend, and Captive Portal settings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@changeset-bot
Copy link

changeset-bot bot commented Mar 3, 2026

⚠️ No Changeset found

Latest commit: 84309a7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

Cpp-Linter Report ⚠️

Some files did not pass the configured checks!

clang-format (v21.1.8) reports: 2 file(s) not formatted
  • src/message_handlers/websocket/local/WiFiNetworkSaveCommand.cpp
  • src/wifi/WiFiManager.cpp
clang-tidy (v21.1.8) reports: 140 concern(s)
  • include/wifi/WiFiManager.h:1:1: warning: [portability-avoid-pragma-once]

    avoid 'pragma once' directive; use include guards instead

        1 | #pragma once
          | ^
  • include/wifi/WiFiManager.h:13:22: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       13 |   [[nodiscard]] bool Init();
          |                 ~~~~ ^     
          |                 auto        -> bool
  • include/wifi/WiFiManager.h:20:8: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       20 |   bool Save(const char* ssid, std::string_view password, bool connect = true);
          |   ~~~~ ^                                                                     
          |   auto                                                                        -> bool
  • include/wifi/WiFiManager.h:25:8: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       25 |   bool Forget(const char* ssid);
          |   ~~~~ ^                       
          |   auto                          -> bool
  • include/wifi/WiFiManager.h:29:8: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       29 |   bool RefreshNetworkCredentials();
          |   ~~~~ ^                          
          |   auto                             -> bool
  • include/wifi/WiFiManager.h:34:8: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       34 |   bool IsSaved(const char* ssid);
          |   ~~~~ ^                        
          |   auto                           -> bool
  • include/wifi/WiFiManager.h:39:8: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       39 |   bool Connect(const char* ssid);
          |   ~~~~ ^                        
          |   auto                           -> bool
  • include/wifi/WiFiManager.h:44:8: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       44 |   bool Connect(const uint8_t (&bssid)[6]);
          |   ~~~~ ^                                 
          |   auto                                    -> bool
  • include/wifi/WiFiManager.h:44:38: warning: [cppcoreguidelines-avoid-c-arrays]

    do not declare C-style arrays, use 'std::array' instead

       44 |   bool Connect(const uint8_t (&bssid)[6]);
          |                                      ^
  • include/wifi/WiFiManager.h:44:39: warning: [cppcoreguidelines-avoid-magic-numbers]

    6 is a magic number; consider replacing it with a named constant

       44 |   bool Connect(const uint8_t (&bssid)[6]);
          |                                       ^
  • include/wifi/WiFiManager.h:51:8: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       51 |   bool IsConnected();
          |   ~~~~ ^            
          |   auto               -> bool
  • include/wifi/WiFiManager.h:56:8: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       56 |   bool GetConnectedNetwork(OpenShock::WiFiNetwork& network);
          |   ~~~~ ^                                                   
          |   auto                                                      -> bool
  • include/wifi/WiFiManager.h:61:8: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       61 |   bool GetIPAddress(char* ipAddress);
          |   ~~~~ ^                            
          |   auto                               -> bool
  • include/wifi/WiFiManager.h:66:8: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       66 |   bool GetIPv6Address(char* ipAddress);
          |   ~~~~ ^                              
          |   auto                                 -> bool
  • include/wifi/WiFiManager.h:70:28: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       70 |   std::vector<WiFiNetwork> GetDiscoveredWiFiNetworks();
          |                            ^
  • src/message_handlers/websocket/local/WiFiNetworkSaveCommand.cpp:17:3: warning: [readability-qualified-auto]

    'auto msg' can be declared as 'const auto *msg'

       17 |   auto msg = root->payload_as_WifiNetworkSaveCommand();
          |   ^~~~
          |   const auto *
  • src/message_handlers/websocket/local/WiFiNetworkSaveCommand.cpp:23:3: warning: [readability-qualified-auto]

    'auto ssid' can be declared as 'const auto *ssid'

       23 |   auto ssid     = msg->ssid();
          |   ^~~~
          |   const auto *
  • src/message_handlers/websocket/local/WiFiNetworkSaveCommand.cpp:24:19: warning: [readability-implicit-bool-conversion]

    implicit conversion 'const ::flatbuffers::String *' -> 'bool'

       24 |   auto password = msg->password() ? msg->password()->str() : "";
          |                   ^
          |                   (               != nullptr)
  • src/message_handlers/websocket/local/WiFiNetworkSaveCommand.cpp:31:22: warning: [cppcoreguidelines-avoid-magic-numbers]

    31 is a magic number; consider replacing it with a named constant

       31 |   if (ssid->size() > 31) {
          |                      ^
  • src/message_handlers/websocket/local/WiFiNetworkSaveCommand.cpp:38:47: warning: [cppcoreguidelines-avoid-magic-numbers]

    8 is a magic number; consider replacing it with a named constant

       38 |   if (passwordLength != 0 && passwordLength < 8) {
          |                                               ^
  • src/message_handlers/websocket/local/WiFiNetworkSaveCommand.cpp:43:24: warning: [cppcoreguidelines-avoid-magic-numbers]

    63 is a magic number; consider replacing it with a named constant

       43 |   if (passwordLength > 63) {
          |                        ^
  • src/wifi/WiFiManager.cpp:26:12: warning: [performance-enum-size]

    enum 'WiFiState' uses a larger base type ('int', size: 4 bytes) than necessary for its value set, consider using 'std::uint8_t' (1 byte) as the base type to reduce its size

       26 | enum class WiFiState : uint8_t {
          |            ^
  • src/wifi/WiFiManager.cpp:32:18: warning: [cppcoreguidelines-avoid-non-const-global-variables]

    variable 's_wifiState' is non-const and globally accessible, consider making it const

       32 | static WiFiState s_wifiState            = WiFiState::Disconnected;
          |                  ^
  • src/wifi/WiFiManager.cpp:33:16: warning: [cppcoreguidelines-avoid-non-const-global-variables]

    variable 's_connectedBSSID' is non-const and globally accessible, consider making it const

       33 | static uint8_t s_connectedBSSID[6]      = {0};
          |                ^
  • src/wifi/WiFiManager.cpp:33:32: warning: [cppcoreguidelines-avoid-c-arrays]

    do not declare C-style arrays, use 'std::array' instead

       33 | static uint8_t s_connectedBSSID[6]      = {0};
          |                                ^
  • src/wifi/WiFiManager.cpp:33:33: warning: [cppcoreguidelines-avoid-magic-numbers]

    6 is a magic number; consider replacing it with a named constant

       33 | static uint8_t s_connectedBSSID[6]      = {0};
          |                                 ^
  • src/wifi/WiFiManager.cpp:34:16: warning: [cppcoreguidelines-avoid-non-const-global-variables]

    variable 's_connectedCredentialsID' is non-const and globally accessible, consider making it const

       34 | static uint8_t s_connectedCredentialsID = 0;
          |                ^
  • src/wifi/WiFiManager.cpp:35:16: warning: [cppcoreguidelines-avoid-non-const-global-variables]

    variable 's_preferredCredentialsID' is non-const and globally accessible, consider making it const

       35 | static uint8_t s_preferredCredentialsID = 0;
          |                ^
  • src/wifi/WiFiManager.cpp:36:33: warning: [cppcoreguidelines-avoid-non-const-global-variables]

    variable 's_wifiNetworks' is non-const and globally accessible, consider making it const

       36 | static std::vector<WiFiNetwork> s_wifiNetworks;
          |                                 ^
  • src/wifi/WiFiManager.cpp:38:6: warning: [bugprone-reserved-identifier]

    declaration uses identifier '_isZeroBSSID', which is reserved in the global namespace

       38 | bool _isZeroBSSID(const uint8_t (&bssid)[6])
          |      ^~~~~~~~~~~~
          |      isZeroBSSID
  • src/wifi/WiFiManager.cpp:38:6: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       38 | bool _isZeroBSSID(const uint8_t (&bssid)[6])
          | ~~~~ ^                                      
          | auto                                         -> bool
  • src/wifi/WiFiManager.cpp:38:41: warning: [cppcoreguidelines-avoid-c-arrays]

    do not declare C-style arrays, use 'std::array' instead

       38 | bool _isZeroBSSID(const uint8_t (&bssid)[6])
          |                                         ^
  • src/wifi/WiFiManager.cpp:38:42: warning: [cppcoreguidelines-avoid-magic-numbers]

    6 is a magic number; consider replacing it with a named constant

       38 | bool _isZeroBSSID(const uint8_t (&bssid)[6])
          |                                          ^
  • src/wifi/WiFiManager.cpp:49:6: warning: [bugprone-reserved-identifier]

    declaration uses identifier '_attractivityComparer', which is reserved in the global namespace

       49 | bool _attractivityComparer(const WiFiNetwork& a, const WiFiNetwork& b)
          |      ^~~~~~~~~~~~~~~~~~~~~
          |      attractivityComparer
  • src/wifi/WiFiManager.cpp:49:6: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       49 | bool _attractivityComparer(const WiFiNetwork& a, const WiFiNetwork& b)
          | ~~~~ ^                                                                
          | auto                                                                   -> bool
  • src/wifi/WiFiManager.cpp:49:47: warning: [readability-identifier-length]

    parameter name 'a' is too short, expected at least 3 characters

       49 | bool _attractivityComparer(const WiFiNetwork& a, const WiFiNetwork& b)
          |                                               ^
  • src/wifi/WiFiManager.cpp:49:69: warning: [readability-identifier-length]

    parameter name 'b' is too short, expected at least 3 characters

       49 | bool _attractivityComparer(const WiFiNetwork& a, const WiFiNetwork& b)
          |                                                                     ^
  • src/wifi/WiFiManager.cpp:61:6: warning: [bugprone-reserved-identifier]

    declaration uses identifier '_isConnectRateLimited', which is reserved in the global namespace

       61 | bool _isConnectRateLimited(const WiFiNetwork& net)
          |      ^~~~~~~~~~~~~~~~~~~~~
          |      isConnectRateLimited
  • src/wifi/WiFiManager.cpp:61:6: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       61 | bool _isConnectRateLimited(const WiFiNetwork& net)
          | ~~~~ ^                                            
          | auto                                               -> bool
  • src/wifi/WiFiManager.cpp:69:30: warning: [cppcoreguidelines-avoid-magic-numbers]

    5 is a magic number; consider replacing it with a named constant

       69 |   if ((net.connectAttempts > 5 && diff < 5000) || (net.connectAttempts > 10 && diff < 10'000) || (net.connectAttempts > 15 && diff < 30'000) || (net.connectAttempts > 20 && diff < 60'000)) {
          |                              ^
  • src/wifi/WiFiManager.cpp:69:42: warning: [cppcoreguidelines-avoid-magic-numbers]

    5000 is a magic number; consider replacing it with a named constant

       69 |   if ((net.connectAttempts > 5 && diff < 5000) || (net.connectAttempts > 10 && diff < 10'000) || (net.connectAttempts > 15 && diff < 30'000) || (net.connectAttempts > 20 && diff < 60'000)) {
          |                                          ^
  • src/wifi/WiFiManager.cpp:69:74: warning: [cppcoreguidelines-avoid-magic-numbers]

    10 is a magic number; consider replacing it with a named constant

       69 |   if ((net.connectAttempts > 5 && diff < 5000) || (net.connectAttempts > 10 && diff < 10'000) || (net.connectAttempts > 15 && diff < 30'000) || (net.connectAttempts > 20 && diff < 60'000)) {
          |                                                                          ^
  • src/wifi/WiFiManager.cpp:69:87: warning: [cppcoreguidelines-avoid-magic-numbers]

    10'000 is a magic number; consider replacing it with a named constant

       69 |   if ((net.connectAttempts > 5 && diff < 5000) || (net.connectAttempts > 10 && diff < 10'000) || (net.connectAttempts > 15 && diff < 30'000) || (net.connectAttempts > 20 && diff < 60'000)) {
          |                                                                                       ^
  • src/wifi/WiFiManager.cpp:69:121: warning: [cppcoreguidelines-avoid-magic-numbers]

    15 is a magic number; consider replacing it with a named constant

       69 |   if ((net.connectAttempts > 5 && diff < 5000) || (net.connectAttempts > 10 && diff < 10'000) || (net.connectAttempts > 15 && diff < 30'000) || (net.connectAttempts > 20 && diff < 60'000)) {
          |                                                                                                                         ^
  • src/wifi/WiFiManager.cpp:69:134: warning: [cppcoreguidelines-avoid-magic-numbers]

    30'000 is a magic number; consider replacing it with a named constant

       69 |   if ((net.connectAttempts > 5 && diff < 5000) || (net.connectAttempts > 10 && diff < 10'000) || (net.connectAttempts > 15 && diff < 30'000) || (net.connectAttempts > 20 && diff < 60'000)) {
          |                                                                                                                                      ^
  • src/wifi/WiFiManager.cpp:69:168: warning: [cppcoreguidelines-avoid-magic-numbers]

    20 is a magic number; consider replacing it with a named constant

       69 |   if ((net.connectAttempts > 5 && diff < 5000) || (net.connectAttempts > 10 && diff < 10'000) || (net.connectAttempts > 15 && diff < 30'000) || (net.connectAttempts > 20 && diff < 60'000)) {
          |                                                                                                                                                                        ^
  • src/wifi/WiFiManager.cpp:69:181: warning: [cppcoreguidelines-avoid-magic-numbers]

    60'000 is a magic number; consider replacing it with a named constant

       69 |   if ((net.connectAttempts > 5 && diff < 5000) || (net.connectAttempts > 10 && diff < 10'000) || (net.connectAttempts > 15 && diff < 30'000) || (net.connectAttempts > 20 && diff < 60'000)) {
          |                                                                                                                                                                                     ^
  • src/wifi/WiFiManager.cpp:70:12: warning: [readability-simplify-boolean-expr]

    redundant boolean literal in conditional return statement

       69 |   if ((net.connectAttempts > 5 && diff < 5000) || (net.connectAttempts > 10 && diff < 10'000) || (net.connectAttempts > 15 && diff < 30'000) || (net.connectAttempts > 20 && diff < 60'000)) {
          |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          |   return static_cast<bool>((net.connectAttempts > 5 && diff < 5000) || (net.connectAttempts > 10 && diff < 10'000) || (net.connectAttempts > 15 && diff < 30'000) || (net.connectAttempts > 20 && diff < 60'000))
       70 |     return true;
          |     ~~~~~~~^~~~~
       71 |   }
          |   ~
       72 | 
       73 |   return false;
          |   ~~~~~~~~~~~~
  • src/wifi/WiFiManager.cpp:76:6: warning: [bugprone-reserved-identifier]

    declaration uses identifier '_isSaved', which is reserved in the global namespace

       76 | bool _isSaved(std::function<bool(const Config::WiFiCredentials&)> predicate)
          |      ^~~~~~~~
          |      isSaved
  • src/wifi/WiFiManager.cpp:76:6: warning: [cppcoreguidelines-avoid-non-const-global-variables]

    variable '_isSaved' is non-const and globally accessible, consider making it const

  • src/wifi/WiFiManager.cpp:80:27: warning: [cppcoreguidelines-avoid-non-const-global-variables]

    variable 'iterator' is non-const and globally accessible, consider making it const

       80 | std::vector<WiFiNetwork>::iterator _findNetwork(std::function<bool(WiFiNetwork&)> predicate, bool sortByAttractivity = true)
          |                           ^
  • src/wifi/WiFiManager.cpp:87:27: warning: [cppcoreguidelines-avoid-non-const-global-variables]

    variable 'iterator' is non-const and globally accessible, consider making it const

       87 | std::vector<WiFiNetwork>::iterator _findNetworkBySSID(const char* ssid, bool sortByAttractivity = true)
          |                           ^
  • src/wifi/WiFiManager.cpp:91:27: warning: [cppcoreguidelines-avoid-non-const-global-variables]

    variable 'iterator' is non-const and globally accessible, consider making it const

       91 | std::vector<WiFiNetwork>::iterator _findNetworkByBSSID(const uint8_t (&bssid)[6])
          |                           ^
  • src/wifi/WiFiManager.cpp:95:27: warning: [cppcoreguidelines-avoid-non-const-global-variables]

    variable 'iterator' is non-const and globally accessible, consider making it const

       95 | std::vector<WiFiNetwork>::iterator _findNetworkByCredentialsID(uint8_t credentialsID, bool sortByAttractivity = true)
          |                           ^
  • src/wifi/WiFiManager.cpp:100:6: warning: [bugprone-reserved-identifier]

    declaration uses identifier '_markNetworkAsAttempted', which is reserved in the global namespace

      100 | bool _markNetworkAsAttempted(const uint8_t (&bssid)[6])
          |      ^~~~~~~~~~~~~~~~~~~~~~~
          |      markNetworkAsAttempted
  • src/wifi/WiFiManager.cpp:100:6: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

      100 | bool _markNetworkAsAttempted(const uint8_t (&bssid)[6])
          | ~~~~ ^                                                 
          | auto                                                    -> bool
  • src/wifi/WiFiManager.cpp:100:52: warning: [cppcoreguidelines-avoid-c-arrays]

    do not declare C-style arrays, use 'std::array' instead

      100 | bool _markNetworkAsAttempted(const uint8_t (&bssid)[6])
          |                                                    ^
  • src/wifi/WiFiManager.cpp:100:53: warning: [cppcoreguidelines-avoid-magic-numbers]

    6 is a magic number; consider replacing it with a named constant

      100 | bool _markNetworkAsAttempted(const uint8_t (&bssid)[6])
          |                                                     ^
  • src/wifi/WiFiManager.cpp:102:8: warning: [readability-identifier-length]

    variable name 'it' is too short, expected at least 3 characters

      102 |   auto it = _findNetworkByBSSID(bssid);
          |        ^
  • src/wifi/WiFiManager.cpp:113:6: warning: [bugprone-reserved-identifier]

    declaration uses identifier '_getNextWiFiNetwork', which is reserved in the global namespace

      113 | bool _getNextWiFiNetwork(OpenShock::Config::WiFiCredentials& creds)
          |      ^~~~~~~~~~~~~~~~~~~
          |      getNextWiFiNetwork
  • src/wifi/WiFiManager.cpp:113:6: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

      113 | bool _getNextWiFiNetwork(OpenShock::Config::WiFiCredentials& creds)
          | ~~~~ ^                                                             
          | auto                                                                -> bool
  • src/wifi/WiFiManager.cpp:115:23: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this lambda

      115 |   return _findNetwork([&creds](const WiFiNetwork& net) {
          |                       ^
          |                                                        -> bool
  • src/wifi/WiFiManager.cpp:132:6: warning: [bugprone-reserved-identifier]

    declaration uses identifier '_connectImpl', which is reserved in the global namespace

      132 | bool _connectImpl(const char* ssid, const char* password, const uint8_t (&bssid)[6])
          |      ^~~~~~~~~~~~
          |      connectImpl
  • src/wifi/WiFiManager.cpp:132:6: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

      132 | bool _connectImpl(const char* ssid, const char* password, const uint8_t (&bssid)[6])
          | ~~~~ ^                                                                              
          | auto                                                                                 -> bool
  • src/wifi/WiFiManager.cpp:132:81: warning: [cppcoreguidelines-avoid-c-arrays]

    do not declare C-style arrays, use 'std::array' instead

      132 | bool _connectImpl(const char* ssid, const char* password, const uint8_t (&bssid)[6])
          |                                                                                 ^
  • src/wifi/WiFiManager.cpp:132:82: warning: [cppcoreguidelines-avoid-magic-numbers]

    6 is a magic number; consider replacing it with a named constant

      132 | bool _connectImpl(const char* ssid, const char* password, const uint8_t (&bssid)[6])
          |                                                                                  ^
  • src/wifi/WiFiManager.cpp:147:6: warning: [bugprone-reserved-identifier]

    declaration uses identifier '_connectHidden', which is reserved in the global namespace

      147 | bool _connectHidden(const uint8_t (&bssid)[6], const std::string& password)
          |      ^~~~~~~~~~~~~~
          |      connectHidden
  • src/wifi/WiFiManager.cpp:147:6: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

      147 | bool _connectHidden(const uint8_t (&bssid)[6], const std::string& password)
          | ~~~~ ^                                                                     
          | auto                                                                        -> bool
  • src/wifi/WiFiManager.cpp:147:43: warning: [cppcoreguidelines-avoid-c-arrays]

    do not declare C-style arrays, use 'std::array' instead

      147 | bool _connectHidden(const uint8_t (&bssid)[6], const std::string& password)
          |                                           ^
  • src/wifi/WiFiManager.cpp:147:44: warning: [cppcoreguidelines-avoid-magic-numbers]

    6 is a magic number; consider replacing it with a named constant

      147 | bool _connectHidden(const uint8_t (&bssid)[6], const std::string& password)
          |                                            ^
  • src/wifi/WiFiManager.cpp:158:6: warning: [bugprone-reserved-identifier]

    declaration uses identifier '_connect', which is reserved in the global namespace

      158 | bool _connect(const std::string& ssid, const std::string& password)
          |      ^~~~~~~~
          |      connect
  • src/wifi/WiFiManager.cpp:158:6: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

      158 | bool _connect(const std::string& ssid, const std::string& password)
          | ~~~~ ^                                                             
          | auto                                                                -> bool
  • src/wifi/WiFiManager.cpp:158:15: warning: [bugprone-easily-swappable-parameters]

    2 adjacent parameters of '_connect' of similar type ('const int &') are easily swapped by mistake

      158 | bool _connect(const std::string& ssid, const std::string& password)
          |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    src/wifi/WiFiManager.cpp:158:34: note: the first parameter in the range is 'ssid'
      158 | bool _connect(const std::string& ssid, const std::string& password)
          |                                  ^~~~
    src/wifi/WiFiManager.cpp:158:59: note: the last parameter in the range is 'password'
      158 | bool _connect(const std::string& ssid, const std::string& password)
          |                                                           ^~~~~~~~
  • src/wifi/WiFiManager.cpp:165:8: warning: [readability-identifier-length]

    variable name 'it' is too short, expected at least 3 characters

      165 |   auto it = _findNetworkBySSID(ssid.c_str());
          |        ^
  • src/wifi/WiFiManager.cpp:173:6: warning: [bugprone-reserved-identifier]

    declaration uses identifier '_connect', which is reserved in the global namespace

      173 | bool _connect(const uint8_t (&bssid)[6], const std::string& password)
          |      ^~~~~~~~
          |      connect
  • src/wifi/WiFiManager.cpp:173:6: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

      173 | bool _connect(const uint8_t (&bssid)[6], const std::string& password)
          | ~~~~ ^                                                               
          | auto                                                                  -> bool
  • src/wifi/WiFiManager.cpp:173:37: warning: [cppcoreguidelines-avoid-c-arrays]

    do not declare C-style arrays, use 'std::array' instead

      173 | bool _connect(const uint8_t (&bssid)[6], const std::string& password)
          |                                     ^
  • src/wifi/WiFiManager.cpp:173:38: warning: [cppcoreguidelines-avoid-magic-numbers]

    6 is a magic number; consider replacing it with a named constant

      173 | bool _connect(const uint8_t (&bssid)[6], const std::string& password)
          |                                      ^
  • src/wifi/WiFiManager.cpp:180:8: warning: [readability-identifier-length]

    variable name 'it' is too short, expected at least 3 characters

      180 |   auto it = _findNetworkByBSSID(bssid);
          |        ^
  • src/wifi/WiFiManager.cpp:189:6: warning: [bugprone-reserved-identifier]

    declaration uses identifier '_authenticate', which is reserved in the global namespace

      189 | bool _authenticate(const WiFiNetwork& net, std::string_view password)
          |      ^~~~~~~~~~~~~
          |      authenticate
  • src/wifi/WiFiManager.cpp:189:6: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

      189 | bool _authenticate(const WiFiNetwork& net, std::string_view password)
          | ~~~~ ^                                                               
          | auto                                                                  -> bool
  • src/wifi/WiFiManager.cpp:191:11: warning: [readability-identifier-length]

    variable name 'id' is too short, expected at least 3 characters

      191 |   uint8_t id = Config::AddWiFiCredentials(net.ssid, password);
          |           ^
  • src/wifi/WiFiManager.cpp:202:6: warning: [bugprone-reserved-identifier]

    declaration uses identifier '_evWiFiConnected', which is reserved in the global namespace

      202 | void _evWiFiConnected(arduino_event_t* event)
          |      ^~~~~~~~~~~~~~~~
          |      evWiFiConnected
  • src/wifi/WiFiManager.cpp:209:8: warning: [readability-identifier-length]

    variable name 'it' is too short, expected at least 3 characters

      209 |   auto it = _findNetworkByBSSID(info.bssid);
          |        ^
  • src/wifi/WiFiManager.cpp:213:78: warning: [cppcoreguidelines-pro-type-reinterpret-cast]

    do not use reinterpret_cast

      213 |     OS_LOGW(TAG, "Connected to unscanned network \"%s\", BSSID: " BSSID_FMT, reinterpret_cast<char*>(info.ssid), BSSID_ARG(info.bssid));
          |                                                                              ^
  • src/wifi/WiFiManager.cpp:220:59: warning: [cppcoreguidelines-pro-type-reinterpret-cast]

    do not use reinterpret_cast

      220 |   OS_LOGI(TAG, "Connected to network %s (" BSSID_FMT ")", reinterpret_cast<const char*>(info.ssid), BSSID_ARG(info.bssid));
          |                                                           ^
  • src/wifi/WiFiManager.cpp:224:6: warning: [bugprone-reserved-identifier]

    declaration uses identifier '_evWiFiGotIP', which is reserved in the global namespace

      224 | void _evWiFiGotIP(arduino_event_t* event)
          |      ^~~~~~~~~~~~
          |      evWiFiGotIP
  • src/wifi/WiFiManager.cpp:228:11: warning: [readability-identifier-length]

    variable name 'ip' is too short, expected at least 3 characters

      228 |   uint8_t ip[4];
          |           ^
  • src/wifi/WiFiManager.cpp:228:13: warning: [cppcoreguidelines-avoid-c-arrays]

    do not declare C-style arrays, use 'std::array' instead

      228 |   uint8_t ip[4];
          |             ^
  • src/wifi/WiFiManager.cpp:233:6: warning: [bugprone-reserved-identifier]

    declaration uses identifier '_evWiFiGotIP6', which is reserved in the global namespace

      233 | void _evWiFiGotIP6(arduino_event_t* event)
          |      ^~~~~~~~~~~~~
          |      evWiFiGotIP6
  • src/wifi/WiFiManager.cpp:241:6: warning: [bugprone-reserved-identifier]

    declaration uses identifier '_evWiFiDisconnected', which is reserved in the global namespace

      241 | void _evWiFiDisconnected(arduino_event_t* event)
          |      ^~~~~~~~~~~~~~~~~~~
          |      evWiFiDisconnected
  • src/wifi/WiFiManager.cpp:248:44: warning: [cppcoreguidelines-pro-type-reinterpret-cast]

    do not use reinterpret_cast

      248 |   if (!Config::TryGetWiFiCredentialsBySSID(reinterpret_cast<char*>(info.ssid), creds)) {
          |                                            ^
  • src/wifi/WiFiManager.cpp:258:5: warning: [cppcoreguidelines-avoid-c-arrays]

    do not declare C-style arrays, use 'std::array' instead

      258 |     char reason[64];
          |     ^
  • src/wifi/WiFiManager.cpp:258:17: warning: [cppcoreguidelines-avoid-magic-numbers]

    64 is a magic number; consider replacing it with a named constant

      258 |     char reason[64];
          |                 ^
  • src/wifi/WiFiManager.cpp:263:6: warning: [bugprone-reserved-identifier]

    declaration uses identifier '_evWiFiScanStarted', which is reserved in the global namespace

      263 | void _evWiFiScanStarted()
          |      ^~~~~~~~~~~~~~~~~~
          |      evWiFiScanStarted
  • src/wifi/WiFiManager.cpp:266:6: warning: [bugprone-reserved-identifier]

    declaration uses identifier '_evWiFiScanStatusChanged', which is reserved in the global namespace

      266 | void _evWiFiScanStatusChanged(OpenShock::WiFiScanStatus status)
          |      ^~~~~~~~~~~~~~~~~~~~~~~~
          |      evWiFiScanStatusChanged
  • src/wifi/WiFiManager.cpp:290:6: warning: [bugprone-reserved-identifier]

    declaration uses identifier '_evWiFiNetworksDiscovery', which is reserved in the global namespace

      290 | void _evWiFiNetworksDiscovery(const std::vector<const wifi_ap_record_t*>& records)
          |      ^~~~~~~~~~~~~~~~~~~~~~~~
          |      evWiFiNetworksDiscovery
  • src/wifi/WiFiManager.cpp:331:11: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

      331 | esp_err_t set_esp_interface_dns(esp_interface_t interface, IPAddress main_dns, IPAddress backup_dns, IPAddress fallback_dns);
          |           ^
  • src/wifi/WiFiManager.cpp:333:6: warning: [bugprone-reserved-identifier]

    declaration uses identifier '_tryConnect', which is reserved in the global namespace

      333 | bool _tryConnect()
          |      ^~~~~~~~~~~
          |      tryConnect
  • src/wifi/WiFiManager.cpp:333:6: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

      333 | bool _tryConnect()
          | ~~~~ ^            
          | auto               -> bool
  • src/wifi/WiFiManager.cpp:360:6: warning: [bugprone-reserved-identifier]

    declaration uses identifier '_wifimanagerUpdateTask', which is reserved in the global namespace

      360 | void _wifimanagerUpdateTask(void*)
          |      ^~~~~~~~~~~~~~~~~~~~~~
          |      wifimanagerUpdateTask
  • src/wifi/WiFiManager.cpp:360:34: warning: [readability-named-parameter]

    all parameters should be named in a function

      360 | void _wifimanagerUpdateTask(void*)
          |                                  ^
          |                                   /*unused*/
  • src/wifi/WiFiManager.cpp:367:61: warning: [cppcoreguidelines-avoid-magic-numbers]

    120'000 is a magic number; consider replacing it with a named constant

      367 |         if (lastScanRequest == 0 || now - lastScanRequest > 120'000) {  // Auto-scan at boot and then every 2 mins
          |                                                             ^
  • src/wifi/WiFiManager.cpp:379:19: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

      379 | bool WiFiManager::Init()
          | ~~~~              ^     
          | auto                     -> bool
  • src/wifi/WiFiManager.cpp:402:3: warning: [readability-static-accessed-through-instance]

    static member accessed through instance

      402 |   WiFi.setHostname(hostname.c_str());
          |   ^~~~~
          |   WiFiClass::
  • src/wifi/WiFiManager.cpp:408:46: warning: [cppcoreguidelines-pro-type-reinterpret-cast]

    do not use reinterpret_cast

      408 |       if (Config::GetWiFiCredentialsIDbySSID(reinterpret_cast<const char*>(current_conf.sta.ssid)) != 0) {
          |                                              ^
  • src/wifi/WiFiManager.cpp:414:79: warning: [cppcoreguidelines-avoid-magic-numbers]

    8 is a magic number; consider replacing it with a named constant

      414 |   if (set_esp_interface_dns(ESP_IF_WIFI_STA, IPAddress(1, 1, 1, 1), IPAddress(8, 8, 8, 8), IPAddress(9, 9, 9, 9)) != ESP_OK) {
          |                                                                               ^
  • src/wifi/WiFiManager.cpp:414:82: warning: [cppcoreguidelines-avoid-magic-numbers]

    8 is a magic number; consider replacing it with a named constant

      414 |   if (set_esp_interface_dns(ESP_IF_WIFI_STA, IPAddress(1, 1, 1, 1), IPAddress(8, 8, 8, 8), IPAddress(9, 9, 9, 9)) != ESP_OK) {
          |                                                                                  ^
  • src/wifi/WiFiManager.cpp:414:85: warning: [cppcoreguidelines-avoid-magic-numbers]

    8 is a magic number; consider replacing it with a named constant

      414 |   if (set_esp_interface_dns(ESP_IF_WIFI_STA, IPAddress(1, 1, 1, 1), IPAddress(8, 8, 8, 8), IPAddress(9, 9, 9, 9)) != ESP_OK) {
          |                                                                                     ^
  • src/wifi/WiFiManager.cpp:414:88: warning: [cppcoreguidelines-avoid-magic-numbers]

    8 is a magic number; consider replacing it with a named constant

      414 |   if (set_esp_interface_dns(ESP_IF_WIFI_STA, IPAddress(1, 1, 1, 1), IPAddress(8, 8, 8, 8), IPAddress(9, 9, 9, 9)) != ESP_OK) {
          |                                                                                        ^
  • src/wifi/WiFiManager.cpp:414:102: warning: [cppcoreguidelines-avoid-magic-numbers]

    9 is a magic number; consider replacing it with a named constant

      414 |   if (set_esp_interface_dns(ESP_IF_WIFI_STA, IPAddress(1, 1, 1, 1), IPAddress(8, 8, 8, 8), IPAddress(9, 9, 9, 9)) != ESP_OK) {
          |                                                                                                      ^
  • src/wifi/WiFiManager.cpp:414:105: warning: [cppcoreguidelines-avoid-magic-numbers]

    9 is a magic number; consider replacing it with a named constant

      414 |   if (set_esp_interface_dns(ESP_IF_WIFI_STA, IPAddress(1, 1, 1, 1), IPAddress(8, 8, 8, 8), IPAddress(9, 9, 9, 9)) != ESP_OK) {
          |                                                                                                         ^
  • src/wifi/WiFiManager.cpp:414:108: warning: [cppcoreguidelines-avoid-magic-numbers]

    9 is a magic number; consider replacing it with a named constant

      414 |   if (set_esp_interface_dns(ESP_IF_WIFI_STA, IPAddress(1, 1, 1, 1), IPAddress(8, 8, 8, 8), IPAddress(9, 9, 9, 9)) != ESP_OK) {
          |                                                                                                            ^
  • src/wifi/WiFiManager.cpp:414:111: warning: [cppcoreguidelines-avoid-magic-numbers]

    9 is a magic number; consider replacing it with a named constant

      414 |   if (set_esp_interface_dns(ESP_IF_WIFI_STA, IPAddress(1, 1, 1, 1), IPAddress(8, 8, 8, 8), IPAddress(9, 9, 9, 9)) != ESP_OK) {
          |                                                                                                               ^
  • src/wifi/WiFiManager.cpp:419:67: warning: [cppcoreguidelines-avoid-magic-numbers]

    2048 is a magic number; consider replacing it with a named constant

      419 |   if (TaskUtils::TaskCreateUniversal(_wifimanagerUpdateTask, TAG, 2048, nullptr, 5, nullptr, 1) != pdPASS) {  // Profiled: 1.716KB stack usage
          |                                                                   ^
  • src/wifi/WiFiManager.cpp:419:82: warning: [cppcoreguidelines-avoid-magic-numbers]

    5 is a magic number; consider replacing it with a named constant

      419 |   if (TaskUtils::TaskCreateUniversal(_wifimanagerUpdateTask, TAG, 2048, nullptr, 5, nullptr, 1) != pdPASS) {  // Profiled: 1.716KB stack usage
          |                                                                                  ^
  • src/wifi/WiFiManager.cpp:427:19: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

      427 | bool WiFiManager::Save(const char* ssid, std::string_view password, bool connect)
          | ~~~~              ^                                                              
          | auto                                                                              -> bool
  • src/wifi/WiFiManager.cpp:431:8: warning: [readability-identifier-length]

    variable name 'it' is too short, expected at least 3 characters

      431 |   auto it = _findNetworkBySSID(ssid);
          |        ^
  • src/wifi/WiFiManager.cpp:434:13: warning: [readability-identifier-length]

    variable name 'id' is too short, expected at least 3 characters

      434 |     uint8_t id = Config::AddWiFiCredentials(it->ssid, password);
          |             ^
  • src/wifi/WiFiManager.cpp:452:11: warning: [readability-identifier-length]

    variable name 'id' is too short, expected at least 3 characters

      452 |   uint8_t id = Config::AddWiFiCredentials(ssid, password);
          |           ^
  • src/wifi/WiFiManager.cpp:465:19: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

      465 | bool WiFiManager::Forget(const char* ssid)
          | ~~~~              ^                       
          | auto                                       -> bool
  • src/wifi/WiFiManager.cpp:469:8: warning: [readability-identifier-length]

    variable name 'it' is too short, expected at least 3 characters

      469 |   auto it = _findNetworkBySSID(ssid);
          |        ^
  • src/wifi/WiFiManager.cpp:504:19: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

      504 | bool WiFiManager::RefreshNetworkCredentials()
          | ~~~~              ^                          
          | auto                                          -> bool
  • src/wifi/WiFiManager.cpp:522:19: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

      522 | bool WiFiManager::IsSaved(const char* ssid)
          | ~~~~              ^                        
          | auto                                        -> bool
  • src/wifi/WiFiManager.cpp:524:19: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this lambda

      524 |   return _isSaved([ssid](const Config::WiFiCredentials& creds) { return creds.ssid == ssid; });
          |                   ^
          |                                                                -> auto
  • src/wifi/WiFiManager.cpp:527:19: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

      527 | bool WiFiManager::Connect(const char* ssid)
          | ~~~~              ^                        
          | auto                                        -> bool
  • src/wifi/WiFiManager.cpp:549:19: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

      549 | bool WiFiManager::Connect(const uint8_t (&bssid)[6])
          | ~~~~              ^                                 
          | auto                                                 -> bool
  • src/wifi/WiFiManager.cpp:549:49: warning: [cppcoreguidelines-avoid-c-arrays]

    do not declare C-style arrays, use 'std::array' instead

      549 | bool WiFiManager::Connect(const uint8_t (&bssid)[6])
          |                                                 ^
  • src/wifi/WiFiManager.cpp:549:50: warning: [cppcoreguidelines-avoid-magic-numbers]

    6 is a magic number; consider replacing it with a named constant

      549 | bool WiFiManager::Connect(const uint8_t (&bssid)[6])
          |                                                  ^
  • src/wifi/WiFiManager.cpp:551:8: warning: [readability-identifier-length]

    variable name 'it' is too short, expected at least 3 characters

      551 |   auto it = _findNetworkByBSSID(bssid);
          |        ^
  • src/wifi/WiFiManager.cpp:582:19: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

      582 | bool WiFiManager::IsConnected()
          | ~~~~              ^            
          | auto                            -> bool
  • src/wifi/WiFiManager.cpp:586:19: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

      586 | bool WiFiManager::GetConnectedNetwork(OpenShock::WiFiNetwork& network)
          | ~~~~              ^                                                   
          | auto                                                                   -> bool
  • src/wifi/WiFiManager.cpp:601:8: warning: [readability-identifier-length]

    variable name 'it' is too short, expected at least 3 characters

      601 |   auto it = _findNetwork([](const WiFiNetwork& net) noexcept { return net.credentialsID == s_connectedCredentialsID; });
          |        ^
  • src/wifi/WiFiManager.cpp:601:26: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this lambda

      601 |   auto it = _findNetwork([](const WiFiNetwork& net) noexcept { return net.credentialsID == s_connectedCredentialsID; });
          |                          ^
          |                                                              -> auto
  • src/wifi/WiFiManager.cpp:611:19: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

      611 | bool WiFiManager::GetIPAddress(char* ipAddress)
          | ~~~~              ^                            
          | auto                                            -> bool
  • src/wifi/WiFiManager.cpp:611:38: warning: [readability-non-const-parameter]

    pointer parameter 'ipAddress' can be pointer to const

      611 | bool WiFiManager::GetIPAddress(char* ipAddress)
          |                                      ^
          |                                const 
  • src/wifi/WiFiManager.cpp:617:13: warning: [readability-identifier-length]

    variable name 'ip' is too short, expected at least 3 characters

      617 |   IPAddress ip = WiFi.localIP();
          |             ^
  • src/wifi/WiFiManager.cpp:623:19: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

      623 | bool WiFiManager::GetIPv6Address(char* ipAddress)
          | ~~~~              ^                              
          | auto                                              -> bool
  • src/wifi/WiFiManager.cpp:629:15: warning: [readability-identifier-length]

    variable name 'ip' is too short, expected at least 3 characters

      629 |   IPv6Address ip       = WiFi.localIPv6();
          |               ^
  • src/wifi/WiFiManager.cpp:636:39: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

      636 | std::vector<WiFiNetwork> WiFiManager::GetDiscoveredWiFiNetworks()
          |                                       ^

Have any feedback or feature suggestions? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant