2Boost internals - aalesv/2boost GitHub Wiki
2Boost flowchart
flowchart TB
ROMstart[ROM] --Calc 2D/3D table function call--> EntryPoint
ROMstart --> Calc_ROM_MAF[ROM Calculate mass airflow function]
ROMstart --> CEL_Trigger[CEL trigger function]
Calc_ROM_MAF --> EntryPoint
CEL_Trigger --> EntryPoint
subgraph 2Boost
%%direction TB
map_switch.c <--Get map number--> SelMap
subgraph 2boost.c
%%direction TB
EntryPoint[Entry points]
end
2boost.c --> calc_hooked.c
2boost.c --> speed_density.c
2boost.c --> cel_flash.c
subgraph calc_hooked.c
%%direction TB
LUT[Do table lookup] --> SelMap[Select map]
SelMap --> Calc[Calculate map value]
end
subgraph speed_density.c
%%direction TB
CalcMAF[Calculate mass airflow]
end
subgraph cel_flash.c
%%direction TB
cel_flash[CEL Flash]
end
end
Calc --> ROMend[ROM]
CalcMAF --> ROMend
cel_flash --> ROMend
General information
The code works as follows - it intercepts ROM table calculate functions, determines state of cruise or Si-Drive switches (CFG_GLOBAL_MAP_SWITCH_SOURCE
variable controls what is used for map switching). Based on this state, it selects which 2Boost table to use instead of original table and then calls ROM table calc function.
Since calc_2d_uint_to_float_entry_point
and calc_3d_uint_to_float_entry_point
functions are actually a main loop, you need to define at least one 2D/3D table for it to work correctly.
Airflow calculation routine is intercepted separately and substituted to Speed Density algorithm.
Address substitution is used to intercept ROM functions. It is done manually via ROM editor. Setting Boost Target Hack (and other '... Hacks' including Speed Density) to Enable changes calling address of ROM calc table function to address of entry point functions defined in 2boost.c
file.
Lookup tables are used to simplify the code.