mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-29 16:37:17 +02:00
Add display ask for offline/online mode
This commit is contained in:
@ -89,7 +89,6 @@ static LocalServer localServer(Serial, openMetrics, measurements, configuration,
|
||||
static int pmFailCount = 0;
|
||||
static uint32_t factoryBtnPressTime = 0;
|
||||
static int getCO2FailCount = 0;
|
||||
static bool offlineMode = false;
|
||||
static AgFirmwareMode fwMode = FW_MODE_I_9PSL;
|
||||
|
||||
static bool ledBarButtonTest = false;
|
||||
@ -165,8 +164,30 @@ void setup() {
|
||||
stateMachine.executeLedBarPowerUpTest();
|
||||
} else {
|
||||
ledBarEnabledUpdate();
|
||||
connectToWifi = true;
|
||||
}
|
||||
|
||||
/** Show message confirm offline mode. */
|
||||
oledDisplay.setText(
|
||||
"Press now for",
|
||||
configuration.isOfflineMode() ? "online mode" : "offline mode", "");
|
||||
uint32_t stime = millis();
|
||||
while (true) {
|
||||
if (ag->button.getState() == ag->button.BUTTON_PRESSED) {
|
||||
configuration.setOfflineMode(!configuration.isOfflineMode());
|
||||
|
||||
oledDisplay.setText(
|
||||
"Offline Mode",
|
||||
configuration.isOfflineMode() ? " = True" : " = False", "");
|
||||
delay(1000);
|
||||
break;
|
||||
}
|
||||
uint32_t ms = (uint32_t)(millis() - stime);
|
||||
if (ms >= 3000) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
connectToWifi = !configuration.isOfflineMode();
|
||||
|
||||
} else {
|
||||
connectToWifi = true;
|
||||
}
|
||||
@ -200,8 +221,6 @@ void setup() {
|
||||
} else {
|
||||
ledBarEnabledUpdate();
|
||||
}
|
||||
} else {
|
||||
offlineMode = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -249,9 +268,9 @@ void loop() {
|
||||
}
|
||||
}
|
||||
|
||||
/** Auto reset external watchdog timer on offline mode and
|
||||
* postDataToAirGradient disabled. */
|
||||
if (offlineMode || (configuration.isPostDataToAirGradient() == false)) {
|
||||
/** Auto reset watchdog timer if offline mode or postDataToAirGradient */
|
||||
if (configuration.isOfflineMode() ||
|
||||
(configuration.isPostDataToAirGradient() == false)) {
|
||||
watchdogFeedSchedule.run();
|
||||
}
|
||||
|
||||
@ -528,7 +547,7 @@ static void oneIndoorInit(void) {
|
||||
}
|
||||
|
||||
/** Run LED test on start up */
|
||||
oledDisplay.setText("Press now for", "LED test &", "offline mode");
|
||||
oledDisplay.setText("Press now for", "LED test", "");
|
||||
ledBarButtonTest = false;
|
||||
uint32_t stime = millis();
|
||||
while (true) {
|
||||
|
Reference in New Issue
Block a user