mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-16 18:22:09 +02:00
fix: WiFi connect after LedBar test with button. And update comments
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
This is the code for the AirGradient ONE open-source hardware indoor Air Quality
|
This is the combined firmware code for AirGradient ONE and AirGradient Open Air
|
||||||
Monitor with an ESP32-C3 Microcontroller.
|
open-source hardware Air Quality Monitor with ESP32-C3 Microcontroller.
|
||||||
|
|
||||||
It is an air quality monitor for PM2.5, CO2, TVOCs, NOx, Temperature and
|
It is an air quality monitor for PM2.5, CO2, TVOCs, NOx, Temperature and
|
||||||
Humidity with a small display, an RGB led bar and can send data over Wifi.
|
Humidity with a small display, an RGB led bar and can send data over Wifi.
|
||||||
@ -9,7 +9,10 @@ Open source air quality monitors and kits are available:
|
|||||||
Indoor Monitor: https://www.airgradient.com/indoor/
|
Indoor Monitor: https://www.airgradient.com/indoor/
|
||||||
Outdoor Monitor: https://www.airgradient.com/outdoor/
|
Outdoor Monitor: https://www.airgradient.com/outdoor/
|
||||||
|
|
||||||
Build Instructions: https://www.airgradient.com/documentation/one-v9/
|
Build Instructions: AirGradient ONE:
|
||||||
|
https://www.airgradient.com/documentation/one-v9/ Build Instructions:
|
||||||
|
AirGradient Open Air:
|
||||||
|
https://www.airgradient.com/documentation/open-air-pst-kit-1-3/
|
||||||
|
|
||||||
The codes needs the following libraries installed:
|
The codes needs the following libraries installed:
|
||||||
“WifiManager by tzapu, tablatronix” tested with version 2.0.16-rc.2
|
“WifiManager by tzapu, tablatronix” tested with version 2.0.16-rc.2
|
||||||
@ -25,7 +28,7 @@ Important flashing settings:
|
|||||||
- Flash frequency "80Mhz"
|
- Flash frequency "80Mhz"
|
||||||
- Flash mode "QIO"
|
- Flash mode "QIO"
|
||||||
- Flash size "4MB"
|
- Flash size "4MB"
|
||||||
- Partition scheme "Default 4MB with spiffs (1.2MB APP/1,5MB SPIFFS)"
|
- Partition scheme "Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)"
|
||||||
- JTAG adapter "Disabled"
|
- JTAG adapter "Disabled"
|
||||||
|
|
||||||
Configuration parameters, e.g. Celsius / Fahrenheit or PM unit (US AQI vs ug/m3)
|
Configuration parameters, e.g. Celsius / Fahrenheit or PM unit (US AQI vs ug/m3)
|
||||||
@ -787,6 +790,8 @@ static int pm2hum;
|
|||||||
static int countPosition;
|
static int countPosition;
|
||||||
const int targetCount = 20;
|
const int targetCount = 20;
|
||||||
|
|
||||||
|
static bool ledBarButtonTest = false;
|
||||||
|
|
||||||
static void boardInit(void);
|
static void boardInit(void);
|
||||||
static void failedHandler(String msg);
|
static void failedHandler(String msg);
|
||||||
static void updateServerConfiguration(void);
|
static void updateServerConfiguration(void);
|
||||||
@ -851,7 +856,19 @@ void setup() {
|
|||||||
boardInit();
|
boardInit();
|
||||||
|
|
||||||
/** Connecting wifi */
|
/** Connecting wifi */
|
||||||
|
if (isOneIndoor()) {
|
||||||
|
if (ledBarButtonTest) {
|
||||||
|
ledTest();
|
||||||
|
} else {
|
||||||
|
/** Check LED mode to disabled LED */
|
||||||
|
if (agServer.getLedBarMode() == UseLedBarOff) {
|
||||||
|
ag->ledBar.setEnable(false);
|
||||||
|
}
|
||||||
connectToWifi();
|
connectToWifi();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
connectToWifi();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send first data to ping server and get server configuration
|
* Send first data to ping server and get server configuration
|
||||||
@ -1657,7 +1674,7 @@ static void displayShowDashboard(String err) {
|
|||||||
u8g2.setFont(u8g2_font_t0_22b_tf);
|
u8g2.setFont(u8g2_font_t0_22b_tf);
|
||||||
if (co2Ppm > 0) {
|
if (co2Ppm > 0) {
|
||||||
int val = 9999;
|
int val = 9999;
|
||||||
if(co2Ppm < 10000){
|
if (co2Ppm < 10000) {
|
||||||
val = co2Ppm;
|
val = co2Ppm;
|
||||||
}
|
}
|
||||||
sprintf(strBuf, "%d", val);
|
sprintf(strBuf, "%d", val);
|
||||||
@ -2026,11 +2043,11 @@ static void oneIndoorInit(void) {
|
|||||||
|
|
||||||
/** Run LED test on start up */
|
/** Run LED test on start up */
|
||||||
displayShowText("Press now for", "LED test &", "offline mode");
|
displayShowText("Press now for", "LED test &", "offline mode");
|
||||||
bool test = false;
|
ledBarButtonTest = false;
|
||||||
uint32_t stime = millis();
|
uint32_t stime = millis();
|
||||||
while (true) {
|
while (true) {
|
||||||
if (ag->button.getState() == ag->button.BUTTON_PRESSED) {
|
if (ag->button.getState() == ag->button.BUTTON_PRESSED) {
|
||||||
test = true;
|
ledBarButtonTest = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
delay(1);
|
delay(1);
|
||||||
@ -2039,14 +2056,6 @@ static void oneIndoorInit(void) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (test) {
|
|
||||||
ledTest();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Check LED mode to disabled LED */
|
|
||||||
if (agServer.getLedBarMode() == UseLedBarOff) {
|
|
||||||
ag->ledBar.setEnable(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
static void openAirInit(void) {
|
static void openAirInit(void) {
|
||||||
hasSensorSHT = false;
|
hasSensorSHT = false;
|
||||||
|
Reference in New Issue
Block a user