ardupilot icon indicating copy to clipboard operation
ardupilot copied to clipboard

AP_EFI: Hirth: fix sensor health flags

Open robertlong13 opened this issue 1 year ago • 3 comments

There is no crankshaft sensor status reported by this EFI. This line is misleading and should be removed. The sensor health bitmask is already logged elsewhere.

robertlong13 avatar Sep 11 '24 02:09 robertlong13

How did we end up with this in here, then?

Is it in the datasheet?

peterbarker avatar Sep 11 '24 02:09 peterbarker

How did we end up with this in here, then?

I really don't know how this got there. I asked around but didn't get a confident answer.

Is it in the datasheet?

No, that sensor_ok bitmask holds 4 bits for 4 different sensor healths, none of which are crankshaft, and all 4 of which are logged a couple lines later correctly. From the bitwise & here, you'd think that CRANK_SHAFT_SENSOR_OK held a single bit, but it doesn't: its 0x0F (4 LSB set). So this line is effectively marking crankshaft sensor healthy if any of these 4 sensors are healthy, and unhealthy if all are unhealthy.

robertlong13 avatar Sep 11 '24 03:09 robertlong13

While I was here, I noticed that our other sensor health bitmask is actually wrong. The datasheet shows bits 1-4, not bits 0-3, and I have confirmed with my Hirth EFI that bit 0 always reports 0.

I have pushed another commit to this PR to address that too.

robertlong13 avatar Sep 12 '24 22:09 robertlong13

Merged, thanks!

peterbarker avatar Sep 13 '24 08:09 peterbarker