diff --git a/main/newsettings.cpp b/main/newsettings.cpp index a8e9e76..daa0e5b 100644 --- a/main/newsettings.cpp +++ b/main/newsettings.cpp @@ -21,6 +21,11 @@ std::string defaultHostname() return "bobby"; } +std::string defaultUsername() +{ + return fmt::format("bobby_{}", BOBBY_DEFAULT_OTA_NAME); +} + ConfigManager configs; INSTANTIATE_CONFIGMANAGER_TEMPLATES(ConfigContainer) diff --git a/main/newsettings.h b/main/newsettings.h index f2ccdf9..fa7d957 100644 --- a/main/newsettings.h +++ b/main/newsettings.h @@ -31,6 +31,7 @@ using namespace espconfig; std::string defaultHostname(); +std::string defaultUsername(); constexpr const auto INPUT_MAPPING_NONE = std::numeric_limits::max(); @@ -224,7 +225,7 @@ class ConfigContainer public: // default allowReset constraints nvsName ConfigWrapperLegacy> baseMacAddressOverride{std::nullopt, DoReset, {}, "baseMacAddrOver" }; - ConfigWrapperLegacy hostname {defaultHostname, DoReset, StringMinMaxSize<4, 32>, "hostname" }; + ConfigWrapperLegacy hostname {defaultUsername, DoReset, StringMinMaxSize<4, 32>, "hostname" }; ConfigWrapperLegacy wifiStaEnabled {true, DoReset, {}, "wifiStaEnabled" }; std::array wifi_configs { WiFiConfig {"wifi_ssid0", "wifi_key0", "wifi_usestatic0", "wifi_static_ip0", "wifi_stati_sub0", "wifi_stat_gate0", "wifi_usestadns0", "wifi_stat_dnsA0", "wifi_stat_dnsB0", "wifi_stat_dnsC0", "bobbycar", "12345678"}, @@ -241,7 +242,7 @@ public: ConfigWrapperLegacy wifiStaMinRssi {-90, DoReset, {}, "wifiStaMinRssi" }; ConfigWrapperLegacy wifiApEnabled {true, DoReset, {}, "wifiApEnabled" }; - ConfigWrapperLegacy wifiApName {defaultHostname, DoReset, StringMinMaxSize<4, 32>, "wifiApName" }; + ConfigWrapperLegacy wifiApName {defaultUsername, DoReset, StringMinMaxSize<4, 32>, "wifiApName" }; ConfigWrapperLegacy wifiApKey {"Passwort_123", DoReset, StringOr>, "wifiApKey" }; ConfigWrapperLegacy wifiApIp{wifi_stack::ip_address_t{10, 0, 0, 1},DoReset, {}, "wifiApIp" }; ConfigWrapperLegacy wifiApMask{wifi_stack::ip_address_t{255, 255, 255, 0},DoReset, {}, "wifiApMask" }; @@ -305,7 +306,7 @@ public: WirelessDoorsConfig { "door_id4", "door_token4" } }; - ConfigWrapperLegacy bluetoothName {defaultHostname, DoReset, StringMinMaxSize<4, 32>, "bluetoothName" }; + ConfigWrapperLegacy bluetoothName {defaultUsername, DoReset, StringMinMaxSize<4, 32>, "bluetoothName" }; ConfigWrapperLegacy reverseBeep {false, DoReset, {}, "reverseBeep" }; ConfigWrapperLegacy reverseBeepFreq0 {3, DoReset, {}, "revBeepFreq0" }; @@ -317,7 +318,7 @@ public: ConfigWrapperLegacy udpCloudHost {std::string{}, DoReset, {}, "udpCloudHost" }; ConfigWrapperLegacy otaUrl {std::string{}, DoReset, StringOr, "otaUrl" }; - ConfigWrapperLegacy otaUsername {std::string{}, DoReset, {}, "otaUsername" }; + ConfigWrapperLegacy otaUsername {std::string{BOBBY_DEFAULT_OTA_NAME}, DoReset, {}, "otaUsername" }; ConfigWrapperLegacy otaServerUrl {std::string{}, DoReset, StringOr, "otaServerUrl" }; ConfigWrapperLegacy otaServerBranch {std::string{}, DoReset, {}, "otaServerBranch" }; std::array otaServers {