Skip to content

Commit b3bdc52

Browse files
committed
Added optionl sensor description on presentation
1 parent 04530c6 commit b3bdc52

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

libraries/MySensors/MySensor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ void MySensor::sendBatteryLevel(uint8_t value, bool enableAck) {
235235
sendRoute(build(msg, nc.nodeId, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_BATTERY_LEVEL, enableAck).set(value));
236236
}
237237

238-
void MySensor::present(uint8_t childSensorId, uint8_t sensorType, bool enableAck) {
239-
sendRoute(build(msg, nc.nodeId, GATEWAY_ADDRESS, childSensorId, C_PRESENTATION, sensorType, enableAck).set(LIBRARY_VERSION));
238+
void MySensor::present(uint8_t childSensorId, uint8_t sensorType, bool enableAck, const char *description) {
239+
sendRoute(build(msg, nc.nodeId, GATEWAY_ADDRESS, childSensorId, C_PRESENTATION, sensorType, enableAck).set(childSensorId==NODE_SENSOR_ID?LIBRARY_VERSION:description));
240240
}
241241

242242
void MySensor::sendSketchInfo(const char *name, const char *version, bool enableAck) {

libraries/MySensors/MySensor.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,9 @@ class MySensor : public RF24
120120
* @param sensorId Select a unique sensor id for this sensor. Choose a number between 0-254.
121121
* @param sensorType The sensor type. See sensor typedef in MyMessage.h.
122122
* @param ack Set this to true if you want destination node to send ack back to this node. Default is not to request any ack.
123+
* @param description A textual description of the sensor.
123124
*/
124-
void present(uint8_t sensorId, uint8_t sensorType, bool ack=false);
125+
void present(uint8_t sensorId, uint8_t sensorType, bool ack=false, const char *description="");
125126

126127
/**
127128
* Sends sketch meta information to the gateway. Not mandatory but a nice thing to do.

0 commit comments

Comments
 (0)