mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-02 19:10:58 +02:00
Merge branch 'develop' into hotfix/correct-ota-update-message-on-display
This commit is contained in:
@ -152,8 +152,6 @@ void setup() {
|
||||
}
|
||||
Serial.println("Detected " + ag->getBoardName());
|
||||
|
||||
/** Init sensor */
|
||||
boardInit();
|
||||
configuration.setAirGradient(ag);
|
||||
oledDisplay.setAirGradient(ag);
|
||||
stateMachine.setAirGradient(ag);
|
||||
@ -162,11 +160,13 @@ void setup() {
|
||||
openMetrics.setAirGradient(ag);
|
||||
localServer.setAirGraident(ag);
|
||||
|
||||
/** Init sensor */
|
||||
boardInit();
|
||||
|
||||
/** Connecting wifi */
|
||||
bool connectToWifi = false;
|
||||
if (ag->isOne()) {
|
||||
if (ledBarButtonTest) {
|
||||
stateMachine.executeLedBarPowerUpTest();
|
||||
if (ag->button.getState() == PushButton::BUTTON_PRESSED) {
|
||||
WiFi.begin("airgradient", "cleanair");
|
||||
Serial.println("WiFi Credential reset to factory defaults");
|
||||
@ -241,6 +241,9 @@ void setup() {
|
||||
} else {
|
||||
ledBarEnabledUpdate();
|
||||
}
|
||||
} else {
|
||||
oledDisplay.showRebooting();
|
||||
delay(2500);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -465,9 +468,10 @@ static void ledBarEnabledUpdate(void) {
|
||||
if ((brightness == 0) || (configuration.getLedBarMode() == LedBarModeOff)) {
|
||||
ag->ledBar.setEnable(false);
|
||||
} else {
|
||||
ag->ledBar.setBrighness(brightness);
|
||||
ag->ledBar.setBrightness(brightness);
|
||||
ag->ledBar.setEnable(configuration.getLedBarMode() != LedBarModeOff);
|
||||
}
|
||||
ag->ledBar.show();
|
||||
}
|
||||
}
|
||||
|
||||
@ -643,6 +647,23 @@ static void oneIndoorInit(void) {
|
||||
ag->button.begin();
|
||||
ag->watchdog.begin();
|
||||
|
||||
/** Run LED test on start up if button pressed */
|
||||
oledDisplay.setText("Press now for", "LED test", "");
|
||||
ledBarButtonTest = false;
|
||||
uint32_t stime = millis();
|
||||
while (true) {
|
||||
if (ag->button.getState() == ag->button.BUTTON_PRESSED) {
|
||||
ledBarButtonTest = true;
|
||||
stateMachine.executeLedBarPowerUpTest();
|
||||
break;
|
||||
}
|
||||
delay(1);
|
||||
uint32_t ms = (uint32_t)(millis() - stime);
|
||||
if (ms >= 3000) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/** Init sensor SGP41 */
|
||||
if (sgp41Init() == false) {
|
||||
dispSensorNotFound("SGP41");
|
||||
@ -669,22 +690,6 @@ static void oneIndoorInit(void) {
|
||||
|
||||
dispSensorNotFound("PMS");
|
||||
}
|
||||
|
||||
/** Run LED test on start up */
|
||||
oledDisplay.setText("Press now for", "LED test", "");
|
||||
ledBarButtonTest = false;
|
||||
uint32_t stime = millis();
|
||||
while (true) {
|
||||
if (ag->button.getState() == ag->button.BUTTON_PRESSED) {
|
||||
ledBarButtonTest = true;
|
||||
break;
|
||||
}
|
||||
delay(1);
|
||||
uint32_t ms = (uint32_t)(millis() - stime);
|
||||
if (ms >= 3000) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
static void openAirInit(void) {
|
||||
configuration.hasSensorSHT = false;
|
||||
@ -832,10 +837,6 @@ static void configUpdateHandle() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ag->isOne()) {
|
||||
ledBarEnabledUpdate();
|
||||
stateMachine.executeLedBarTest();
|
||||
}
|
||||
stateMachine.executeCo2Calibration();
|
||||
|
||||
String mqttUri = configuration.getMqttBrokerUri();
|
||||
@ -871,15 +872,36 @@ static void configUpdateHandle() {
|
||||
|
||||
if (ag->isOne()) {
|
||||
if (configuration.isLedBarBrightnessChanged()) {
|
||||
ag->ledBar.setBrighness(configuration.getLedBarBrightness());
|
||||
Serial.println("Set 'LedBarBrightness' brightness: " +
|
||||
String(configuration.getLedBarBrightness()));
|
||||
if (configuration.getLedBarBrightness() == 0) {
|
||||
ag->ledBar.setEnable(false);
|
||||
} else {
|
||||
if (configuration.getLedBarMode() != LedBarMode::LedBarModeOff) {
|
||||
ag->ledBar.setEnable(true);
|
||||
}
|
||||
ag->ledBar.setBrightness(configuration.getLedBarBrightness());
|
||||
}
|
||||
ag->ledBar.show();
|
||||
}
|
||||
|
||||
if (configuration.isLedBarModeChanged()) {
|
||||
if (configuration.getLedBarBrightness() == 0) {
|
||||
ag->ledBar.setEnable(false);
|
||||
} else {
|
||||
if(configuration.getLedBarMode() == LedBarMode::LedBarModeOff) {
|
||||
ag->ledBar.setEnable(false);
|
||||
} else {
|
||||
ag->ledBar.setEnable(true);
|
||||
ag->ledBar.setBrightness(configuration.getLedBarBrightness());
|
||||
}
|
||||
}
|
||||
ag->ledBar.show();
|
||||
}
|
||||
|
||||
if (configuration.isDisplayBrightnessChanged()) {
|
||||
oledDisplay.setBrightness(configuration.getDisplayBrightness());
|
||||
Serial.println("Set 'DisplayBrightness' brightness: " +
|
||||
String(configuration.getDisplayBrightness()));
|
||||
}
|
||||
|
||||
stateMachine.executeLedBarTest();
|
||||
}
|
||||
|
||||
fwNewVersion = configuration.newFirmwareVersion();
|
||||
|
Reference in New Issue
Block a user