hwdef Defines that Change Param Defaults¶
Many parameters have their default value set by a define in the board’s hwdef.dat file. This lets a board ship with the correct battery monitor pins, serial port protocols, heater target, etc. already configured, without requiring a separate defaults.parm file entry.
The tables below list the hwdef defines that change a parameter’s default, the parameter they affect, and the “Normal Default” value the parameter takes if the board’s hwdef does not set the define. Where the normal default depends on the vehicle or board features, the conditions are noted.
Note
Serial port baud rate defines (DEFAULT_SERIALn_BAUD) use the same units as the parameter (e.g. 57 for 57600 baud) except DEFAULT_SERIAL0_BAUD, which is given in bits per second (e.g. 115200).
Note
Defines that only enable or disable a feature (*_ENABLED) are not listed here. They determine whether a parameter exists at all, rather than its default value.
For more information on creating hwdef files, see Porting to a new flight controller board.
Serial Ports¶
Define |
Parameter |
Normal Default |
Notes |
|---|---|---|---|
|
2 (MAVLink2) |
||
|
2 (MAVLink2) |
||
|
5 (GPS) |
||
|
5 (GPS) |
||
|
-1 (None) |
||
|
115 (115200) |
define is in bits per second |
|
|
57 (57600) |
||
|
230 (230400) |
||
|
57 (57600) |
||
|
0 |
e.g. to set inversion or RX/TX swap on a port; SERIAL7_OPTIONS and SERIAL8_OPTIONS have hard-coded defaults |
Battery Monitor¶
Define |
Parameter |
Normal Default |
Notes |
|---|---|---|---|
|
0 (Disabled) |
||
|
4 (ChibiOS), -1 (others) |
requires |
|
|
3 (ChibiOS), -1 (others) |
requires |
|
|
10.1 |
||
|
17.0 |
||
|
0 |
||
|
0 (Disabled) |
||
|
same as BATT_VOLT_PIN |
only applies if the second monitor is analog |
|
|
same as BATT_CURR_PIN |
only applies if the second monitor is analog |
|
|
10.1 |
only applies if the second monitor is analog |
|
|
17.0 |
only applies if the second monitor is analog |
|
|
0 |
||
|
0 (probe) |
||
|
0.0005 |
Board, IMU and Heater¶
Define |
Parameter |
Normal Default |
Notes |
|---|---|---|---|
|
1 (first IMU) |
||
|
3 (first two IMUs) |
||
|
-1 (heater disabled) |
||
|
0 (disabled) |
||
|
200 |
||
|
0.3 |
||
|
0 (Auto) |
||
|
1 if the board has a safety switch input or an IOMCU, otherwise 0 |
||
|
3 |
Rover and AntennaTracker only: if set, changes the default to 7 so the safety button is also active while armed |
|
|
4.3 |
||
|
0 |
Sensors¶
Define |
Parameter |
Normal Default |
Notes |
|---|---|---|---|
|
2 (CheckAndFix) |
||
|
1 |
||
|
1 (MS4525) on Plane if that backend is enabled, otherwise 0 (None) |
also changes the ARSPD_PIN default to 1, except on AP_Periph where that parameter is not present |
|
|
1 |
||
|
15 |
only used on Plane when HAL_AIRSPEED_TYPE_DEFAULT is not defined |
|
|
1 (Auto) |
also used by AP_Periph |
|
|
1 |
||
|
0 (None) |
||
|
-1 |
||
|
0 |
||
|
0 |
Notify, OSD and Relays¶
Define |
Parameter |
Normal Default |
Notes |
|---|---|---|---|
|
-1 (none) |
||
|
1 (high) |
||
|
Board LEDs and I2C LEDs (plus ProfiLED_IOMCU on boards with an IOMCU) |
If defining a serial led add its type and include this define |
|
|
0 (None) |
||
|
RELAY1_PIN etc. |
-1 (none) |
commonly included when VTX power switch or dual Camera inputs are defined |
|
RELAY1_DEFAULT etc. |
0 (Off) |
define of -1 leaves the parameter’s normal default |
Vehicle, CAN, Logging and Networking¶
Define |
Parameter |
Normal Default |
Notes |
|---|---|---|---|
|
1 (X) |
Copter only |
|
|
1 (2 on AntennaTracker) |
||
|
CAN_P1_DRIVER etc. |
0 (Disabled) |
commonly used to enable the CAN ports, especially if CAN power monitors or GPSes are included. |
|
8192 (16384 on CAN FD capable boards) |
||
|
500 (2 or 10 on boards logging to flash via LittleFS) |
||
|
1 (File), 4 (Block), 2 (MAVLink), or 0 (None), depending on the compiled backends |
File is preferred on SITL; otherwise Block, File, and MAVLink are selected in that order |
|
|
NET_IPADDR0 to NET_IPADDR3 |
192.168.144.14 |
define is a string, e.g. “192.168.144.14” |
|
NET_GWADDR0 to NET_GWADDR3 |
192.168.144.1 |
define is a string |
|
24 |
||
|
NET_MACADDR0 to NET_MACADDR5 |
C2:AF:51:03:CF:46 |
define is a string |
AP_Periph¶
These defines are only used by AP_Periph firmware.
Define |
Parameter |
Normal Default |
Notes |
|---|---|---|---|
|
0 (dynamic node allocation) |
||
|
3 |
||
|
1 |
||
|
RNGFND_PORT and PRX_PORT |
3 |
sets the first rangefinder and proximity sensor serial ports when those features are enabled |
|
1 |
||
|
57600 |
||
|
3 |
||
|
115200 |
||
|
-1 (disabled) |
||
|
none |
must be defined if |
|
|
1 |
||
|
0 |
value of 1 sets bit 0, “Enable continuous sensor probe” |
|
|
0, 0, 0 |
||
|
0 |
||
|
0 |
||
|
1 |
||
|
1 |
||
|
-1 (disabled) |
||
|
12500000 |