switch from func to property to test online mode
This commit is contained in:
parent
cdcbb6535a
commit
0f226a60de
4 changed files with 6 additions and 56 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,38 +0,0 @@
|
|||
# 1 "/var/folders/ff/dmzflvf52tq9kzvt6g8jglxw0000gn/T/tmp6brcq55q"
|
||||
#include <Arduino.h>
|
||||
# 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();
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue