Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting of custom WiFiManager access point SSIDs #583

Merged
merged 3 commits into from
Apr 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ build_unflags = -Werror=reorder
board_build.partitions = min_spiffs.csv
monitor_filters = esp32_exception_decoder
extra_scripts = extra_script.py
check_skip_packages = true

[env:esp32dev]
extends = espressif32_base
Expand Down
8 changes: 6 additions & 2 deletions src/sensesp/net/networking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,12 @@ void Networking::setup_wifi_manager() {
wifi_manager->setTryConnectDuringConfigPortal(false);

// Create a unique SSID for configuring each SensESP Device
String config_ssid = SensESPBaseApp::get_hostname();
config_ssid = "Configure " + config_ssid;
String config_ssid;
if (wifi_manager_ap_ssid_ != "") {
config_ssid = wifi_manager_ap_ssid_;
} else {
config_ssid = "Configure " + hostname;
}
const char* pconfig_ssid = config_ssid.c_str();

this->emit(WiFiState::kWifiManagerActivated);
Expand Down
6 changes: 6 additions & 0 deletions src/sensesp/net/networking.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ class Networking : public Configurable,
}

void activate_wifi_manager();

void set_wifi_manager_ap_ssid(String ssid) {
wifi_manager_ap_ssid_ = ssid;
}

protected:
void setup_saved_ssid();
void setup_wifi_callbacks();
Expand All @@ -59,6 +64,7 @@ class Networking : public Configurable,

String ap_ssid = "";
String ap_password = "";
String wifi_manager_ap_ssid_ = "";

/// hardcoded values provided as constructor parameters
String preset_ssid = "";
Expand Down
1 change: 0 additions & 1 deletion src/sensesp/system/led_blinker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include "led_blinker.h"

#include "sensesp.h"
#include "sensesp/net/networking.h"
#include "sensesp_app.h"

namespace sensesp {
Expand Down
1 change: 0 additions & 1 deletion src/sensesp/system/led_blinker.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include <ReactESP.h>

#include "sensesp/net/networking.h"
#include "sensesp/net/ws_client.h"
#include "startable.h"

Expand Down