Fix cargo check / clippy warnings.

This commit is contained in:
Orne Brocaar 2024-06-19 09:20:17 +01:00
parent 3b95a413a6
commit 6b9f7a9ea1
3 changed files with 3 additions and 22 deletions

View File

@ -80,15 +80,7 @@ impl Algorithm {
fn get_nb_trans(&self, current_nb_trans: u8, pkt_loss_rate: f32) -> u8 {
let pkt_loss_table: [[u8; 3]; 4] = [[1, 1, 2], [1, 2, 3], [2, 3, 3], [3, 3, 3]];
let mut current_nb_trans = current_nb_trans;
if current_nb_trans < 1 {
current_nb_trans = 1;
}
if current_nb_trans > 3 {
current_nb_trans = 3;
}
let current_nb_trans = current_nb_trans.clamp(1, 3);
let nb_trans_index = current_nb_trans as usize - 1;
if pkt_loss_rate < 5.0 {
return pkt_loss_table[0][nb_trans_index];

View File

@ -78,6 +78,7 @@ impl Handler for Plugin {
input.set("installationMargin", req.installation_margin)?;
input.set("minDr", req.min_dr)?;
input.set("maxDr", req.max_dr)?;
input.set("skipFCntCheck", req.skip_f_cnt_check)?;
input.set("deviceVariables", device_variables)?;
let mut uplink_history: Vec<rquickjs::Object> = Vec::new();

View File

@ -375,25 +375,13 @@ pub struct LocationResult {
pub latitude: f64,
pub longitude: f64,
pub altitude: f64,
pub accuracy: Option<f64>, // documented as INT, but JSON does (sometimes) contain x.y value. Also, this value can be null.
#[serde(rename = "algorithmType")]
pub algorithm_type: String,
#[serde(rename = "numberOfGatewaysReceived")]
pub number_of_gateways_received: f64, // documented as INT, but JSON does (sometimes) contain x.y value.
#[serde(rename = "numberOfGatewaysUsed")]
pub number_of_gateways_used: f64, // documented as INT, but JSON does (sometimes) contain x.y value.
pub accuracy: Option<f64>,
}
#[derive(Deserialize, Clone)]
pub struct LocationSolverResult {
pub ecef: Vec<f64>,
pub llh: Vec<f64>,
pub gdop: f64,
pub accuracy: f64,
#[serde(rename = "capture_time_gps")]
pub capture_time_gps: f64,
#[serde(rename = "capture_time_utc")]
pub capture_time_utc: f64,
}
#[derive(Serialize, Clone)]