Get Started

Search

Tools to Simplify EFI!                   Contact Us: support@efianalytics.com

Get Started

bit fields can be, but don't have to be 1 byte long... TS is fine with U16 and U32 fields as well. However there is usually not much reason for so many selections :)

In the older firmwares it was very common to cram several fields into a single byte, but in cases where there is a whole lot more memory, fields are often mapped to lower bits with a single field in a byte for simplicity.

But with that said, they do not use the whole byte either unless told to do so. More typically they are only 1 to 4 bits long.

looking at the example you send:

n_cyl           = bits,    U08,      0,      [0:4], "INVALID","1","2","3","4","5","6".......

the [0:4] would denote that this field uses bits 0-4, so it is 5 bits long. Therefore will contain a value from 0-31, you can then assign another variable to bits 5-7 with: [5:7]

 

If you assign this bit field to a dialog, TunerStudio will display it as a drop down list, with up to 32 values for a 5 bit field. Hence the list of strings.. The string list is optional.

If there is no String list, TS will just display the raw value 0-31 in the list, but instead you can provide a list of strings to put in the drop down, each string in order will be mapped to the index value.

 

So let's look at a smaller bit field to keep simpler.

nInjectors1= bits,   U08,     183, [4:7]
This is a 4 bit field, and as there are no string, the drop down will simply be displayed as a list of values 0-15.

Now in this case where this variable represents the number of injectors 0-15 isn't quite what is wanted, so this notation is supported:

nInjectors1= bits,   U08,     183, [4:7+1]
This will display the index value + 1, so the drop down will have 1-16, but the underlying value will still be 0-15.

Now for the String list entry:

twoStroke1 = bits,   U08,     182, [2:2], "Four-stroke", "Two-stroke"

A simple 1 bit field, only looking at bit 2. It is either set or not. If you use twoStroke1 in a formula or expression in TS is will always resolve to 0 or 1.

There are 2 strings after, so these will be used instead of index values. You will get a drop down with the two options available, "Four-stroke" will resolve to the index value of 0, "Two-stroke" will resolve to 1.

 

Expanding on this...  Special String: "INVALID"

If you have say a 2 bit field, but the value of 3 isn't valid and you do not want it displayed:

dwellduty50       = bits,   U08,   12,  [5:6], "75% duty cycle*^", "minimal for HEI4", "50% duty cycle", "INVALID"

With this bit entry, it can mathematically resolve to a value of 0-3, however has 4 String String Options present for display in the drop down instead of the index. But taking note of that last String Option "INVALID", TunerStudio will suppress that option in that it will not display it in the drop down and it will not allow that setting to be set on load of msq's. It will enforce that the value 3 is not assigned to the defined [Constant] dwellduty50