Skip to content

Commit 614403c

Browse files
lars18thJalle19
authored andcommitted
Skip only fake current CW
When a new CW is received with parity in use, it should not be penalized when searching for a new CW. This solves the cases where a new CW arrives after the parity change.
1 parent e63c7bd commit 614403c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/pmt.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -861,9 +861,13 @@ int send_cw(int pmt_id, int algo, int parity, uint8_t *cw, uint8_t *iv,
861861
c->expiry = c->time + expiry * 1000;
862862

863863
if (parity == pmt->parity && pmt->cw && pmt->last_update_cw > 0) {
864-
LOG("CW %d for PMT %d (%s) Warning! New CW using the current parity",
865-
c->id, pmt_id, pmt->name);
866-
c->time = pmt->cw->time - 1000; // We set the time before the active CW
864+
int res = 0;
865+
if (!pmt->update_cw) {
866+
c->time = pmt->cw->time - 1000; // We set the time before the active CW
867+
res = 1;
868+
}
869+
LOG("CW %d for PMT %d (%s) Warning! New CW using the current parity%s",
870+
c->id, pmt_id, pmt->name, res? " and perhaps a fake one!" : "");
867871
}
868872

869873
if (algo < 2)

0 commit comments

Comments
 (0)