-
-
Notifications
You must be signed in to change notification settings - Fork 67
Addresses.h
Every DCS-BIOS control
needs some or all values for address
, mask
or shift
. The DCS-BIOS
developers while maintaining the modules tries to keep these values from changing. However, sometimes it isn't possible to avoid changes.
The result for you when they do change is:
- your sketch stops working
- you need to identify which value has changed
- you need to update your sketches
This can be time-consuming and error prone.
There is a file dcs-bios\Scripts\DCS-BIOS\doc\Addresses.h
that holds all these values in macros
. It is auto-generated when a DCS mission starts.
If you reference these macros
instead your maintenance of your sketches will be easier when for some reason these values changes. You will still need to re-upload the sketch with the changed Addresses.h but you won’t have to modify your sketches.
Showing the differences using the A-10C CDU 0 button.
Direct assignment:
void onCdu0Change(unsigned int newValue)
{
/* your code here */
}
DcsBios::IntegerBuffer cdu0Buffer(0x10f4, 0x1000, 12, onCdu0Change);
DcsBios::LED cdu0(0x10f4, PIN);
Using macro:
void onCdu0Change(unsigned int newValue)
{
/* your code here */
}
DcsBios::IntegerBuffer cdu0Buffer(A_10C_CDU_0, onCdu0Change);
DcsBios::LED cdu0(A_10C_CDU_0_AM, PIN);
Alternative 1 using direct assignment:
Alternative 2 using macro from Addresses.h:
Using address, mask and shift value macros In the code above you can see that there is a address (0x1012), mask (0x0800). These values can sometimes change which leads to the sketch not working anymore. You will find macros for all DCS-BIOS controls in Addresses.h. This file is auto-generated when DCS-BIOS starts. If you reference these macros instead you will have it easier when for some reason these values changes. You will still need to re-upload the sketch with the changed Addresses.h but you won’t have to modify your sketches. With macros the above code will look like this:
DcsBios::LED masterCaution(A_10C_UFC_MASTER_CAUTION_AM, 13);
Look carefully which macro to use.
Macro without special ending contains address, mask, shift
_A contains only address
_AM contains address and mask