Allow sensors to re-present themselves on request from controller. All

presentations actions moved to their own function in the examples.
This commit is contained in:
Henrik Ekblad
2015-09-27 18:04:05 +02:00
parent aa22a3eaec
commit 415aa29b34
49 changed files with 281 additions and 169 deletions
@@ -79,12 +79,6 @@ void setup()
// initialize our digital pins internal pullup resistor so one pulse switches from high to low (less distortion)
pinMode(DIGITAL_INPUT_SENSOR, INPUT_PULLUP);
// Send the sketch version information to the gateway and Controller
sendSketchInfo("Water Meter", "1.1");
// Register this device as Waterflow sensor
present(CHILD_ID, S_WATER);
pulseCount = oldPulseCount = 0;
// Fetch last known pulse count value from gw
@@ -95,6 +89,13 @@ void setup()
attachInterrupt(SENSOR_INTERRUPT, onPulse, FALLING);
}
void presentation() {
// Send the sketch version information to the gateway and Controller
sendSketchInfo("Water Meter", "1.1");
// Register this device as Waterflow sensor
present(CHILD_ID, S_WATER);
}
void loop()
{