|
@@ -454,6 +454,7 @@ static void parse_options(struct ts *ts, int argc, char **argv) {
|
454
|
454
|
ts->cw_warn_sec = strtoul(optarg, NULL, 10);
|
455
|
455
|
if (ts->cw_warn_sec > 86400)
|
456
|
456
|
ts->cw_warn_sec = 86400;
|
|
457
|
+ ts->cw_last_warn= ts->cw_last_warn + ts->cw_warn_sec;
|
457
|
458
|
break;
|
458
|
459
|
|
459
|
460
|
case 'D':
|
|
@@ -647,11 +648,14 @@ static void report_ecms(struct ts *ts, time_t now) {
|
647
|
648
|
}
|
648
|
649
|
|
649
|
650
|
static void report_cw_warn(struct ts *ts, time_t now) {
|
650
|
|
- notify(ts, "NO_CODE_WORD", "No valid code word was received for %ld sec.",
|
651
|
|
- now - ts->cw_last_warn);
|
652
|
|
- ts_LOGf("CW | *ERR* No valid code word was received for %ld seconds!\n",
|
653
|
|
- now - ts->cw_last_warn);
|
|
651
|
+ if (now - ts->key.ts > 1) {
|
|
652
|
+ notify(ts, "NO_CODE_WORD", "No valid code word was received in %ld sec.",
|
|
653
|
+ now - ts->key.ts);
|
|
654
|
+ ts_LOGf("CW | *ERR* No valid code word was received for %ld seconds!\n",
|
|
655
|
+ now - ts->key.ts);
|
|
656
|
+ }
|
654
|
657
|
ts->cw_last_warn = now;
|
|
658
|
+ ts->cw_next_warn = now + ts->cw_warn_sec;
|
655
|
659
|
}
|
656
|
660
|
|
657
|
661
|
static void do_reports(struct ts *ts) {
|
|
@@ -678,7 +682,7 @@ static void do_reports(struct ts *ts) {
|
678
|
682
|
}
|
679
|
683
|
|
680
|
684
|
if (!ts->emm_only && !ts->key.is_valid_cw) {
|
681
|
|
- if ((time_t)(ts->cw_last_warn + ts->cw_warn_sec) <= now) {
|
|
685
|
+ if (ts->cw_warn_sec && now >= ts->cw_next_warn) {
|
682
|
686
|
report_cw_warn(ts, now);
|
683
|
687
|
}
|
684
|
688
|
}
|