diff --git a/src/Wippersnapper_V2.cpp b/src/Wippersnapper_V2.cpp index 5ba32f03..a907f97a 100644 --- a/src/Wippersnapper_V2.cpp +++ b/src/Wippersnapper_V2.cpp @@ -99,7 +99,7 @@ void Wippersnapper_V2::provisionV2() { // If an SD card is inserted and mounted, we do not need to provision // wifi/io credentials - if (WsV2._sdCardV2->IsSDCardInserted() == true) + if (WsV2._sdCardV2->mode_offline == true) return; // Initialize the filesystem @@ -1182,7 +1182,7 @@ void Wippersnapper_V2::connectV2() { // If we are running in offline mode, we skip the network setup // and MQTT connection process and jump to the offline device config process // NOTE: After this, bail out of this function and run the app loop!!! - if (WsV2._sdCardV2->IsSDCardInserted() == true) { + if (WsV2._sdCardV2->mode_offline == true) { WS_DEBUG_PRINTLN("[Offline] Running device configuration..."); // Enable logging // TODO: Change func. name to ConfigureLogging diff --git a/src/Wippersnapper_demo_wokwi.ino.cpp b/src/Wippersnapper_demo_wokwi.ino.cpp deleted file mode 100644 index 5ca9662f..00000000 --- a/src/Wippersnapper_demo_wokwi.ino.cpp +++ /dev/null @@ -1,38 +0,0 @@ -# 1 "/var/folders/ff/dmzflvf52tq9kzvt6g8jglxw0000gn/T/tmp6brcq55q" -#include -# 1 "/Users/brentrubell/Documents/Arduino/libraries/Adafruit_Wippersnapper_Arduino/src/Wippersnapper_demo_wokwi.ino" -# 14 "/Users/brentrubell/Documents/Arduino/libraries/Adafruit_Wippersnapper_Arduino/src/Wippersnapper_demo_wokwi.ino" -#define IO_USERNAME "brubell" -#define IO_KEY "YOUR_AIO_KEY" - -#define WIFI_SSID "Wokwi-GUEST" -#define WIFI_PASS "" - -#define WS_DEBUG - -#define API_PIN 0 - -#include "ws_manager.h" - - -Wippersnapper_Manager manager; -Wippersnapper_WiFiV2 wipper(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS, "io.adafruit.com", 8883); -void setup(); -void loop(); -#line 31 "/Users/brentrubell/Documents/Arduino/libraries/Adafruit_Wippersnapper_Arduino/src/Wippersnapper_demo_wokwi.ino" -void setup() { - - manager.checkAPIVersion(API_PIN); - manager.provision(); - - Serial.begin(115200); - - Serial.println("Adafruit Wippersnapper API Manager Demo"); - Serial.print("Running Wippersnapper API Version: "); - Serial.println(manager.getAPIVersion()); - manager.connect(); -} - -void loop() { - manager.run(); -} \ No newline at end of file diff --git a/src/provisioning/sdcard/ws_sdcard.cpp b/src/provisioning/sdcard/ws_sdcard.cpp index 887b59c4..cec03e07 100644 --- a/src/provisioning/sdcard/ws_sdcard.cpp +++ b/src/provisioning/sdcard/ws_sdcard.cpp @@ -20,15 +20,14 @@ */ /**************************************************************************/ ws_sdcard::ws_sdcard() { - _is_sd_card_inserted = false; - _rtc_enabled = false; + mode_offline = false; #ifndef SD_CS_PIN return; #endif // Attempt to initialize the SD card if (_sd.begin(SD_CS_PIN)) { - _is_sd_card_inserted = true; + mode_offline = true; } } @@ -72,14 +71,6 @@ void ws_sdcard::EnableLogging() { } } -/**************************************************************************/ -/*! - @brief Checks if an SD card is inserted and mounted. - @returns True if an SD card is inserted and mounted, False otherwise. -*/ -/**************************************************************************/ -bool ws_sdcard::IsSDCardInserted() { return _is_sd_card_inserted; } - bool ws_sdcard::parseConfigFile() { File32 file_config; // TODO: MAke this global? #ifndef OFFLINE_MODE_DEBUG diff --git a/src/provisioning/sdcard/ws_sdcard.h b/src/provisioning/sdcard/ws_sdcard.h index cdb68680..f3ad2e4c 100644 --- a/src/provisioning/sdcard/ws_sdcard.h +++ b/src/provisioning/sdcard/ws_sdcard.h @@ -33,16 +33,13 @@ public: ws_sdcard(); ~ws_sdcard(); void EnableLogging(); - bool IsSDCardInserted(); bool parseConfigFile(); bool waitForSerialConfig(); bool validateJson(const char *input); - + bool mode_offline; // Logging - + // TODO private: - bool _is_sd_card_inserted; ///< True if an SD card is inserted, False - ///< otherwise. SdFat _sd; ///< SD object from Adafruit SDFat library String _serialInput; ///< Serial input buffer const char *json_test_data; ///< Json test data