Treat zero-or-missing signal levels as "no information" and don't include them in RSSI.
This commit is contained in:
parent
f7c9aed8b0
commit
214bc0e587
3 changed files with 19 additions and 9 deletions
18
net_io.c
18
net_io.c
|
@ -373,6 +373,7 @@ static void modesSendBeastOutput(struct modesMessage *mm) {
|
|||
char *p = prepareWrite(&Modes.beast_out, 2 + 2 * (7 + msgLen));
|
||||
char ch;
|
||||
int j;
|
||||
int sig;
|
||||
unsigned char *msg = (Modes.net_verbatim ? mm->verbatim : mm->msg);
|
||||
|
||||
if (!p)
|
||||
|
@ -402,7 +403,12 @@ static void modesSendBeastOutput(struct modesMessage *mm) {
|
|||
*p++ = (ch = (mm->timestampMsg));
|
||||
if (0x1A == ch) {*p++ = ch; }
|
||||
|
||||
*p++ = ch = (char) round(sqrt(mm->signalLevel) * 255);
|
||||
sig = round(sqrt(mm->signalLevel) * 255);
|
||||
if (mm->signalLevel > 0 && sig < 1)
|
||||
sig = 1;
|
||||
if (sig > 255)
|
||||
sig = 255;
|
||||
*p++ = ch = (char)sig;
|
||||
if (0x1A == ch) {*p++ = ch; }
|
||||
|
||||
for (j = 0; j < msgLen; j++) {
|
||||
|
@ -729,8 +735,8 @@ static int decodeBinMessage(struct client *c, char *p) {
|
|||
clock_gettime(CLOCK_REALTIME, &mm.sysTimestampMsg);
|
||||
|
||||
ch = *p++; // Grab the signal level
|
||||
mm.signalLevel = ((unsigned char)ch / 256.0);
|
||||
mm.signalLevel = mm.signalLevel * mm.signalLevel + 1e-5;
|
||||
mm.signalLevel = ((unsigned char)ch / 255.0);
|
||||
mm.signalLevel = mm.signalLevel * mm.signalLevel;
|
||||
if (0x1A == ch) {p++;}
|
||||
|
||||
for (j = 0; j < msgLen; j++) { // and the data
|
||||
|
@ -797,7 +803,7 @@ static int decodeHexMessage(struct client *c, char *hex) {
|
|||
// Mark messages received over the internet as remote so that we don't try to
|
||||
// pass them off as being received by this instance when forwarding them
|
||||
mm.remote = 1;
|
||||
mm.signalLevel = 1e-5;
|
||||
mm.signalLevel = 0;
|
||||
|
||||
// Remove spaces on the left and on the right
|
||||
while(l && isspace(hex[l-1])) {
|
||||
|
@ -814,8 +820,8 @@ static int decodeHexMessage(struct client *c, char *hex) {
|
|||
|
||||
switch(hex[0]) {
|
||||
case '<': {
|
||||
mm.signalLevel = ((hexDigitVal(hex[13])<<4) | hexDigitVal(hex[14])) / 256.0;
|
||||
mm.signalLevel = mm.signalLevel * mm.signalLevel + 1e-5;
|
||||
mm.signalLevel = ((hexDigitVal(hex[13])<<4) | hexDigitVal(hex[14])) / 255.0;
|
||||
mm.signalLevel = mm.signalLevel * mm.signalLevel;
|
||||
hex += 15; l -= 16; // Skip <, timestamp and siglevel, and ;
|
||||
break;}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue