Skip to content

Commit

Permalink
[MH-Z19] Add 'ABC disable' option to web config (letscontrolit#472)
Browse files Browse the repository at this point in the history
* [MH-Z19] Add 'ABC disable' option to web config

As discussed in letscontrolit#466.
The default setting is the current behavior.
When changing the setting, it will be applied as soon as there is a stable reading.

* [MH-Z19] Read settings first before determine must apply flag.
  • Loading branch information
TD-er committed Sep 15, 2017
1 parent 2f2df9a commit 65b8036
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/_P049_MHZ19.ino
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ boolean Plugin_049(byte function, struct EventStruct *event, String& string)

case PLUGIN_INIT:
{
Plugin_049_ABC_Disable = Settings.TaskDevicePluginConfig[event->TaskIndex][0] == ABC_disabled;
if (Plugin_049_ABC_Disable) {
// No guarantee the correct state is active on the sensor after reboot.
Plugin_049_ABC_MustApply = true;
}
Plugin_049_ABC_Disable = Settings.TaskDevicePluginConfig[event->TaskIndex][0] == ABC_disabled;
Plugin_049_SoftSerial = new SoftwareSerial(Settings.TaskDevicePin1[event->TaskIndex], Settings.TaskDevicePin2[event->TaskIndex]);
Plugin_049_SoftSerial->begin(9600);
addLog(LOG_LEVEL_INFO, F("MHZ19: Init OK "));
Expand Down

0 comments on commit 65b8036

Please sign in to comment.