Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is the rssi functionality really implemented? #10

Open
nt7u opened this issue Jun 9, 2024 · 0 comments
Open

Is the rssi functionality really implemented? #10

nt7u opened this issue Jun 9, 2024 · 0 comments

Comments

@nt7u
Copy link

nt7u commented Jun 9, 2024

I don't see that the rssi() function returns anything useful (the "rssi" value). It seems that the return value is simply a success or failure indication, not the numerical value for the measured received signal strength indication. I ended up implementing the following on my Arduino loop() function to get the value outside of this library's class code:

#define TIMEOUT 500
char buf[5];

dra_serial->print(F("RSSI?\r\n"));

long start = millis();
do {
if (dra_serial->available()){
buf[0] = buf[1];
buf[1] = buf[2];
buf[2] = buf[3];
buf[3] = buf[4];
buf[4] = dra_serial->read();
}
} while (buf[4] != 0xa && (millis() - start) < TIMEOUT);

if ((buf[4] == 0xA))
{
s = ( (buf[0]-'0')*100 + (buf[1]-'0')*10 + (buf[2]-'0') ); // convert RSSI measurement to int
sMeter(s); // update the signal meter with new RSSI
}

This works on my ESP32 with a SA818. Btw, in 'setup()' I have "dra_serial = new HardwareSerial(2);". Ideally, it seems like the return value from a call to the library function "int rssi()" might return -1 if it fails (timeout) and if successful it would return the positive value of the rssi returned from the radio module.

Note that despite the poor documentation of the SA818 indicating that the value is 0 to 255, in actuality it appears to be 0 to 127 with a "no antenna connected" noise floor that rests around 20.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant