Skip to content

Commit a9ae906

Browse files
committed
Add global skip option for auto config [exportedFromDevice.autoConfig]
1 parent 393e70a commit a9ae906

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

src/Wippersnapper_V2.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ class Wippersnapper_V2 {
220220
void errorWriteHangV2(const char *error);
221221

222222
bool _is_offline_mode; ///< Global flag for if the device is in offline mode
223+
bool _global_auto_config = true; ///< Support no auto config for exportedDevice
223224

224225
// TODO: Do we need this?
225226
ws_board_status_t _boardStatusV2 =

src/Wippersnapper_demo.ino.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# 1 "C:\\Users\\tyeth\\AppData\\Local\\Temp\\tmp97kub74s"
2+
#include <Arduino.h>
3+
# 1 "C:/dev/arduino/Adafruit_Wippersnapper_Arduino/src/Wippersnapper_demo.ino"
4+
# 12 "C:/dev/arduino/Adafruit_Wippersnapper_Arduino/src/Wippersnapper_demo.ino"
5+
#include "ws_adapters.h"
6+
#if defined(OFFLINE_MODE_WOKWI)
7+
ws_adapter_wifi wipper;
8+
#elif defined(WS_WIFI_ADAPTER)
9+
ws_adapter_wifi wipper;
10+
#elif defined(WS_OFFLINE_ADAPTER)
11+
ws_adapter_offline wipper;
12+
#else
13+
#error "No valid ws_adapter_wifi or ws_adapter_offline defined! Please check your board configuration."
14+
#endif
15+
#define WS_DEBUG
16+
void setup();
17+
void loop();
18+
#line 24 "C:/dev/arduino/Adafruit_Wippersnapper_Arduino/src/Wippersnapper_demo.ino"
19+
void setup() {
20+
Serial.begin(115200);
21+
while(!Serial);
22+
wipper.provision();
23+
wipper.connect();
24+
}
25+
26+
void loop() {
27+
wipper.run();
28+
}

src/provisioning/sdcard/ws_sdcard.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,10 @@ bool ws_sdcard::ParseExportedFromDevice(JsonDocument &doc) {
829829
return false;
830830
}
831831

832+
if (exportedFromDevice["autoConfig"].as<bool>() == false) {
833+
WsV2._global_auto_config = false;
834+
}
835+
832836
return true;
833837
}
834838

@@ -889,6 +893,12 @@ bool ws_sdcard::ParseFileConfig() {
889893
return false;
890894
}
891895

896+
// If global skip (exportedFromDevice.autoConfig == false) then just continue
897+
if (!WsV2._global_auto_config) {
898+
WS_DEBUG_PRINTLN("[SD] Auto config is disabled, skipping I2C scan.");
899+
return true;
900+
}
901+
892902
// Add the results of I2C scan to the shared buffer
893903
if (!AddI2cScanResultsToBuffer()) {
894904
WS_DEBUG_PRINTLN("[SD] Error: Unable to add I2C scan results to "

0 commit comments

Comments
 (0)