Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
misha7b committed Oct 10, 2024
1 parent e78cbdd commit 952a1a9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/localisation/preprocessing/src/preprocess_keyence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,32 @@ enum sensor_checks{
unnaceptable,
}

fn main {
fn main() {
let keyence_data = vec![true, true, false, true, true];
let sensor_check = check_keyence_agrees(&keyence_data);
println!("{:?}", sensor_check);
}

pub fn check_keyence_agrees(keyence_data: &Vec<f64>) -> sensor_checks {
let mut sensor_check = sensor_checks::acceptable;
let mut previous_data_status = keyence_data_status::agreed
let mut current_data_status = keyence_data_status::agreed
let mut previous_data_status = keyence_data_status::agreed;
let mut current_data_status = keyence_data_status::agreed;

for i in 0..keyence_data.len()-1 {
if keyence_data[i] != keyence_data{i+1} {
current_data_status = keyence_data_status::disagreed
current_data_status = keyence_data_status::disagreed;
}
}

if current_data_status == keyence_data_status::disagreed && previous_data_status == keyence_data_status:: disagreed {
println!("Keyence disagreement for two consecutive readings.");

sensor_check = sensor_checks::unnaceptable
sensor_check = sensor_checks::unnaceptable;

sensor_check
}

previous_data_status = current_data_status
previous_data_status = current_data_status;

sensor_check
}

0 comments on commit 952a1a9

Please sign in to comment.