mirror of
https://github.com/chirpstack/chirpstack.git
synced 2025-01-18 10:36:23 +00:00
lrwn: Fix cargo clippy feedback.
This commit is contained in:
parent
63bc1b57de
commit
4a33f67ed6
@ -2437,22 +2437,8 @@ impl PowerLevel {
|
||||
}
|
||||
|
||||
pub fn to_bytes(&self) -> [u8; 2] {
|
||||
let mut wor_snr = self.wor_snr;
|
||||
let mut wor_rssi = self.wor_rssi;
|
||||
|
||||
// Set to closest possible value.
|
||||
if wor_snr < -20 {
|
||||
wor_snr = -20;
|
||||
}
|
||||
if wor_snr > 11 {
|
||||
wor_snr = 11;
|
||||
}
|
||||
if wor_rssi > -15 {
|
||||
wor_rssi = -15;
|
||||
}
|
||||
if wor_rssi < -142 {
|
||||
wor_rssi = -142;
|
||||
}
|
||||
let wor_snr = self.wor_snr.clamp(-12, 11);
|
||||
let wor_rssi = self.wor_rssi.clamp(-142, -15);
|
||||
|
||||
// Encode values
|
||||
let wor_snr = (wor_snr + 20) as u8;
|
||||
|
@ -33,22 +33,8 @@ impl UplinkMetadata {
|
||||
return Err(anyhow!("max wor_channel value is 1"));
|
||||
}
|
||||
|
||||
let mut snr = self.snr;
|
||||
let mut rssi = self.rssi;
|
||||
|
||||
// Set to closest possible value.
|
||||
if snr < -20 {
|
||||
snr = -20;
|
||||
}
|
||||
if snr > 11 {
|
||||
snr = 11;
|
||||
}
|
||||
if rssi > -15 {
|
||||
rssi = -15;
|
||||
}
|
||||
if rssi < -142 {
|
||||
rssi = -142;
|
||||
}
|
||||
let snr = self.snr.clamp(-20, 11);
|
||||
let rssi = self.rssi.clamp(-142, -15);
|
||||
|
||||
// Encode values
|
||||
let snr = (snr + 20) as u8;
|
||||
|
Loading…
Reference in New Issue
Block a user