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

Serialization of temperature from IMU is possibly always skipped #144

Open
gauteh opened this issue Jul 3, 2023 · 1 comment
Open

Serialization of temperature from IMU is possibly always skipped #144

gauteh opened this issue Jul 3, 2023 · 1 comment
Assignees

Comments

@gauteh
Copy link
Owner

gauteh commented Jul 3, 2023

I think this gives a double negative:

https://github.com/gauteh/sfy/blob/main/sfy-buoy/src/axl.rs#L68

needs a test, since the notecard does not handle NaN in serialized JSON. Currently the IMU temperature is never sent, which could either mean that this is a bug. Or that there's something disabled in the IMU.

@stianvikanes : maybe something you can look into.

@gauteh
Copy link
Owner Author

gauteh commented Jul 3, 2023

Suggestion for a test in axl.rs:

    #[test]
    fn temp_not_f32_subnormal() {
        // the notecard does not handle NaN f32's
        let p = AxlPacketMeta::default();

        let v: heapless::String<{10 * 1024}> = serde_json_core::to_string(&p).unwrap();
        dbg!(&v);
        assert!(v.contains("temperature"));


        let mut p = AxlPacketMeta::default();
        p.temperature = f32::NAN;

        let v: heapless::String<{10 * 1024}> = serde_json_core::to_string(&p).unwrap();
        dbg!(&v);
        assert!(!v.contains("temperature"));

        let mut p = AxlPacketMeta::default();
        p.temperature = f32::INFINITY;

        let v: heapless::String<{10 * 1024}> = serde_json_core::to_string(&p).unwrap();
        dbg!(&v);
        assert!(!v.contains("temperature"));
    }

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

No branches or pull requests

2 participants