Skip to content

Commit

Permalink
Merge pull request #88 from airgradienthq/develop
Browse files Browse the repository at this point in the history
Bugfix and add example
  • Loading branch information
pnt325 authored Mar 24, 2024
2 parents f46c66a + efe68a5 commit 3889aa6
Show file tree
Hide file tree
Showing 6 changed files with 3,053 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
- "TestCO2"
- "TestPM"
- "TestSht"
- "OneOpenAir"
fqbn:
- "esp8266:esp8266:d1_mini"
- "esp32:esp32:esp32c3"
Expand All @@ -28,6 +29,8 @@ jobs:
fqbn: "esp8266:esp8266:d1_mini"
- example: "Open_Air"
fqbn: "esp8266:esp8266:d1_mini"
- example: "OneOpenAir"
fqbn: "esp8266:esp8266:d1_mini"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
15 changes: 7 additions & 8 deletions examples/ONE/ONE.ino
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Important flashing settings:
- Flash frequency "80Mhz"
- Flash mode "QIO"
- 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"
Configuration parameters, e.g. Celsius / Fahrenheit or PM unit (US AQI vs ug/m3)
Expand Down Expand Up @@ -493,13 +493,8 @@ private:

void loadConfig(void) {
if (EEPROM.readBytes(0, &config, sizeof(config)) != sizeof(config)) {
config.inF = false;
config.inUSAQI = false;
config.useRGBLedBar = UseLedBarCO2; // default use LED bar for CO2
memset(config.models, 0, sizeof(config.models));
memset(config.mqttBrokers, 0, sizeof(config.mqttBrokers));

Serial.println("Load configure failed");
defaultConfig();
} else {
uint32_t sum = 0;
uint8_t *data = (uint8_t *)&config;
Expand Down Expand Up @@ -809,7 +804,7 @@ void setup() {
/**
* Send first data to ping server and get server configuration
*/
if (WiFi.status() == WL_CONNECTED) {
if (WiFi.isConnected()) {
webServerInit();

/** MQTT init */
Expand Down Expand Up @@ -1458,6 +1453,10 @@ static void displayShowDashboard(String err) {
/** Show CO2 value */
u8g2.setFont(u8g2_font_t0_22b_tf);
if (co2Ppm > 0) {
int val = 9999;
if (co2Ppm < 10000) {
val = co2Ppm;
}
sprintf(strBuf, "%d", co2Ppm);
} else {
sprintf(strBuf, "%s", "-");
Expand Down
Loading

0 comments on commit 3889aa6

Please # to comment.