Skip to content

Commit 012de44

Browse files
committed
Added some RF-related debug prints in signing code
If a failed transmsission is detected, a debug print will give a hint to why the signing session fails.
1 parent be92707 commit 012de44

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

libraries/MySensors/core/MySigning.cpp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ void signerPresentation(MyMessage &msg, uint8_t destination) {
142142
SIGN_DEBUG(PSTR("Whitelisting required\n"));
143143
#endif
144144

145-
_sendRoute(msg);
145+
if (!_sendRoute(msg)) {
146+
SIGN_DEBUG(PSTR("Failed to transmit signing presentation!"));
147+
}
146148

147149
#if defined(MY_SIGNING_FEATURE)
148150
// If we do support signing, wait for the gateway to tell us how it prefer us to transmit our messages
@@ -164,7 +166,9 @@ bool signerProcessInternal(MyMessage &msg) {
164166
prepareSigningPresentation(msg, sender);
165167
SIGN_DEBUG(PSTR("Informing node %d that we do not require signatures because we do not support it\n"),
166168
sender);
167-
_sendRoute(msg);
169+
if (!_sendRoute(msg)) {
170+
SIGN_DEBUG(PSTR("Failed to transmit signing presentation!"));
171+
}
168172
return true; // No need to further process I_SIGNING_PRESENTATION in this case
169173
}
170174
#elif defined(MY_SIGNING_FEATURE)
@@ -182,9 +186,12 @@ bool signerProcessInternal(MyMessage &msg) {
182186
#if defined(MY_SIGNING_ATSHA204)
183187
if (signerAtsha204GetNonce(msg)) {
184188
#endif
185-
SIGN_DEBUG(PSTR("Transmittng nonce\n"));
186-
_sendRoute(build(msg, _nc.nodeId, msg.sender, NODE_SENSOR_ID,
187-
C_INTERNAL, I_NONCE_RESPONSE, false));
189+
if (!_sendRoute(build(msg, _nc.nodeId, msg.sender, NODE_SENSOR_ID,
190+
C_INTERNAL, I_NONCE_RESPONSE, false))) {
191+
SIGN_DEBUG(PSTR("Failed to transmit nonce!\n"));
192+
} else {
193+
SIGN_DEBUG(PSTR("Transmitted nonce\n"));
194+
}
188195
} else {
189196
SIGN_DEBUG(PSTR("Failed to generate nonce!\n"));
190197
}
@@ -248,7 +255,9 @@ bool signerProcessInternal(MyMessage &msg) {
248255
} else {
249256
SIGN_DEBUG(PSTR("Informing node %d that we do not require whitelisting\n"), sender);
250257
}
251-
_sendRoute(msg);
258+
if (!_sendRoute(msg)) {
259+
SIGN_DEBUG(PSTR("Failed to transmit signing presentation!"));
260+
}
252261
#endif // MY_GATEWAY_FEATURE
253262
return true; // No need to further process I_SIGNING_PRESENTATION
254263
} else if (msg.type == I_NONCE_RESPONSE) {

0 commit comments

Comments
 (0)