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

panic in conv_vec_to_value_u().unwrap #133

Open
markus2330 opened this issue Jan 7, 2024 · 2 comments
Open

panic in conv_vec_to_value_u().unwrap #133

markus2330 opened this issue Jan 7, 2024 · 2 comments
Assignees
Labels
question Further information is requested

Comments

@markus2330
Copy link
Contributor

markus2330 commented Jan 7, 2024

Maybe on too strong wind?

Jän 06 11:31:59 messstation opensesame[13532]: thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: ()', /home/jenkins/workspace/opensesame_fixes/src/clima_sensor_us.rs:255:72
Jän 06 11:31:59 messstation opensesame[13532]: note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@fel115 do you have an idea what this could be? Any progress on the blog for Olimex?

@markus2330 markus2330 added the question Further information is requested label Jan 7, 2024
@markus2330 markus2330 changed the title panic in conv_vec_to_value_u panic in conv_vec_to_value_u().unwrap Jan 7, 2024
@fel115
Copy link
Collaborator

fel115 commented Jan 8, 2024

Yes, it seems that in line 249 the value of the clima sensor is 0xFFFFFFFF which is the error code for unsigned 32. So before using the Air Temp and Mean Wind Speed values we need to check if the conv_vec_to_value_s or conv_vec_to_value_s have any error.

Replace https://github.com/ElektraInitiative/opensesame/blob/177e14fd1ad29c04c1a838fc01f01b43150c5eae/src/clima_sensor_us.rs#L252C1-L256 with these lines.

match conv_vec_to_value_s((response_temp[0], response_temp[1]) {
    Ok(value) => {temp = value as 32 / 10.0;},
    Err(_) => ()
}

match conv_vec_to_value_u((response_wind[0], response_wind[1]) {
    Ok(value) => {wind = value as 32 / 10.0;},
    Err(_) => ()
}

According to the blog for Olimex, I will try to finish that in February.

@markus2330
Copy link
Contributor Author

Thx for looking into it and creating the PR!

According to the blog for Olimex, I will try to finish that in February.

Sounds like a plan. 🚀

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

No branches or pull requests

2 participants