Bugifx: GW should not send presentation
This commit is contained in:
@@ -49,7 +49,9 @@ void MySensor::begin(void (*_msgCallback)(const MyMessage &), uint8_t _nodeId, b
|
|||||||
if (repeaterMode) {
|
if (repeaterMode) {
|
||||||
setupRepeaterMode();
|
setupRepeaterMode();
|
||||||
}
|
}
|
||||||
setupRadio();
|
|
||||||
|
// Setup radio
|
||||||
|
radio->init();
|
||||||
|
|
||||||
// Read settings from eeprom
|
// Read settings from eeprom
|
||||||
eeprom_read_block((void*)&nc, (void*)EEPROM_NODE_ID_ADDRESS, sizeof(NodeConfig));
|
eeprom_read_block((void*)&nc, (void*)EEPROM_NODE_ID_ADDRESS, sizeof(NodeConfig));
|
||||||
@@ -92,21 +94,10 @@ void MySensor::begin(void (*_msgCallback)(const MyMessage &), uint8_t _nodeId, b
|
|||||||
requestNodeId();
|
requestNodeId();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isGateway) {
|
setupNode();
|
||||||
debug(PSTR("%s started, id=%d, parent=%d, distance=%d\n"), repeaterMode?"repeater":"sensor", nc.nodeId, nc.parentNodeId, nc.distance);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we got an id, set this node to use it
|
debug(PSTR("%s started, id=%d, parent=%d, distance=%d\n"), isGateway?"gateway":(repeaterMode?"repeater":"sensor"), nc.nodeId, nc.parentNodeId, nc.distance);
|
||||||
if (nc.nodeId != AUTO) {
|
|
||||||
setupNode();
|
|
||||||
// Wait configuration reply.
|
|
||||||
wait(2000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MySensor::setupRadio() {
|
|
||||||
failedTransmissions = 0;
|
|
||||||
radio->init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MySensor::setupRepeaterMode(){
|
void MySensor::setupRepeaterMode(){
|
||||||
@@ -134,13 +125,20 @@ void MySensor::setupNode() {
|
|||||||
// Open reading pipe for messages directed to this node (set write pipe to same)
|
// Open reading pipe for messages directed to this node (set write pipe to same)
|
||||||
radio->setAddress(nc.nodeId);
|
radio->setAddress(nc.nodeId);
|
||||||
|
|
||||||
// Send presentation for this radio node (attach
|
// Present node and request config
|
||||||
present(NODE_SENSOR_ID, repeaterMode? S_ARDUINO_REPEATER_NODE : S_ARDUINO_NODE);
|
if (!isGateway && nc.nodeId != AUTO) {
|
||||||
|
// Send presentation for this radio node (attach
|
||||||
|
present(NODE_SENSOR_ID, repeaterMode? S_ARDUINO_REPEATER_NODE : S_ARDUINO_NODE);
|
||||||
|
|
||||||
|
// Send a configuration exchange request to controller
|
||||||
|
// Node sends parent node. Controller answers with latest node configuration
|
||||||
|
// which is picked up in process()
|
||||||
|
sendRoute(build(msg, nc.nodeId, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_CONFIG, false).set(nc.parentNodeId));
|
||||||
|
|
||||||
|
// Wait configuration reply.
|
||||||
|
wait(2000);
|
||||||
|
}
|
||||||
|
|
||||||
// Send a configuration exchange request to controller
|
|
||||||
// Node sends parent node. Controller answers with latest node configuration
|
|
||||||
// which is picked up in process()
|
|
||||||
sendRoute(build(msg, nc.nodeId, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_CONFIG, false).set(nc.parentNodeId));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MySensor::findParentNode() {
|
void MySensor::findParentNode() {
|
||||||
|
|||||||
@@ -244,7 +244,6 @@ class MySensor
|
|||||||
MyRFDriver *radio;
|
MyRFDriver *radio;
|
||||||
|
|
||||||
void setupRepeaterMode();
|
void setupRepeaterMode();
|
||||||
void setupRadio();
|
|
||||||
boolean sendWrite(uint8_t dest, MyMessage &message);
|
boolean sendWrite(uint8_t dest, MyMessage &message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user