File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -493,30 +493,30 @@ void listenBeforeTalk()
493
493
// listen before talk
494
494
unsigned long waited = 0 ;
495
495
if (interruptPin != -1 ) {
496
- while (state != STATUS_WAITING && state != STATUS_RECORDING_END && state != STATUS_RECORDING_0 ) {
496
+ while (state > STATUS_RECORDING_0 && state != STATUS_RECORDING_END) {
497
497
// wait till no rf message is in the air
498
- waited += 10 ;
499
- delayMicroseconds (10000 );
498
+ waited += 5 ;
499
+ delayMicroseconds (3 ); // 5 - some micros for other stuff
500
500
// don't wait longer than 5sec
501
- if (waited > 5000 ) {
501
+ if (waited > 5000000 ) {
502
502
break ;
503
503
}
504
504
// some delay between the message in air and the new message send
505
- if (state == STATUS_WAITING || state == STATUS_RECORDING_END) {
506
- waited += 100 ;
507
- // INT_MAX < 100000 => do two calls
508
- delayMicroseconds (50000 );
509
- delayMicroseconds (50000 );
505
+ // there could be additional repeats following so wait some more time
506
+ if (state <= STATUS_RECORDING_0 || state == STATUS_RECORDING_END) {
507
+ waited += 1000000 ;
508
+ delay (1000 );
510
509
}
511
510
}
512
-
513
511
// stop receiving while sending, this method preserves the recording state
514
512
detachInterrupt (interruptPin);
515
513
}
516
514
// this prevents loosing the data in the receiving buffer, after sending
517
515
if (data1_ready || data2_ready) {
518
516
state = STATUS_RECORDING_END;
519
517
}
518
+ // Serial.print(waited);
519
+ // Serial.print(" ");
520
520
}
521
521
522
522
void afterTalk ()
You can’t perform that action at this time.
0 commit comments