From e4ef06b38c863fe60094944c43e0d3b5afdc82cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Mon, 8 Jan 2018 12:20:59 +0100 Subject: [PATCH] Inline documentation on sensorInit --- code/espurna/sensor.ino | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/code/espurna/sensor.ino b/code/espurna/sensor.ino index f7791da1..9b6e9cd3 100644 --- a/code/espurna/sensor.ino +++ b/code/espurna/sensor.ino @@ -203,6 +203,19 @@ void _sensorPost() { void _sensorInit() { + /* + + This is temporal, in the future sensors will be initialized based on + soft configuration (data stored in EEPROM config) so you will be able + to define and configure new sensors on the fly + + At the time being, only enabled sensors (those with *_SUPPORT to 1) are being + loaded and initialized here. If you want to add new sensors of the same type + just duplicate the block and change the arguments for the set* methods. + Check the DHT block below for an example + + */ + #if ANALOG_SUPPORT { AnalogSensor * sensor = new AnalogSensor(); @@ -244,6 +257,19 @@ void _sensorInit() { } #endif + /* + // Example on how to add a second DHT sensor + // DHT2_PIN and DHT2_TYPE should be defined in sensors.h file + #if DHT_SUPPORT + { + DHTSensor * sensor = new DHTSensor(); + sensor->setGPIO(DHT2_PIN); + sensor->setType(DHT2_TYPE); + _sensors.push_back(sensor); + } + #endif + */ + #if DIGITAL_SUPPORT { DigitalSensor * sensor = new DigitalSensor();