Skip to content

Commit

Permalink
Merge pull request #583 from SignalK/custom_ap_name
Browse files Browse the repository at this point in the history
Allow setting of custom WiFiManager access point SSIDs
  • Loading branch information
mairas authored Apr 6, 2022
2 parents 222e2e0 + ede3ab4 commit 1085be5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
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

0 comments on commit 1085be5

Please sign in to comment.