@@ -327,12 +327,18 @@ boolean MySensor::sendRoute(MyMessage &message) {
327
327
// If we still don't have any parent id, re-request and skip this message.
328
328
if (nc.parentNodeId == AUTO) {
329
329
findParentNode ();
330
+ #ifdef WITH_LEDS_BLINKING
331
+ errBlink (1 );
332
+ #endif
330
333
return false ;
331
334
}
332
335
333
336
// If we still don't have any node id, re-request and skip this message.
334
337
if (nc.nodeId == AUTO) {
335
338
requestNodeId ();
339
+ #ifdef WITH_LEDS_BLINKING
340
+ errBlink (1 );
341
+ #endif
336
342
return false ;
337
343
}
338
344
@@ -369,10 +375,16 @@ boolean MySensor::sendRoute(MyMessage &message) {
369
375
}
370
376
if (hw_millis () - enter > MY_VERIFICATION_TIMEOUT_MS) {
371
377
debug (PSTR (" nonce tmo\n " ));
378
+ #ifdef WITH_LEDS_BLINKING
379
+ errBlink (1 );
380
+ #endif
372
381
return false ;
373
382
}
374
383
if (!signOk) {
375
384
debug (PSTR (" sign fail\n " ));
385
+ #ifdef WITH_LEDS_BLINKING
386
+ errBlink (1 );
387
+ #endif
376
388
return false ;
377
389
}
378
390
// After this point, only the 'last' member of the message structure is allowed to be altered if the message has been signed,
@@ -431,6 +443,9 @@ boolean MySensor::sendRoute(MyMessage &message) {
431
443
if (!ok) {
432
444
// Failure when sending to parent node. The parent node might be down and we
433
445
// need to find another route to gateway.
446
+ #ifdef WITH_LEDS_BLINKING
447
+ errBlink (1 );
448
+ #endif
434
449
failedTransmissions++;
435
450
if (autoFindParent && failedTransmissions > SEARCH_FAILURES) {
436
451
findParentNode ();
@@ -445,6 +460,9 @@ boolean MySensor::sendWrite(uint8_t to, MyMessage &message) {
445
460
mSetVersion (message, PROTOCOL_VERSION);
446
461
uint8_t length = mGetSigned (message) ? MAX_MESSAGE_LENGTH : mGetLength (message);
447
462
message.last = nc.nodeId ;
463
+ #ifdef WITH_LEDS_BLINKING
464
+ txBlink (1 );
465
+ #endif
448
466
bool ok = radio.send (to, &message, min (MAX_MESSAGE_LENGTH, HEADER_SIZE + length));
449
467
450
468
debug (PSTR (" send: %d-%d-%d-%d s=%d,c=%d,t=%d,pt=%d,l=%d,sg=%d,st=%s:%s\n " ),
@@ -504,6 +522,9 @@ boolean MySensor::process() {
504
522
debug (PSTR (" fw upd fail\n " ));
505
523
// Give up. We have requested MY_OTA_RETRY times without any packet in return.
506
524
fwUpdateOngoing = false ;
525
+ #ifdef WITH_LEDS_BLINKING
526
+ errBlink (1 );
527
+ #endif
507
528
return false ;
508
529
}
509
530
fwRetry--;
@@ -525,6 +546,9 @@ boolean MySensor::process() {
525
546
#endif
526
547
527
548
uint8_t len = radio.receive ((uint8_t *)&msg);
549
+ #ifdef WITH_LEDS_BLINKING
550
+ rxBlink (1 );
551
+ #endif
528
552
529
553
#ifdef MY_SIGNING_FEATURE
530
554
// Before processing message, reject unsigned messages if signing is required and check signature (if it is signed and addressed to us)
@@ -537,10 +561,16 @@ boolean MySensor::process() {
537
561
if (!mGetSigned (msg)) {
538
562
// Got unsigned message that should have been signed
539
563
debug (PSTR (" no sign\n " ));
564
+ #ifdef WITH_LEDS_BLINKING
565
+ errBlink (1 );
566
+ #endif
540
567
return false ;
541
568
}
542
569
else if (!signer.verifyMsg (msg)) {
543
570
debug (PSTR (" verify fail\n " ));
571
+ #ifdef WITH_LEDS_BLINKING
572
+ errBlink (1 );
573
+ #endif
544
574
return false ; // This signed message has been tampered with!
545
575
}
546
576
}
@@ -554,6 +584,9 @@ boolean MySensor::process() {
554
584
555
585
if (!(mGetVersion (msg) == PROTOCOL_VERSION)) {
556
586
debug (PSTR (" ver mismatch\n " ));
587
+ #ifdef WITH_LEDS_BLINKING
588
+ errBlink (1 );
589
+ #endif
557
590
return false ;
558
591
}
559
592
0 commit comments