Fix compilation issues, change ProjectConfig into a shared_ptr with updated definitions

// todo implement the API and missing features
This commit is contained in:
Lorow
2024-11-23 21:00:05 +01:00
parent 60e2e7cc36
commit 6b603f5574
13 changed files with 61 additions and 50 deletions

View File

@@ -36,7 +36,7 @@ void WiFiManagerHelpers::event_handler(void *arg, esp_event_base_t event_base,
}
}
WiFiManager::WiFiManager(ProjectConfig &deviceConfig) : deviceConfig(deviceConfig) {}
WiFiManager::WiFiManager(std::shared_ptr<ProjectConfig> deviceConfig) : deviceConfig(deviceConfig) {}
void WiFiManager::SetCredentials(const char *ssid, const char *password)
{
@@ -84,7 +84,7 @@ void WiFiManager::ConnectWithHardcodedCredentials()
void WiFiManager::ConnectWithStoredCredentials()
{
auto networks = this->deviceConfig.getWifiConfigs();
auto networks = this->deviceConfig->getWifiConfigs();
for (auto network : networks)
{
xEventGroupClearBits(s_wifi_event_group, WIFI_FAIL_BIT);

View File

@@ -30,7 +30,7 @@ class WiFiManager
{
private:
uint8_t channel;
ProjectConfig &deviceConfig;
std::shared_ptr<ProjectConfig> deviceConfig;
wifi_init_config_t _wifi_init_cfg = WIFI_INIT_CONFIG_DEFAULT();
wifi_config_t _wifi_cfg = {};
@@ -45,7 +45,7 @@ private:
void SetupAccessPoint();
public:
WiFiManager(ProjectConfig &deviceConfig);
WiFiManager(std::shared_ptr<ProjectConfig> deviceConfig);
void Begin();
};