Merge pull request #593 from tekka007/updateBuildMsg
build(): Remove obsolete parameter (sender)
This commit is contained in:
@@ -54,7 +54,7 @@ void firmwareOTAUpdateRequest() {
|
|||||||
firmwareRequest.version = _fc.version;
|
firmwareRequest.version = _fc.version;
|
||||||
firmwareRequest.block = (_fwBlock - 1);
|
firmwareRequest.block = (_fwBlock - 1);
|
||||||
OTA_DEBUG(PSTR("OTA:FRQ:FW REQ,T=%04X,V=%04X,B=%04X\n"),_fc.type,_fc.version,_fwBlock - 1); // request FW update block
|
OTA_DEBUG(PSTR("OTA:FRQ:FW REQ,T=%04X,V=%04X,B=%04X\n"),_fc.type,_fc.version,_fwBlock - 1); // request FW update block
|
||||||
_sendRoute(build(_msgTmp, _nc.nodeId, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_STREAM, ST_FIRMWARE_REQUEST, false).set(&firmwareRequest,sizeof(RequestFWBlock)));
|
_sendRoute(build(_msgTmp, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_STREAM, ST_FIRMWARE_REQUEST, false).set(&firmwareRequest,sizeof(RequestFWBlock)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ void presentBootloaderInformation(){
|
|||||||
// add bootloader information
|
// add bootloader information
|
||||||
reqFWConfig->BLVersion = MY_OTA_BOOTLOADER_VERSION;
|
reqFWConfig->BLVersion = MY_OTA_BOOTLOADER_VERSION;
|
||||||
_fwUpdateOngoing = false;
|
_fwUpdateOngoing = false;
|
||||||
_sendRoute(build(_msgTmp, _nc.nodeId, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_STREAM, ST_FIRMWARE_CONFIG_REQUEST, false));
|
_sendRoute(build(_msgTmp, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_STREAM, ST_FIRMWARE_CONFIG_REQUEST, false));
|
||||||
}
|
}
|
||||||
// do a crc16 on the whole received firmware
|
// do a crc16 on the whole received firmware
|
||||||
bool transportIsValidFirmware() {
|
bool transportIsValidFirmware() {
|
||||||
|
|||||||
+17
-17
@@ -180,7 +180,7 @@ void _registerNode() {
|
|||||||
uint8_t counter = MY_REGISTRATION_RETRIES;
|
uint8_t counter = MY_REGISTRATION_RETRIES;
|
||||||
// only proceed if register response received or retries exceeded
|
// only proceed if register response received or retries exceeded
|
||||||
do {
|
do {
|
||||||
_sendRoute(build(_msgTmp, _nc.nodeId, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_REGISTRATION_REQUEST, false).set(MY_CORE_VERSION));
|
_sendRoute(build(_msgTmp, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_REGISTRATION_REQUEST, false).set(MY_CORE_VERSION));
|
||||||
} while (!wait(2000, C_INTERNAL, I_REGISTRATION_RESPONSE) && counter--);
|
} while (!wait(2000, C_INTERNAL, I_REGISTRATION_RESPONSE) && counter--);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@@ -217,7 +217,7 @@ void presentNode() {
|
|||||||
|
|
||||||
// Send a configuration exchange request to controller
|
// Send a configuration exchange request to controller
|
||||||
// Node sends parent node. Controller answers with latest node configuration
|
// Node sends parent node. Controller answers with latest node configuration
|
||||||
_sendRoute(build(_msgTmp, _nc.nodeId, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_CONFIG, false).set(_nc.parentNodeId));
|
_sendRoute(build(_msgTmp, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_CONFIG, false).set(_nc.parentNodeId));
|
||||||
|
|
||||||
// Wait configuration reply.
|
// Wait configuration reply.
|
||||||
wait(2000, C_INTERNAL, I_CONFIG);
|
wait(2000, C_INTERNAL, I_CONFIG);
|
||||||
@@ -280,31 +280,31 @@ bool send(MyMessage &message, bool enableAck) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void sendBatteryLevel(uint8_t value, bool enableAck) {
|
void sendBatteryLevel(uint8_t value, bool enableAck) {
|
||||||
_sendRoute(build(_msgTmp, _nc.nodeId, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_BATTERY_LEVEL, enableAck).set(value));
|
_sendRoute(build(_msgTmp, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_BATTERY_LEVEL, enableAck).set(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendHeartbeat(void) {
|
void sendHeartbeat(void) {
|
||||||
#if defined(MY_RADIO_FEATURE)
|
#if defined(MY_RADIO_FEATURE)
|
||||||
uint32_t heartbeat = transportGetHeartbeat();
|
uint32_t heartbeat = transportGetHeartbeat();
|
||||||
_sendRoute(build(_msgTmp, _nc.nodeId, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_HEARTBEAT_RESPONSE, false).set(heartbeat));
|
_sendRoute(build(_msgTmp, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_HEARTBEAT_RESPONSE, false).set(heartbeat));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void present(uint8_t childSensorId, uint8_t sensorType, const char *description, bool enableAck) {
|
void present(uint8_t childSensorId, uint8_t sensorType, const char *description, bool enableAck) {
|
||||||
_sendRoute(build(_msgTmp, _nc.nodeId, GATEWAY_ADDRESS, childSensorId, C_PRESENTATION, sensorType, enableAck).set(childSensorId==NODE_SENSOR_ID?MYSENSORS_LIBRARY_VERSION:description));
|
_sendRoute(build(_msgTmp, GATEWAY_ADDRESS, childSensorId, C_PRESENTATION, sensorType, enableAck).set(childSensorId==NODE_SENSOR_ID?MYSENSORS_LIBRARY_VERSION:description));
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendSketchInfo(const char *name, const char *version, bool enableAck) {
|
void sendSketchInfo(const char *name, const char *version, bool enableAck) {
|
||||||
if (name) _sendRoute(build(_msgTmp, _nc.nodeId, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_SKETCH_NAME, enableAck).set(name));
|
if (name) _sendRoute(build(_msgTmp, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_SKETCH_NAME, enableAck).set(name));
|
||||||
if (version) _sendRoute(build(_msgTmp, _nc.nodeId, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_SKETCH_VERSION, enableAck).set(version));
|
if (version) _sendRoute(build(_msgTmp, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_SKETCH_VERSION, enableAck).set(version));
|
||||||
}
|
}
|
||||||
|
|
||||||
void request(uint8_t childSensorId, uint8_t variableType, uint8_t destination) {
|
void request(uint8_t childSensorId, uint8_t variableType, uint8_t destination) {
|
||||||
_sendRoute(build(_msgTmp, _nc.nodeId, destination, childSensorId, C_REQ, variableType, false).set(""));
|
_sendRoute(build(_msgTmp, destination, childSensorId, C_REQ, variableType, false).set(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
void requestTime() {
|
void requestTime() {
|
||||||
_sendRoute(build(_msgTmp, _nc.nodeId, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_TIME, false).set(""));
|
_sendRoute(build(_msgTmp, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_TIME, false).set(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Message delivered through _msg
|
// Message delivered through _msg
|
||||||
@@ -349,7 +349,7 @@ bool _processInternalMessages() {
|
|||||||
// Clears child relay data for this node
|
// Clears child relay data for this node
|
||||||
setIndication(INDICATION_CLEAR_ROUTING);
|
setIndication(INDICATION_CLEAR_ROUTING);
|
||||||
transportClearRoutingTable();
|
transportClearRoutingTable();
|
||||||
_sendRoute(build(_msgTmp, _nc.nodeId, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_CHILDREN, false).set("ok"));
|
_sendRoute(build(_msgTmp, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_CHILDREN, false).set("ok"));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -363,23 +363,23 @@ bool _processInternalMessages() {
|
|||||||
if (route != BROADCAST_ADDRESS) {
|
if (route != BROADCAST_ADDRESS) {
|
||||||
debug(PSTR("MCO:PIM:ROUTE N=%d,R=%d\n"), cnt, route);
|
debug(PSTR("MCO:PIM:ROUTE N=%d,R=%d\n"), cnt, route);
|
||||||
uint8_t outBuf[2] = { (uint8_t)cnt,route };
|
uint8_t outBuf[2] = { (uint8_t)cnt,route };
|
||||||
_sendRoute(build(_msgTmp, _nc.nodeId, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_DEBUG, false).set(outBuf, 2));
|
_sendRoute(build(_msgTmp, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_DEBUG, false).set(outBuf, 2));
|
||||||
wait(200);
|
wait(200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (debug_msg == 'V') { // CPU voltage
|
else if (debug_msg == 'V') { // CPU voltage
|
||||||
_sendRoute(build(_msgTmp, _nc.nodeId, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_DEBUG, false).set(hwCPUVoltage()));
|
_sendRoute(build(_msgTmp, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_DEBUG, false).set(hwCPUVoltage()));
|
||||||
}
|
}
|
||||||
else if (debug_msg == 'F') { // CPU frequency in 1/10Mhz
|
else if (debug_msg == 'F') { // CPU frequency in 1/10Mhz
|
||||||
_sendRoute(build(_msgTmp, _nc.nodeId, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_DEBUG, false).set(hwCPUFrequency()));
|
_sendRoute(build(_msgTmp, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_DEBUG, false).set(hwCPUFrequency()));
|
||||||
}
|
}
|
||||||
else if (debug_msg == 'M') { // free memory
|
else if (debug_msg == 'M') { // free memory
|
||||||
_sendRoute(build(_msgTmp, _nc.nodeId, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_DEBUG, false).set(hwFreeMem()));
|
_sendRoute(build(_msgTmp, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_DEBUG, false).set(hwFreeMem()));
|
||||||
}
|
}
|
||||||
else if (debug_msg == 'E') { // clear MySensors eeprom area and reboot
|
else if (debug_msg == 'E') { // clear MySensors eeprom area and reboot
|
||||||
_sendRoute(build(_msgTmp, _nc.nodeId, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_DEBUG, false).set("ok"));
|
_sendRoute(build(_msgTmp, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_DEBUG, false).set("ok"));
|
||||||
for (int i = EEPROM_START; i<EEPROM_LOCAL_CONFIG_ADDRESS; i++) hwWriteConfig(i, 0xFF);
|
for (int i = EEPROM_START; i<EEPROM_LOCAL_CONFIG_ADDRESS; i++) hwWriteConfig(i, 0xFF);
|
||||||
setIndication(INDICATION_REBOOT);
|
setIndication(INDICATION_REBOOT);
|
||||||
hwReboot();
|
hwReboot();
|
||||||
@@ -405,7 +405,7 @@ bool _processInternalMessages() {
|
|||||||
// delay for fast GW and slow nodes
|
// delay for fast GW and slow nodes
|
||||||
delay(5);
|
delay(5);
|
||||||
#endif
|
#endif
|
||||||
_sendRoute(build(_msgTmp, _nc.nodeId, _msg.sender, NODE_SENSOR_ID, C_INTERNAL, I_REGISTRATION_RESPONSE, false).set(approveRegistration));
|
_sendRoute(build(_msgTmp, _msg.sender, NODE_SENSOR_ID, C_INTERNAL, I_REGISTRATION_RESPONSE, false).set(approveRegistration));
|
||||||
#else
|
#else
|
||||||
return false; // processing of this request via controller
|
return false; // processing of this request via controller
|
||||||
#endif
|
#endif
|
||||||
@@ -572,7 +572,7 @@ void nodeLock(const char* str) {
|
|||||||
#if defined(ARDUINO_ARCH_ESP8266)
|
#if defined(ARDUINO_ARCH_ESP8266)
|
||||||
yield();
|
yield();
|
||||||
#endif
|
#endif
|
||||||
_sendRoute(build(_msgTmp, _nc.nodeId, GATEWAY_ADDRESS, NODE_SENSOR_ID,C_INTERNAL, I_LOCKED, false).set(str));
|
_sendRoute(build(_msgTmp, GATEWAY_ADDRESS, NODE_SENSOR_ID,C_INTERNAL, I_LOCKED, false).set(str));
|
||||||
#if defined(MY_RADIO_FEATURE)
|
#if defined(MY_RADIO_FEATURE)
|
||||||
transportPowerDown();
|
transportPowerDown();
|
||||||
debug(PSTR("MCO:NLK:TPD\n")); // power down transport
|
debug(PSTR("MCO:NLK:TPD\n")); // power down transport
|
||||||
|
|||||||
@@ -400,8 +400,8 @@ void loop() __attribute__((weak));
|
|||||||
|
|
||||||
|
|
||||||
// Inline function and macros
|
// Inline function and macros
|
||||||
static inline MyMessage& build(MyMessage &msg, uint8_t sender, uint8_t destination, uint8_t sensor, uint8_t command, uint8_t type, bool enableAck) {
|
static inline MyMessage& build(MyMessage &msg, const uint8_t destination, const uint8_t sensor, const uint8_t command, const uint8_t type, const bool enableAck) {
|
||||||
msg.sender = sender;
|
msg.sender = _nc.nodeId;
|
||||||
msg.destination = destination;
|
msg.destination = destination;
|
||||||
msg.sensor = sensor;
|
msg.sensor = sensor;
|
||||||
msg.type = type;
|
msg.type = type;
|
||||||
@@ -411,7 +411,7 @@ static inline MyMessage& build(MyMessage &msg, uint8_t sender, uint8_t destinati
|
|||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline MyMessage& buildGw(MyMessage &msg, uint8_t type) {
|
static inline MyMessage& buildGw(MyMessage &msg, const uint8_t type) {
|
||||||
msg.sender = GATEWAY_ADDRESS;
|
msg.sender = GATEWAY_ADDRESS;
|
||||||
msg.destination = GATEWAY_ADDRESS;
|
msg.destination = GATEWAY_ADDRESS;
|
||||||
msg.sensor = NODE_SENSOR_ID;
|
msg.sensor = NODE_SENSOR_ID;
|
||||||
|
|||||||
+3
-5
@@ -106,7 +106,7 @@ static bool skipSign(MyMessage &msg) {
|
|||||||
// Helper to prepare a signing presentation message
|
// Helper to prepare a signing presentation message
|
||||||
static void prepareSigningPresentation(MyMessage &msg, uint8_t destination) {
|
static void prepareSigningPresentation(MyMessage &msg, uint8_t destination) {
|
||||||
// Only supports version 1 for now
|
// Only supports version 1 for now
|
||||||
build(msg, _nc.nodeId, destination, NODE_SENSOR_ID, C_INTERNAL, I_SIGNING_PRESENTATION, false).set("");
|
build(msg, destination, NODE_SENSOR_ID, C_INTERNAL, I_SIGNING_PRESENTATION, false).set("");
|
||||||
mSetLength(msg, 2);
|
mSetLength(msg, 2);
|
||||||
mSetPayloadType(msg, P_CUSTOM); // displayed as hex
|
mSetPayloadType(msg, P_CUSTOM); // displayed as hex
|
||||||
msg.data[0] = SIGNING_PRESENTATION_VERSION_1;
|
msg.data[0] = SIGNING_PRESENTATION_VERSION_1;
|
||||||
@@ -188,8 +188,7 @@ bool signerProcessInternal(MyMessage &msg) {
|
|||||||
#if defined(MY_SIGNING_ATSHA204)
|
#if defined(MY_SIGNING_ATSHA204)
|
||||||
if (signerAtsha204GetNonce(msg)) {
|
if (signerAtsha204GetNonce(msg)) {
|
||||||
#endif
|
#endif
|
||||||
if (!_sendRoute(build(msg, _nc.nodeId, msg.sender, NODE_SENSOR_ID,
|
if (!_sendRoute(build(msg, msg.sender, NODE_SENSOR_ID, C_INTERNAL, I_NONCE_RESPONSE, false))) {
|
||||||
C_INTERNAL, I_NONCE_RESPONSE, false))) {
|
|
||||||
SIGN_DEBUG(PSTR("Failed to transmit nonce!\n"));
|
SIGN_DEBUG(PSTR("Failed to transmit nonce!\n"));
|
||||||
} else {
|
} else {
|
||||||
SIGN_DEBUG(PSTR("Transmitted nonce\n"));
|
SIGN_DEBUG(PSTR("Transmitted nonce\n"));
|
||||||
@@ -315,8 +314,7 @@ bool signerSignMsg(MyMessage &msg) {
|
|||||||
} else {
|
} else {
|
||||||
// Send nonce-request
|
// Send nonce-request
|
||||||
_signingNonceStatus=SIGN_WAITING_FOR_NONCE;
|
_signingNonceStatus=SIGN_WAITING_FOR_NONCE;
|
||||||
if (!_sendRoute(build(_msgSign, _nc.nodeId, msg.destination, msg.sensor,
|
if (!_sendRoute(build(_msgSign, msg.destination, msg.sensor, C_INTERNAL, I_NONCE_REQUEST, false).set(""))) {
|
||||||
C_INTERNAL, I_NONCE_REQUEST, false).set(""))) {
|
|
||||||
SIGN_DEBUG(PSTR("Failed to transmit nonce request!\n"));
|
SIGN_DEBUG(PSTR("Failed to transmit nonce request!\n"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ void stParentTransition(void) {
|
|||||||
_nc.distance = DISTANCE_INVALID; // Set distance to max and invalidate parent node ID
|
_nc.distance = DISTANCE_INVALID; // Set distance to max and invalidate parent node ID
|
||||||
_nc.parentNodeId = AUTO;
|
_nc.parentNodeId = AUTO;
|
||||||
// Broadcast find parent request
|
// Broadcast find parent request
|
||||||
(void)transportRouteMessage(build(_msgTmp, _nc.nodeId, BROADCAST_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_FIND_PARENT_REQUEST, false).set(""));
|
(void)transportRouteMessage(build(_msgTmp, BROADCAST_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_FIND_PARENT_REQUEST, false).set(""));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ void stIDTransition(void) {
|
|||||||
// send ID request
|
// send ID request
|
||||||
setIndication(INDICATION_REQ_NODEID);
|
setIndication(INDICATION_REQ_NODEID);
|
||||||
TRANSPORT_DEBUG(PSTR("TSM:ID:REQ\n")); // request node ID
|
TRANSPORT_DEBUG(PSTR("TSM:ID:REQ\n")); // request node ID
|
||||||
(void)transportRouteMessage(build(_msgTmp, _nc.nodeId, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_ID_REQUEST, false).set(""));
|
(void)transportRouteMessage(build(_msgTmp, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_ID_REQUEST, false).set(""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,7 +214,7 @@ void stUplinkTransition(void) {
|
|||||||
setIndication(INDICATION_CHECK_UPLINK);
|
setIndication(INDICATION_CHECK_UPLINK);
|
||||||
_transportSM.pingResponse = INVALID_HOPS;
|
_transportSM.pingResponse = INVALID_HOPS;
|
||||||
_transportSM.pingActive = true;
|
_transportSM.pingActive = true;
|
||||||
(void)transportRouteMessage(build(_msgTmp, _nc.nodeId, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_PING, false).set((uint8_t)1));
|
(void)transportRouteMessage(build(_msgTmp,GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_PING, false).set((uint8_t)1));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,7 +265,7 @@ void stReadyUpdate(void) {
|
|||||||
if (hwMillis() - _lastNetworkDiscovery > MY_TRANSPORT_DISCOVERY_INTERVAL_MS) {
|
if (hwMillis() - _lastNetworkDiscovery > MY_TRANSPORT_DISCOVERY_INTERVAL_MS) {
|
||||||
_lastNetworkDiscovery = hwMillis();
|
_lastNetworkDiscovery = hwMillis();
|
||||||
TRANSPORT_DEBUG(PSTR("TSM:READY:NWD REQ\n")); // send transport network discovery
|
TRANSPORT_DEBUG(PSTR("TSM:READY:NWD REQ\n")); // send transport network discovery
|
||||||
(void)transportRouteMessage(build(_msgTmp, GATEWAY_ADDRESS, BROADCAST_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_DISCOVER_REQUEST, false).set(""));
|
(void)transportRouteMessage(build(_msgTmp, BROADCAST_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_DISCOVER_REQUEST, false).set(""));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (_transportSM.failedUplinkTransmissions > MY_TRANSPORT_MAX_TX_FAILURES) {
|
if (_transportSM.failedUplinkTransmissions > MY_TRANSPORT_MAX_TX_FAILURES) {
|
||||||
@@ -507,7 +507,7 @@ uint8_t transportPingNode(const uint8_t targetId) {
|
|||||||
else {
|
else {
|
||||||
_transportSM.pingActive = true;
|
_transportSM.pingActive = true;
|
||||||
_transportSM.pingResponse = INVALID_HOPS;
|
_transportSM.pingResponse = INVALID_HOPS;
|
||||||
(void)transportRouteMessage(build(_msgTmp, _nc.nodeId, targetId, NODE_SENSOR_ID, C_INTERNAL, I_PING, false).set((uint8_t)1));
|
(void)transportRouteMessage(build(_msgTmp, targetId, NODE_SENSOR_ID, C_INTERNAL, I_PING, false).set((uint8_t)1));
|
||||||
// Wait for ping reply or timeout
|
// Wait for ping reply or timeout
|
||||||
(void)transportWait(2000, C_INTERNAL, I_PONG);
|
(void)transportWait(2000, C_INTERNAL, I_PONG);
|
||||||
}
|
}
|
||||||
@@ -647,7 +647,7 @@ void transportProcessMessage(void) {
|
|||||||
// delay for fast GW and slow nodes
|
// delay for fast GW and slow nodes
|
||||||
delay(5);
|
delay(5);
|
||||||
#endif
|
#endif
|
||||||
(void)transportRouteMessage(build(_msgTmp, _nc.nodeId, sender, NODE_SENSOR_ID, C_INTERNAL, I_PONG, false).set((uint8_t)1));
|
(void)transportRouteMessage(build(_msgTmp, sender, NODE_SENSOR_ID, C_INTERNAL, I_PONG, false).set((uint8_t)1));
|
||||||
return; // no further processing required
|
return; // no further processing required
|
||||||
}
|
}
|
||||||
if (type == I_PONG) {
|
if (type == I_PONG) {
|
||||||
@@ -700,7 +700,7 @@ void transportProcessMessage(void) {
|
|||||||
TRANSPORT_DEBUG(PSTR("TSF:MSG:GWL OK\n")); // GW uplink ok
|
TRANSPORT_DEBUG(PSTR("TSF:MSG:GWL OK\n")); // GW uplink ok
|
||||||
// random delay minimizes collisions
|
// random delay minimizes collisions
|
||||||
delay(hwMillis() & 0x3ff);
|
delay(hwMillis() & 0x3ff);
|
||||||
(void)transportRouteMessage(build(_msgTmp, _nc.nodeId, sender, NODE_SENSOR_ID, C_INTERNAL, I_FIND_PARENT_RESPONSE, false).set(_nc.distance));
|
(void)transportRouteMessage(build(_msgTmp, sender, NODE_SENSOR_ID, C_INTERNAL, I_FIND_PARENT_RESPONSE, false).set(_nc.distance));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TRANSPORT_DEBUG(PSTR("!TSF:MSG:GWL FAIL\n")); // GW uplink fail, do not respond to parent request
|
TRANSPORT_DEBUG(PSTR("!TSF:MSG:GWL FAIL\n")); // GW uplink fail, do not respond to parent request
|
||||||
@@ -718,7 +718,7 @@ void transportProcessMessage(void) {
|
|||||||
if (last == _nc.parentNodeId) {
|
if (last == _nc.parentNodeId) {
|
||||||
// random wait to minimize collisions
|
// random wait to minimize collisions
|
||||||
delay(hwMillis() & 0x3ff);
|
delay(hwMillis() & 0x3ff);
|
||||||
(void)transportRouteMessage(build(_msgTmp, _nc.nodeId, sender, NODE_SENSOR_ID, C_INTERNAL, I_DISCOVER_RESPONSE, false).set(_nc.parentNodeId));
|
(void)transportRouteMessage(build(_msgTmp, sender, NODE_SENSOR_ID, C_INTERNAL, I_DISCOVER_RESPONSE, false).set(_nc.parentNodeId));
|
||||||
// no return here (for fwd if repeater)
|
// no return here (for fwd if repeater)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user