Skip to content

Commit

Permalink
Merge branch 'v2.0' into mega
Browse files Browse the repository at this point in the history
  • Loading branch information
psy0rz committed Jan 25, 2018
2 parents 2586b94 + 3292051 commit 913cd67
Showing 1 changed file with 30 additions and 10 deletions.
40 changes: 30 additions & 10 deletions src/_P052_SenseAir.ino
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ boolean Plugin_052(byte function, struct EventStruct *event, String& string)
success = true;
}

/*
// ABC functionality disabled for now, due to a bug in the firmware.
// See https://github.com/letscontrolit/ESPEasy/issues/759
if (cmd.equalsIgnoreCase(F("senseair_setABCperiod")))
{
if (param1.toInt() >= 0) {
Expand All @@ -87,20 +90,25 @@ boolean Plugin_052(byte function, struct EventStruct *event, String& string)
}
success = true;
}
*/

break;
}

case PLUGIN_WEBFORM_LOAD:
{
byte choiceSensor = Settings.TaskDevicePluginConfig[event->TaskIndex][0];
byte choiceABCperiod = Settings.TaskDevicePluginConfig[event->TaskIndex][1];


String optionsSensor[7] = { F("Error Status"), F("Carbon Dioxide"), F("Temperature"), F("Humidity"), F("Relay Status"), F("Temperature Adjustment"), F("ABC period") };
addFormSelector(string, F("Sensor"), F("plugin_052_sensor"), 7, optionsSensor, NULL, choiceSensor);


/*
// ABC functionality disabled for now, due to a bug in the firmware.
// See https://github.com/letscontrolit/ESPEasy/issues/759
byte choiceABCperiod = Settings.TaskDevicePluginConfig[event->TaskIndex][1];
String optionsABCperiod[9] = { F("disable"), F("1 h"), F("12 h"), F("1 day"), F("2 days"), F("4 days"), F("7 days"), F("14 days"), F("30 days") };
addFormSelector(string, F("ABC period"), F("plugin_052_ABC_period"), 9, optionsABCperiod, NULL, choiceABCperiod);
*/

success = true;
break;
Expand All @@ -109,23 +117,31 @@ boolean Plugin_052(byte function, struct EventStruct *event, String& string)
case PLUGIN_WEBFORM_SAVE:
{
Settings.TaskDevicePluginConfig[event->TaskIndex][0] = getFormItemInt(F("plugin_052_sensor"));
Settings.TaskDevicePluginConfig[event->TaskIndex][1] = getFormItemInt(F("plugin_052_ABC_period"));

/*
// ABC functionality disabled for now, due to a bug in the firmware.
// See https://github.com/letscontrolit/ESPEasy/issues/759
Settings.TaskDevicePluginConfig[event->TaskIndex][1] = getFormItemInt(F("plugin_052_ABC_period"));
*/

success = true;
break;
}
}

case PLUGIN_INIT:
{
Plugin_052_init = true;
Plugin_052_SoftSerial = new ESPeasySoftwareSerial(Settings.TaskDevicePin1[event->TaskIndex],
Settings.TaskDevicePin2[event->TaskIndex]);

/*
// ABC functionality disabled for now, due to a bug in the firmware.
// See https://github.com/letscontrolit/ESPEasy/issues/759
const int periodInHours[9] = {0, 1, 12, (24*1), (24*2), (24*4), (24*7), (24*14), (24*30) };
byte choiceABCperiod = Settings.TaskDevicePluginConfig[event->TaskIndex][1];
Plugin_052_setABCperiod(periodInHours[choiceABCperiod]);

*/

success = true;
break;
}
Expand Down Expand Up @@ -345,20 +361,24 @@ int Plugin_052_readABCperiod(void)
{
int period = 0;
byte frame[8] = {0};

Plugin_052_buildFrame(0xFE, 0x03, 0x001F, 0x0001, frame);
period = Plugin_052_sendCommand(frame);

return period;
}

/*
// ABC functionality disabled for now, due to a bug in the firmware.
// See https://github.com/letscontrolit/ESPEasy/issues/759
void Plugin_052_setABCperiod(int period)
{
byte frame[8] = {0};
Plugin_052_buildFrame(0xFE, 0x06, 0x001F, period, frame);
Plugin_052_sendCommand(frame);
}
*/

// Compute the MODBUS RTU CRC
unsigned int Plugin_052_ModRTU_CRC(byte buf[], int len, byte checkSum[2])
Expand Down

0 comments on commit 913cd67

Please sign in to comment.