Can data format

Support forum for MakerPlane Open Source Avionics. Post issues, problems, guidance and solutions.

Moderators: John Nicol, sprocket

Post Reply
abemeyer
Posts: 2
Joined: 17 Nov 2023, 09:56

Can data format

Post by abemeyer »

Hi,

Been busy with setup and config, then struggled for more than 3 weeks getting SocketCan to receive my data from Arduino linked to MCP2515 - but managed to get it working with can-232.h.

Since then i have been setting up my sensors and can messages in correct format but only been able to get the Altitude to update on the pyEfis screen, all other values either error with "Aux value not set.." etc for speed, oil p, temp or just have wrong values, like Baro sending it 844.34 Hpa but only get 0.84

Is there a clear definition on Can message length and other factors to be used in Can message, as Altitude is 184 [7] FF 00 00 for all and data in last 4 bytes, RPM (tach) also works 200 [5] FF 00 00 data in last 2

need some pointers here please, and then also for the 'Aux value not set..' for Oil Temp and other

Actually have a number of questions, just need a start - any help examples appreciated
birkelbach
Posts: 187
Joined: 04 Sep 2012, 14:42

Re: Can data format

Post by birkelbach »

Attached is a copy of the latest version of the CAN-FiX specification. Not all the messages are the same length. We don't pad the messages with extra bytes so the length will depend on the message type. The normal data update message is...

1 byte for the sending node number
1 byte for the index (should be zero for altitude)
1 byte for the function code (should be zero unless you are reporting quality or trying to set aux data)
1-5 bytes for the actual data

Aux data is also called meta data in places. The two terms are interchangeable.

Most floating point data is sent in fixed decimal notation as an integer. The altimeter setting should be sent in 0.001 inHg, so what you are seeing is expected. The units are not Hpa however, it should be sent in inHg. So if you want to send 29.92 then you'd actually send 29920 as an unsigned 16 bit integer. These are all spelled out in the specification.

I hope this helps.

Phil
Attachments
CANFiX-Draft.pdf
(785.25 KiB) Downloaded 48 times
Phil Birkelbach
Waller, Texas
RV-7 727WB
www.myrv7.com
abemeyer
Posts: 2
Joined: 17 Nov 2023, 09:56

Re: Can data format

Post by abemeyer »

Great thank you,

Been helpful, tested a couple today and more progress.

Is there a similar document for the pyEfis screens please?

How would i change the Baro to show Hpa and then also add OAT to pdf screen, and Fuel Qty to Liters?

And then also adding a settings screen, so adjust the Baro, and update fuel quantity etc?

Thanks in advance

Abraham
birkelbach
Posts: 187
Joined: 04 Sep 2012, 14:42

Re: Can data format

Post by birkelbach »

There is no such document for pyEfis. I think that John has put together some documentation, but I haven't spent a lot of time with it to know how thorough it is. The real answers are in the code. I know that's a bit of a cop out but it's the unfortunate, reality. IIRC the base gauge class has the feature set for changing the units on the fly. If changing the units on the fly is not really what you want, rather you want the units to be fixed then there are mechanisms to configure the system with scaling values that will do that. Eric has been pushing a lot of changes to the repo and I think he's done some work on moving a lot of this out to configuration files. All of his recent changes have been pulled into the 'develop' branch. I'll try to get the rest of his changes pulled in the next couple of days.
Phil Birkelbach
Waller, Texas
RV-7 727WB
www.myrv7.com
ulbuilder
Posts: 15
Joined: 27 Nov 2023, 10:26

Re: Can data format

Post by ulbuilder »

I've made many changes to make screen building much easier but my changes have not been merged yet.
Here is the documentation:
https://github.com/makerplane/pyEfis/bl ... builder.md

If you want to try out this new way before it is merged you can pull the code from the combined branch in my fork here:
https://github.com/e100/pyEfis/tree/combined

AFAIK The only way to do unit conversions is with some python code.
So I just added a pressure feature to to the new screen builder I've been working on.
You would need to add the option 'pressure' to the instruments you want to display in hPa:

Code: Select all

      - type: numeric_display
        row: 90
        column: 235
        span:
          rows: 4
          columns: 12
        options:
          dbkey: BARO
          decimalPlaces: 2
          pressure: true
The default will be inHg, switching units would make the change to hPa.
This will only work with screenbuilder screens unless you edited the screen code for the legacy(for lack of better word) screens.
In screenbuilder.yaml I added examples of a BARO +- button on the screen, holding it will cause it to change quickly.
Post Reply