Measure signal power / noise power (at least in 2.4MHz mode).
Switch signalLevel back to a power measurement, don't put SNR in there. But make it a 0.0 - 1.0 double so we're not scaling everywhere. Adjust for the amplitude offset when calculating power. Adapt everything else to the new scheme.
This commit is contained in:
parent
5beecb9f4f
commit
19082d92ea
9 changed files with 118 additions and 28 deletions
9
net_io.c
9
net_io.c
|
|
@ -293,7 +293,7 @@ void modesSendBeastOutput(struct modesMessage *mm) {
|
|||
if (0x1A == ch) {*p++ = ch; }
|
||||
}
|
||||
|
||||
*p++ = (ch = mm->signalLevel);
|
||||
*p++ = ch = (char) round(mm->signalLevel * 255);
|
||||
if (0x1A == ch) {*p++ = ch; }
|
||||
|
||||
for (j = 0; j < msgLen; j++) {
|
||||
|
|
@ -568,7 +568,8 @@ int decodeBinMessage(struct client *c, char *p) {
|
|||
if (0x1A == ch) {p++;}
|
||||
}
|
||||
|
||||
mm.signalLevel = ch = *p++; // Grab the signal level
|
||||
ch = *p++; // Grab the signal level
|
||||
mm.signalLevel = ((unsigned)ch / 255.0);
|
||||
if (0x1A == ch) {p++;}
|
||||
|
||||
for (j = 0; j < msgLen; j++) { // and the data
|
||||
|
|
@ -627,7 +628,7 @@ 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 = 0xFF;
|
||||
mm.signalLevel = 0.0;
|
||||
|
||||
// Remove spaces on the left and on the right
|
||||
while(l && isspace(hex[l-1])) {
|
||||
|
|
@ -644,7 +645,7 @@ int decodeHexMessage(struct client *c, char *hex) {
|
|||
|
||||
switch(hex[0]) {
|
||||
case '<': {
|
||||
mm.signalLevel = (hexDigitVal(hex[13])<<4) | hexDigitVal(hex[14]);
|
||||
mm.signalLevel = ((hexDigitVal(hex[13])<<4) | hexDigitVal(hex[14])) / 255.0;
|
||||
hex += 15; l -= 16; // Skip <, timestamp and siglevel, and ;
|
||||
break;}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue