Distinguish "unknown format" from "didn't even try to decode"

when decoding Comm-B messages
This commit is contained in:
Oliver Jowett 2021-07-29 19:04:51 +08:00
parent 9f146fcb71
commit c148fdca84
3 changed files with 6 additions and 2 deletions

View File

@ -47,12 +47,11 @@ static CommBDecoderFn comm_b_decoders[] = {
void decodeCommB(struct modesMessage *mm)
{
mm->commb_format = COMMB_UNKNOWN;
// If DR or UM are set, this message is _probably_ noise
// as nothing really seems to use the multisite broadcast stuff?
// Also skip anything that had errors corrected
if (mm->DR != 0 || mm->UM != 0 || mm->correctedbits > 0) {
mm->commb_format = COMMB_NOT_DECODED;
return;
}
@ -79,6 +78,8 @@ void decodeCommB(struct modesMessage *mm)
// decode it
bestDecoder(mm, true);
}
} else {
mm->commb_format = COMMB_UNKNOWN;
}
}

View File

@ -202,6 +202,7 @@ typedef enum {
typedef enum {
COMMB_UNKNOWN,
COMMB_AMBIGUOUS,
COMMB_NOT_DECODED,
COMMB_EMPTY_RESPONSE,
COMMB_DATALINK_CAPS,
COMMB_GICB_CAPS,

View File

@ -1681,6 +1681,8 @@ static const char *commb_format_to_string(commb_format_t format) {
return "empty response";
case COMMB_AMBIGUOUS:
return "ambiguous format";
case COMMB_NOT_DECODED:
return "not decoded";
case COMMB_DATALINK_CAPS:
return "BDS1,0 Datalink capabilities";
case COMMB_GICB_CAPS: