mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-28 16:07:16 +02:00
Add new flag for command request
Such as led bar test and co2 calibration test
This commit is contained in:
@ -370,6 +370,12 @@ void loop() {
|
|||||||
|
|
||||||
/** factory reset handle */
|
/** factory reset handle */
|
||||||
factoryConfigReset();
|
factoryConfigReset();
|
||||||
|
|
||||||
|
if (configuration.isCommandRequested()) {
|
||||||
|
// Each state machine already has an independent request command check
|
||||||
|
stateMachine.executeCo2Calibration();
|
||||||
|
stateMachine.executeLedBarTest();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void co2Update(void) {
|
static void co2Update(void) {
|
||||||
@ -1082,10 +1088,6 @@ static void configUpdateHandle() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (configuration.isCo2CalibrationRequested()) {
|
|
||||||
stateMachine.executeCo2Calibration();
|
|
||||||
}
|
|
||||||
|
|
||||||
String mqttUri = configuration.getMqttBrokerUri();
|
String mqttUri = configuration.getMqttBrokerUri();
|
||||||
if (mqttClient.isCurrentUri(mqttUri) == false) {
|
if (mqttClient.isCurrentUri(mqttUri) == false) {
|
||||||
mqttClient.end();
|
mqttClient.end();
|
||||||
@ -1157,11 +1159,6 @@ static void configUpdateHandle() {
|
|||||||
if (configuration.isDisplayBrightnessChanged()) {
|
if (configuration.isDisplayBrightnessChanged()) {
|
||||||
oledDisplay.setBrightness(configuration.getDisplayBrightness());
|
oledDisplay.setBrightness(configuration.getDisplayBrightness());
|
||||||
}
|
}
|
||||||
|
|
||||||
stateMachine.executeLedBarTest();
|
|
||||||
}
|
|
||||||
else if(ag->isOpenAir()) {
|
|
||||||
stateMachine.executeLedBarTest();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update display and led bar notification based on updated configuration
|
// Update display and led bar notification based on updated configuration
|
||||||
|
@ -955,16 +955,18 @@ bool Configuration::parse(String data, bool isLocal) {
|
|||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ledBarTestRequested || co2CalibrationRequested) {
|
||||||
|
commandRequested = true;
|
||||||
|
updated = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (changed) {
|
if (changed) {
|
||||||
updated = true;
|
updated = true;
|
||||||
saveConfig();
|
saveConfig();
|
||||||
printConfig();
|
printConfig();
|
||||||
_callback();
|
_callback();
|
||||||
} else {
|
|
||||||
if (ledBarTestRequested || co2CalibrationRequested) {
|
|
||||||
updated = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1164,6 +1166,12 @@ bool Configuration::isUpdated(void) {
|
|||||||
return updated;
|
return updated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Configuration::isCommandRequested(void) {
|
||||||
|
bool oldState = this->commandRequested;
|
||||||
|
this->commandRequested = false;
|
||||||
|
return oldState;
|
||||||
|
}
|
||||||
|
|
||||||
String Configuration::jsonTypeInvalidMessage(String name, String type) {
|
String Configuration::jsonTypeInvalidMessage(String name, String type) {
|
||||||
return "'" + name + "' type is invalid, expecting '" + type + "'";
|
return "'" + name + "' type is invalid, expecting '" + type + "'";
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ private:
|
|||||||
bool co2CalibrationRequested;
|
bool co2CalibrationRequested;
|
||||||
bool ledBarTestRequested;
|
bool ledBarTestRequested;
|
||||||
bool updated;
|
bool updated;
|
||||||
|
bool commandRequested = false;
|
||||||
String failedMessage;
|
String failedMessage;
|
||||||
bool _noxLearnOffsetChanged;
|
bool _noxLearnOffsetChanged;
|
||||||
bool _tvocLearningOffsetChanged;
|
bool _tvocLearningOffsetChanged;
|
||||||
@ -93,6 +94,7 @@ public:
|
|||||||
void reset(void);
|
void reset(void);
|
||||||
String getModel(void);
|
String getModel(void);
|
||||||
bool isUpdated(void);
|
bool isUpdated(void);
|
||||||
|
bool isCommandRequested(void);
|
||||||
String getFailedMesage(void);
|
String getFailedMesage(void);
|
||||||
void setPostToAirGradient(bool enable);
|
void setPostToAirGradient(bool enable);
|
||||||
bool noxLearnOffsetChanged(void);
|
bool noxLearnOffsetChanged(void);
|
||||||
|
Reference in New Issue
Block a user