Skip to content

Commit

Permalink
feat: Update setWifiConfig function in ProjectConfig class to toggle …
Browse files Browse the repository at this point in the history
…reboot status
  • Loading branch information
ZanzyTHEbar committed Apr 15, 2024
1 parent cadc222 commit da92fd2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion NetworkManager/include/data/config/project_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ class ProjectConfig : public Helpers::Logger,
bool setMDNSConfig(const std::string& mdns, bool shouldNotify);
void setWifiConfig(const std::string& networkName, const std::string& ssid,
const std::string& password, uint8_t channel,
uint8_t power, bool adhoc, bool shouldNotify);
uint8_t power, bool adhoc, bool shouldNotify,
bool shouldReboot = false);
void setAPWifiConfig(const std::string& ssid, const std::string& password,
uint8_t channel, bool adhoc, bool shouldNotify);
void setWiFiTxPower(uint8_t power, bool shouldNotify);
Expand Down
8 changes: 6 additions & 2 deletions NetworkManager/src/data/config/project_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ bool ProjectConfig::setMDNSConfig(const std::string& hostname,
void ProjectConfig::setWifiConfig(const std::string& networkName,
const std::string& ssid,
const std::string& password, uint8_t channel,
uint8_t power, bool adhoc,
bool shouldNotify) {
uint8_t power, bool adhoc, bool shouldNotify,
bool shouldReboot) {
// we store the ADHOC flag as false because the networks we store in the
// config are the ones we want the esp to connect to, rather than host as
// AP, and here we're just updating them
Expand Down Expand Up @@ -313,6 +313,10 @@ void ProjectConfig::setWifiConfig(const std::string& networkName,
this->wifiConfigSave();
this->notify(wifiHandler, Event_e::networksConfigUpdated);
}

if (shouldReboot) {
this->reboot = true;
}
}

void ProjectConfig::deleteWifiConfig(const std::string& networkName,
Expand Down

0 comments on commit da92fd2

Please sign in to comment.