map_switch.c - aalesv/2boost GitHub Wiki
All functions related to map selection located here.
If P_SI_DRVIE_STATE
symbol is undefined
Return value | Meaning |
---|---|
0 | ROM map |
1 | 2Boost map 1 |
2 | 2Boost map 2 |
3 | 2Boost Overtake map |
If P_SI_DRVIE_STATE
symbol is defined
Return value | Meaning |
---|---|
0 | ROM map |
1 | 2Boost Intelligent map |
2 | 2Boost Sport map |
3 | 2Boost Sport Sharp map |
4 | 2Boost Overtake map |
This function returns an 8-bit unsigned integer value representing the current state of the global map switch. It first calls the overtakeMapSwitch()
function to obtain the current state of the overtake map switch. If the return value is greater than zero, the function exits and returns this value. If the return value is zero, the function then determines the source of the global map switch by calling the globalMapSwitchSource()
function. Depending on the source, the function sets the return value accordingly:
-
If source equals
MAP_SWITCH_SOURCE_NONE
, return value sets to0
(do not switch maps) -
If source equals
MAP_SWITCH_SOURCE_CRUISE
, cruise on/off state used. Return value sets tocruiseStateEnabled() + 1
-
If source equals
MAP_SWITCH_SOURCE_SI_DRIVE
, Si-Drive switch state used. Return value sets tosiDriveState()
-
In any other case it is considered as misconfiguration and return value sets to
0
(do not switch maps)
Finally, the function sets the global map switch state in RAM and returns the calculated value. This function is used as array index and can produce array overrun.
Accelerator pedal \ Cruise Cansel switch | Off | On |
---|---|---|
<= 25% | 0 | 0 |
> 25% | 0 | Result of overtakeMapNumber() function call |
If the cruise cancel switch is pressed and the accelerator pedal value is above a certain threshold, overtake conditions are met and this function returns 1. otherwise it return 0.
This function returns LUT_OVERTAKE_MAP_COLUMN_NUMBER
constant representing number of map that is an Overtake map.
This function returns an 8-bit unsigned integer value representing the current state of the overtake map switch. It determines the source of the overtake map switch by checking the value of the CFG_OVERTAKE_BUTTON_SWITCH_SOURCE
constant. Depending on the source, the function may call the overtakeMapConditionsMet()
function to determine if overtake conditions are met. If the conditions are met, the function calls overtakeMapNumber()
and returns a predefined column number. Otherwise, it returns zero. This function is used as array index and can produce array overrun.
This function returns an 8-bit unsigned integer value representing whether the cruise cancel switch is pressed. It checks the value of the P_CRUISE_CANCEL_SWITCH
variable and returns 1 if the switch is on, and 0 otherwise.
This function returns an 8-bit unsigned integer value representing whether the brake pedal is pressed. It checks the value of the P_BRAKE_PEDAL_SWITCH
variable and returns 1 if the pedal is pressed, and 0 otherwise.
Later ROMs, P_CRUISE_STATE_MASK_CRUISE_ENABLED
symbol is defined
This function returns an 8-bit unsigned integer value representing whether the cruise state is enabled. It checks the value of the P_CRUISE_STATE_MASK_CRUISE_ENABLED
constant and determines if the cruise control is active by performing a bitwise AND operation with the P_CRUISE_STATE
variable. If the result is equal to P_CRUISE_STATE_MASK_CRUISE_ENABLED
, the function returns 1, indicating that the cruise control is enabled. If the result is 0, the function returns 0, indicating that the cruise control is not enabled. If the result is neither P_CRUISE_STATE_MASK_CRUISE_ENABLED
nor 0, the function returns 0.
Earlier ROMs, P_CRUISE_STATE_MASK_CRUISE_DISABLED
symbol is defined
This function returns an 8-bit unsigned integer value representing whether the cruise state is enabled. It checks the value of the P_CRUISE_STATE_MASK_CRUISE_DISABLED
constant and determines if the cruise control is disabled by performing a bitwise AND operation with the P_CRUISE_STATE
variable. If the result is equal to P_CRUISE_STATE_MASK_CRUISE_DISABLED
, the function returns 0, indicating that the cruise control is disabled. If the result is 0, the function returns 1, indicating that the cruise control is enabled. If the result is neither P_CRUISE_STATE_MASK_CRUISE_DISABLED
nor 0, the function returns 0.
ROM Si-Drive State | Return value |
---|---|
1 | SI_DRIVE_STATE_SPORT |
2 | SI_DRIVE_STATE_SPORT_SHARP |
3 | SI_DRIVE_STATE_INTELLIGENT |
8 | SI_DRIVE_STATE_SPORT_SHARP |
16 | SI_DRIVE_STATE_INTELLIGENT |
Other | SI_DRIVE_STATE_NONE |
This function returns an 8-bit unsigned integer value representing the current state of the Si-Drive switch. It checks the value of the P_SI_DRVIE_STATE
variable and returns a predefined value depending on the state. If the value is 3
or 16
, the function returns SI_DRIVE_STATE_INTELLIGENT
. If the value is 1
, the function returns SI_DRIVE_STATE_SPORT
(./types.h#si_drive_state). If the value is 2
or 8
, the function returns SI_DRIVE_STATE_SPORT_SHARP
. Otherwise, the function returns SI_DRIVE_STATE_NONE
. This function is used as array index and can produce array overrun.
This function returns CFG_OVERTAKE_BUTTON_SWITCH_SOURCE
constant representing how map switching is controlled. Currently Cruise Control switch and Si-Drive switch are supported.
This page was created with help of ChatGPT