Skip to content

Commit c58dcf2

Browse files
committed
set to nullptr to allow reusability within _esp32.h network iface
1 parent 02d9ded commit c58dcf2

File tree

4 files changed

+7
-21
lines changed

4 files changed

+7
-21
lines changed

src/Wippersnapper.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ void Wippersnapper::provision() {
8383
_nvs = new Wippersnapper_ESP32_nvs();
8484
_nvs->parseSecrets();
8585
#endif
86-
// Set credentials
87-
set_user_key();
86+
87+
// Set WiFi credentials within network interface
8888
set_ssid_pass();
8989
}
9090

@@ -1194,8 +1194,6 @@ void Wippersnapper::errorWriteHang(String error) {
11941194
/**************************************************************************/
11951195
void Wippersnapper::runNetFSM() {
11961196
WS.feedWDT();
1197-
// MQTT connack RC
1198-
int mqttRC;
11991197
// Initial state
12001198
fsm_net_t fsmNetwork;
12011199
fsmNetwork = FSM_NET_CHECK_MQTT;
@@ -1250,7 +1248,7 @@ void Wippersnapper::runNetFSM() {
12501248
maxAttempts = 10;
12511249
while (maxAttempts >= 0) {
12521250
setStatusLEDColor(LED_IO_CONNECT);
1253-
mqttRC = WS._mqtt->connect();
1251+
int8_t mqttRC = WS._mqtt->connect(WS._username, WS._key);
12541252
if (mqttRC == WS_MQTT_CONNECTED) {
12551253
fsmNetwork = FSM_NET_CHECK_MQTT;
12561254
break;

src/network_interfaces/Wippersnapper_ESP32.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,8 @@ class Wippersnapper_ESP32 : public Wippersnapper {
100100
*/
101101
/********************************************************/
102102
void setupMQTTClient(const char *clientID) {
103-
WS_DEBUG_PRINT("BROKER URL: ");
104-
WS_DEBUG_PRINT(WS._mqttBrokerURL);
105-
106-
WS_DEBUG_PRINT("USERNAME: ");
107-
WS_DEBUG_PRINT(WS._username);
108-
WS_DEBUG_PRINT("KEY: ");
109-
WS_DEBUG_PRINT(WS._key);
110-
111103
if (WS._mqttBrokerURL == nullptr) {
104+
WS_DEBUG_PRINTLN("IO ADAFRUIT TEST L114");
112105
WS._mqttBrokerURL = "io.adafruit.com";
113106
_mqtt_client->setCACert(_aio_root_ca_prod);
114107
} else {

src/provisioning/Wippersnapper_ESP32_nvs.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,12 @@ void Wippersnapper_ESP32_nvs::parseSecrets() {
5959
;
6060
}
6161

62-
// optional NVS staging url
63-
_aioURL = nvs.getString("wsAIOURL", "");
64-
if (_aioURL.length() == 0)
65-
_aioURL = "io.adafruit.com";
66-
6762
// Set global configuration strings
6863
WS._network_ssid = _ssid.c_str();
6964
WS._network_pass = _ssidPass.c_str();
7065
WS._username = _aioUser.c_str();
7166
WS._key = _aioPass.c_str();
72-
WS._mqttBrokerURL = _aioURL.c_str();
67+
WS._mqttBrokerURL = nullptr;
7368
}
7469

7570
#endif // ARDUINO_ARCH_ESP32

src/provisioning/tinyusb/Wippersnapper_FS.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ void Wippersnapper_FS::parseSecrets() {
340340
"effect");
341341
fsHalt();
342342
}
343-
WS._username = _fileSystem->io_username;
343+
WS._username = io_username;
344344

345345
// Get io key
346346
io_key = doc["io_key"];
@@ -350,7 +350,7 @@ void Wippersnapper_FS::parseSecrets() {
350350
writeErrorToBootOut("ERROR: invalid io_key value in secrets.json!");
351351
fsHalt();
352352
}
353-
WS._key = _fileSystem->io_key;
353+
WS._key = io_key;
354354

355355
// next, we detect the network interface from the `secrets.json`
356356
WS_DEBUG_PRINTLN("Attempting to find network interface...");

0 commit comments

Comments
 (0)