mirror of
https://github.com/liberatedsystems/RNode_Firmware_CE.git
synced 2024-12-28 17:09:25 -05:00
Updated SNR indication method
This commit is contained in:
parent
b30564c5fc
commit
19c4107c4e
4
Config.h
4
Config.h
@ -4,7 +4,7 @@
|
||||
#define CONFIG_H
|
||||
|
||||
#define MAJ_VERS 0x01
|
||||
#define MIN_VERS 0x0C
|
||||
#define MIN_VERS 0x0D
|
||||
|
||||
#define MCU_328P 0x90
|
||||
#define MCU_1284P 0x91
|
||||
@ -88,7 +88,7 @@
|
||||
|
||||
int last_rssi = -292;
|
||||
uint8_t last_rssi_raw = 0x00;
|
||||
int8_t last_snr = 0;
|
||||
uint8_t last_snr_raw = 0x00;
|
||||
size_t read_len = 0;
|
||||
uint8_t seq = 0xFF;
|
||||
uint8_t pbuf[MTU];
|
||||
|
7
LoRa.cpp
7
LoRa.cpp
@ -235,8 +235,11 @@ int LoRaClass::packetRssi() {
|
||||
return pkt_rssi;
|
||||
}
|
||||
|
||||
float LoRaClass::packetSnr()
|
||||
{
|
||||
uint8_t LoRaClass::packetSnrRaw() {
|
||||
return readRegister(REG_PKT_SNR_VALUE);
|
||||
}
|
||||
|
||||
float LoRaClass::packetSnr() {
|
||||
return ((int8_t)readRegister(REG_PKT_SNR_VALUE)) * 0.25;
|
||||
}
|
||||
|
||||
|
6
LoRa.h
6
LoRa.h
@ -1,5 +1,8 @@
|
||||
// Copyright (c) Sandeep Mistry. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
// Modifications and additions copyright 2018 by Mark Qvist
|
||||
// Obviously still under the MIT license.
|
||||
|
||||
#ifndef LORA_H
|
||||
#define LORA_H
|
||||
@ -29,6 +32,7 @@ public:
|
||||
int parsePacket(int size = 0);
|
||||
int packetRssi();
|
||||
uint8_t packetRssiRaw();
|
||||
uint8_t packetSnrRaw();
|
||||
float packetSnr();
|
||||
long packetFrequencyError();
|
||||
|
||||
|
@ -104,14 +104,14 @@ void receiveCallback(int packet_size) {
|
||||
read_len = 0;
|
||||
seq = sequence;
|
||||
last_rssi = LoRa.packetRssi();
|
||||
last_snr = LoRa.packetSnr();
|
||||
last_snr_raw = LoRa.packetSnrRaw();
|
||||
getPacketData(packet_size);
|
||||
} else if (isSplitPacket(header) && seq == sequence) {
|
||||
// This is the second part of a split
|
||||
// packet, so we add it to the buffer
|
||||
// and set the ready flag.
|
||||
last_rssi = (last_rssi+LoRa.packetRssi())/2;
|
||||
last_snr = (last_snr+LoRa.packetSnr())/2;
|
||||
last_snr_raw = (last_snr_raw+LoRa.packetSnrRaw())/2;
|
||||
getPacketData(packet_size);
|
||||
seq = SEQ_UNSET;
|
||||
ready = true;
|
||||
@ -123,7 +123,7 @@ void receiveCallback(int packet_size) {
|
||||
read_len = 0;
|
||||
seq = sequence;
|
||||
last_rssi = LoRa.packetRssi();
|
||||
last_snr = LoRa.packetSnr();
|
||||
last_snr_raw = LoRa.packetSnrRaw();
|
||||
getPacketData(packet_size);
|
||||
} else if (!isSplitPacket(header)) {
|
||||
// This is not a split packet, so we
|
||||
@ -138,7 +138,7 @@ void receiveCallback(int packet_size) {
|
||||
}
|
||||
|
||||
last_rssi = LoRa.packetRssi();
|
||||
last_snr = LoRa.packetSnr();
|
||||
last_snr_raw = LoRa.packetSnrRaw();
|
||||
getPacketData(packet_size);
|
||||
ready = true;
|
||||
}
|
||||
@ -166,6 +166,7 @@ void receiveCallback(int packet_size) {
|
||||
// output directly over to the host
|
||||
read_len = 0;
|
||||
last_rssi = LoRa.packetRssi();
|
||||
last_snr_raw = LoRa.packetSnrRaw();
|
||||
getPacketData(packet_size);
|
||||
|
||||
// We first signal the RSSI of the
|
||||
|
@ -138,10 +138,9 @@ void kiss_indicate_stat_rssi() {
|
||||
}
|
||||
|
||||
void kiss_indicate_stat_snr() {
|
||||
uint8_t packet_snr_val = (uint8_t)(last_snr+snr_offset);
|
||||
Serial.write(FEND);
|
||||
Serial.write(CMD_STAT_SNR);
|
||||
escapedSerialWrite(packet_snr_val);
|
||||
escapedSerialWrite(last_snr_raw);
|
||||
Serial.write(FEND);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user