Moved configuration object to main file and load the config before start. Fixed issue where partiy is switched for Kamstrup half way when in debug mode

This commit is contained in:
Gunnar Skjold
2020-02-05 20:43:37 +01:00
parent 9bb596aab1
commit dbc551a41d
5 changed files with 77 additions and 66 deletions

View File

@@ -3,15 +3,16 @@
Stream* HanConfigAp::debugger;
bool HanConfigAp::hasConfig() {
return config.hasConfig();
return config->hasConfig();
}
void HanConfigAp::setup(int accessPointButtonPin, Stream* debugger)
void HanConfigAp::setup(int accessPointButtonPin, configuration* config, Stream* debugger)
{
this->debugger = debugger;
this->config = config;
// Test if we're missing configuration
if (!config.hasConfig())
if (!config->hasConfig())
{
print("No config. We're booting as AP. Look for SSID ");
println(this->AP_SSID);
@@ -20,8 +21,7 @@ void HanConfigAp::setup(int accessPointButtonPin, Stream* debugger)
else
{
// Load the configuration
config.load();
if (this->debugger) config.print(this->debugger);
if (this->debugger) config->print(this->debugger);
if (accessPointButtonPin != INVALID_BUTTON_PIN)
{