2015-07-10 06:01:56 -07:00
/**
* @ file engine_configuration . cpp
* @ brief Utility method related to the engine configuration data structure .
*
* @ date Nov 22 , 2013
2020-01-07 21:02:40 -08:00
* @ author Andrey Belomutskiy , ( c ) 2012 - 2020
2015-07-10 06:01:56 -07:00
*
* This file is part of rusEfi - see http : //rusefi.com
*
* rusEfi is free software ; you can redistribute it and / or modify it under the terms of
* the GNU General Public License as published by the Free Software Foundation ; either
* version 3 of the License , or ( at your option ) any later version .
*
* rusEfi is distributed in the hope that it will be useful , but WITHOUT ANY WARRANTY ; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License along with this program .
* If not , see < http : //www.gnu.org/licenses/>.
*
*/
2021-07-25 22:05:17 -07:00
# include "pch.h"
2022-09-07 12:56:45 -07:00
2015-07-10 06:01:56 -07:00
# include "speed_density.h"
# include "advance_map.h"
2021-03-25 15:16:26 -07:00
# include "flash_main.h"
2015-07-10 06:01:56 -07:00
2022-01-03 00:35:26 -08:00
# include "bench_test.h"
2021-01-22 21:00:34 -08:00
2023-12-13 08:08:28 -08:00
# if EFI_ONBOARD_MEMS
2017-08-18 13:18:11 -07:00
# include "accelerometer.h"
2024-10-07 08:19:35 -07:00
# endif // EFI_ONBOARD_MEMS
2017-08-16 23:56:25 -07:00
2021-06-02 14:50:07 -07:00
# include "defaults.h"
2021-10-02 09:50:06 -07:00
# include "custom_engine.h"
2024-10-07 13:52:42 -07:00
2020-02-02 00:56:21 -08:00
# include "boost_control.h"
2024-08-23 07:17:36 -07:00
# include "engine_configuration_defaults.h"
2019-04-12 19:07:03 -07:00
# if EFI_IDLE_CONTROL
2017-12-03 12:31:11 -08:00
# include "idle_thread.h"
2018-10-30 04:58:50 -07:00
# endif /* EFI_IDLE_CONTROL */
2019-04-12 19:07:03 -07:00
# if EFI_ALTERNATOR_CONTROL
2019-03-31 13:56:13 -07:00
# include "alternator_controller.h"
2018-10-30 04:58:50 -07:00
# endif
2019-04-12 19:07:03 -07:00
# if EFI_ELECTRONIC_THROTTLE_BODY
2018-10-30 04:58:50 -07:00
# include "electronic_throttle.h"
# endif
2019-04-12 19:07:03 -07:00
# if EFI_HIP_9011
2019-04-09 16:12:35 -07:00
# include "hip9011.h"
2018-10-30 04:58:50 -07:00
# endif
2021-07-14 22:28:44 -07:00
# include "hardware.h"
2019-04-12 19:07:03 -07:00
# if EFI_PROD_CODE
2017-12-03 12:31:11 -08:00
# include "board.h"
# endif /* EFI_PROD_CODE */
2015-07-10 06:01:56 -07:00
2019-04-12 19:07:03 -07:00
# if EFI_EMULATE_POSITION_SENSORS
2020-04-24 11:00:06 -07:00
# include "trigger_emulator_algo.h"
2017-12-17 12:41:58 -08:00
# endif /* EFI_EMULATE_POSITION_SENSORS */
2019-04-12 19:07:03 -07:00
# if EFI_TUNER_STUDIO
2015-07-10 06:01:56 -07:00
# include "tunerstudio.h"
# endif
# define TS_DEFAULT_SPEED 38400
2016-09-13 17:03:14 -07:00
/**
* Current engine configuration . On firmware start we assign empty configuration , then
2022-12-20 05:48:28 -08:00
* we copy actual configuration after reading settings from flash .
2022-12-20 05:48:51 -08:00
* This is useful to compare old / current ( activeConfiguration ) and new / future ( engineConfiguration ) configurations in order to apply new settings .
2016-09-13 17:03:14 -07:00
*
* todo : place this field next to ' engineConfiguration ' ?
*/
2023-04-19 17:29:33 -07:00
static bool hasRememberedConfiguration = false ;
2020-12-16 19:53:26 -08:00
# if EFI_ACTIVE_CONFIGURATION_IN_FLASH
2020-04-25 13:32:32 -07:00
# include "flash_int.h"
2020-02-04 18:36:38 -08:00
engine_configuration_s & activeConfiguration = reinterpret_cast < persistent_config_container_s * > ( getFlashAddrFirstCopy ( ) ) - > persistentConfiguration . engineConfiguration ;
2019-11-24 21:02:53 -08:00
// we cannot use this activeConfiguration until we call rememberCurrentConfiguration()
bool isActiveConfigurationVoid = true ;
2019-04-15 05:40:12 -07:00
# else
2019-10-31 13:06:34 -07:00
static engine_configuration_s activeConfigurationLocalStorage ;
engine_configuration_s & activeConfiguration = activeConfigurationLocalStorage ;
2019-04-15 05:40:12 -07:00
# endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */
2016-09-13 17:03:14 -07:00
2021-11-16 01:15:29 -08:00
void rememberCurrentConfiguration ( ) {
2020-12-16 19:00:42 -08:00
# if ! EFI_ACTIVE_CONFIGURATION_IN_FLASH
2016-09-13 17:03:14 -07:00
memcpy ( & activeConfiguration , engineConfiguration , sizeof ( engine_configuration_s ) ) ;
2019-11-24 21:02:53 -08:00
# else
isActiveConfigurationVoid = false ;
2019-04-15 05:40:12 -07:00
# endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */
2023-04-19 17:29:33 -07:00
hasRememberedConfiguration = true ;
2016-09-13 17:03:14 -07:00
}
2020-07-05 08:16:07 -07:00
static void wipeString ( char * string , int size ) {
// we have to reset bytes after \0 symbol in order to calculate correct tune CRC from MSQ file
for ( int i = strlen ( string ) + 1 ; i < size ; i + + ) {
string [ i ] = 0 ;
}
}
2021-11-16 01:15:29 -08:00
static void wipeStrings ( ) {
2020-07-05 08:16:07 -07:00
wipeString ( engineConfiguration - > engineMake , sizeof ( vehicle_info_t ) ) ;
wipeString ( engineConfiguration - > engineCode , sizeof ( vehicle_info_t ) ) ;
wipeString ( engineConfiguration - > vehicleName , sizeof ( vehicle_info_t ) ) ;
2020-07-05 10:34:51 -07:00
}
2021-11-16 01:15:29 -08:00
void onBurnRequest ( ) {
wipeStrings ( ) ;
2020-07-05 08:16:07 -07:00
2023-04-19 19:09:48 -07:00
incrementGlobalConfigurationVersion ( " burn " ) ;
2020-07-05 08:16:07 -07:00
}
2024-03-10 10:58:25 -07:00
/**
* this hook is about https : //github.com/rusefi/rusefi/wiki/Custom-Firmware and https://github.com/rusefi/rusefi/wiki/Canned-Tune-Process
2024-03-24 19:07:58 -07:00
* todo : why two hooks ? is one already dead ?
2024-03-10 10:58:25 -07:00
*/
2024-03-24 19:06:58 -07:00
PUBLIC_API_WEAK void boardTuneDefaults ( ) { }
2024-03-15 06:07:04 -07:00
2022-01-09 22:47:06 -08:00
// Weak link a stub so that every board doesn't have to implement this function
2024-03-24 19:06:58 -07:00
PUBLIC_API_WEAK void boardOnConfigurationChange ( engine_configuration_s * /*previousConfiguration*/ ) { }
2022-01-09 22:47:06 -08:00
2016-09-13 17:03:14 -07:00
/**
* this is the top - level method which should be called in case of any changes to engine configuration
* online tuning of most values in the maps does not count as configuration change , but ' Burn ' command does
2019-10-30 17:51:20 -07:00
*
* this method is NOT currently invoked on ECU start - actual user input has to happen !
2023-09-25 09:49:44 -07:00
* See ' preCalculate ' or ' startHardware ' which are invoked BOTH on start and configuration change
2016-09-13 17:03:14 -07:00
*/
2023-04-19 19:09:48 -07:00
void incrementGlobalConfigurationVersion ( const char * msg ) {
2023-06-24 23:21:38 -07:00
assertStackVoid ( " increment " , ObdCode : : STACK_USAGE_MISC , EXPECTED_REMAINING_STACK ) ;
2023-04-19 17:29:33 -07:00
if ( ! hasRememberedConfiguration ) {
2023-08-20 19:23:44 -07:00
criticalError ( " too early to invoke incrementGlobalConfigurationVersion %s " , msg ) ;
2023-04-19 17:29:33 -07:00
}
2021-11-17 10:45:10 -08:00
engine - > globalConfigurationVersion + + ;
2018-03-04 18:32:48 -08:00
# if EFI_DEFAILED_LOGGING
2021-04-19 05:11:59 -07:00
efiPrintf ( " set globalConfigurationVersion=%d " , globalConfigurationVersion ) ;
2018-03-04 18:32:48 -08:00
# endif /* EFI_DEFAILED_LOGGING */
2021-07-14 22:28:44 -07:00
2021-11-16 01:15:29 -08:00
applyNewHardwareSettings ( ) ;
2021-07-14 22:28:44 -07:00
2022-01-09 22:47:06 -08:00
boardOnConfigurationChange ( & activeConfiguration ) ;
2021-11-16 01:15:29 -08:00
engine - > preCalculate ( ) ;
2020-02-02 00:56:21 -08:00
2019-04-12 19:07:03 -07:00
# if EFI_ELECTRONIC_THROTTLE_BODY
2017-05-27 20:01:41 -07:00
onConfigurationChangeElectronicThrottleCallback ( & activeConfiguration ) ;
# endif /* EFI_ELECTRONIC_THROTTLE_BODY */
2022-01-03 00:35:26 -08:00
# if EFI_ENGINE_CONTROL && EFI_PROD_CODE
onConfigurationChangeBenchTest ( ) ;
# endif
2019-04-12 19:07:03 -07:00
# if EFI_SHAFT_POSITION_INPUT
2021-11-16 01:15:29 -08:00
onConfigurationChangeTriggerCallback ( ) ;
2017-06-26 11:31:10 -07:00
# endif /* EFI_SHAFT_POSITION_INPUT */
2021-06-25 08:50:23 -07:00
# if EFI_EMULATE_POSITION_SENSORS && ! EFI_UNIT_TEST
2017-12-17 12:41:58 -08:00
onConfigurationChangeRpmEmulatorCallback ( & activeConfiguration ) ;
# endif /* EFI_EMULATE_POSITION_SENSORS */
2018-02-03 08:42:50 -08:00
2021-11-17 10:45:10 -08:00
engine - > engineModules . apply_all ( [ ] ( auto & m ) {
2021-11-17 09:13:19 -08:00
m . onConfigurationChange ( & activeConfiguration ) ;
} ) ;
2021-11-16 01:15:29 -08:00
rememberCurrentConfiguration ( ) ;
2015-07-10 06:01:56 -07:00
}
/**
* @ brief Sets the same dwell time across the whole getRpm ( ) range
2019-11-05 20:17:44 -08:00
* set dwell X
2015-07-10 06:01:56 -07:00
*/
2021-11-16 01:15:29 -08:00
void setConstantDwell ( floatms_t dwellMs ) {
2015-07-10 06:01:56 -07:00
for ( int i = 0 ; i < DWELL_CURVE_SIZE ; i + + ) {
2022-05-01 20:43:43 -07:00
config - > sparkDwellRpmBins [ i ] = 1000 * i ;
2015-07-10 06:01:56 -07:00
}
2022-05-01 20:43:43 -07:00
setArrayValues ( config - > sparkDwellValues , dwellMs ) ;
2015-07-10 06:01:56 -07:00
}
2021-11-16 01:15:29 -08:00
void setFuelTablesLoadBin ( float minValue , float maxValue ) {
2019-11-22 20:27:24 -08:00
setLinearCurve ( config - > injPhaseLoadBins , minValue , maxValue , 1 ) ;
setLinearCurve ( config - > veLoadBins , minValue , maxValue , 1 ) ;
2020-10-26 15:15:17 -07:00
setLinearCurve ( config - > lambdaLoadBins , minValue , maxValue , 1 ) ;
2015-07-10 06:01:56 -07:00
}
2021-11-16 01:15:29 -08:00
void setWholeIatCorrTimingTable ( float value ) {
2021-05-09 11:37:16 -07:00
setTable ( config - > ignitionIatCorrTable , value ) ;
2015-07-10 06:01:56 -07:00
}
/**
* See also crankingTimingAngle
*/
2024-04-29 11:57:56 -07:00
void setWholeTimingTable ( angle_t value ) {
2021-05-09 11:37:16 -07:00
setTable ( config - > ignitionTable , value ) ;
2015-07-10 06:01:56 -07:00
}
2023-11-05 12:55:29 -08:00
# if EFI_ENGINE_CONTROL
2024-07-26 07:55:25 -07:00
namespace {
void initTemperatureCurve (
float * const bins ,
float * const values ,
const int size ,
const float defaultValue ,
2024-07-26 08:09:06 -07:00
const float initialTemperature = - 40.0f ,
const float temperatureStep = 10.0f
2024-07-26 07:55:25 -07:00
) {
for ( int i = 0 ; i < size ; i + + ) {
bins [ i ] = initialTemperature + i * temperatureStep ;
values [ i ] = defaultValue ; // this correction is a multiplier
}
}
2024-07-26 08:09:06 -07:00
2024-07-31 05:10:09 -07:00
void initBoostTemperatureCurve ( float * const bins , float * const values , const float defaultValue ) {
initTemperatureCurve ( bins , values , BOOST_CURVE_SIZE , defaultValue , 20.0f , 20.0f ) ;
2024-07-26 08:09:06 -07:00
}
2015-07-10 06:01:56 -07:00
}
2023-11-05 12:55:29 -08:00
# endif // EFI_ENGINE_CONTROL
2015-07-10 06:01:56 -07:00
2023-11-01 07:09:04 -07:00
void prepareVoidConfiguration ( engine_configuration_s * p_engineConfiguration ) {
2024-07-23 10:02:06 -07:00
criticalAssertVoid ( p_engineConfiguration ! = nullptr , " ec NULL " ) ;
2023-11-01 07:09:04 -07:00
efi : : clear ( p_engineConfiguration ) ;
2015-07-10 06:01:56 -07:00
2023-11-01 07:09:04 -07:00
p_engineConfiguration - > clutchDownPinMode = PI_PULLUP ;
p_engineConfiguration - > clutchUpPinMode = PI_PULLUP ;
p_engineConfiguration - > brakePedalPinMode = PI_PULLUP ;
2015-12-02 17:10:06 -08:00
}
2015-07-10 06:01:56 -07:00
2021-11-16 01:15:29 -08:00
void setDefaultBasePins ( ) {
2019-04-12 19:07:03 -07:00
# if EFI_PROD_CODE
2017-12-24 10:45:03 -08:00
// call overrided board-specific serial configuration setup, if needed (for custom boards only)
// needed also by bootloader code
setPinConfigurationOverrides ( ) ;
2019-04-21 11:00:19 -07:00
# endif /* EFI_PROD_CODE */
2015-07-10 06:01:56 -07:00
2019-07-24 18:24:39 -07:00
// set UART pads configuration based on the board
2017-05-30 10:50:33 -07:00
// needed also by bootloader code
2023-02-19 11:53:14 -08:00
# ifdef TS_SECONDARY_UxART_PORT
2022-04-28 14:32:39 -07:00
engineConfiguration - > binarySerialTxPin = Gpio : : C10 ;
engineConfiguration - > binarySerialRxPin = Gpio : : C11 ;
2023-02-19 11:53:14 -08:00
# endif // TS_SECONDARY_UxART_PORT
2019-12-11 14:48:55 -08:00
engineConfiguration - > tunerStudioSerialSpeed = TS_DEFAULT_SPEED ;
2017-05-30 10:50:33 -07:00
engineConfiguration - > uartConsoleSerialSpeed = 115200 ;
}
// needed also by bootloader code
2019-04-21 11:00:19 -07:00
// at the moment bootloader does NOT really need SD card, this is a step towards future bootloader SD card usage
2021-11-16 01:15:29 -08:00
void setDefaultSdCardParameters ( ) {
2019-12-11 14:48:55 -08:00
engineConfiguration - > isSdCardEnabled = true ;
2017-05-30 10:50:33 -07:00
}
2023-11-05 12:55:29 -08:00
# if EFI_ENGINE_CONTROL
2021-11-16 01:15:29 -08:00
static void setDefaultWarmupIdleCorrection ( ) {
2019-06-13 06:05:22 -07:00
initTemperatureCurve ( CLT_MANUAL_IDLE_CORRECTION , 1.0 ) ;
2017-05-11 15:58:13 -07:00
2017-05-11 19:58:06 -07:00
float baseIdle = 30 ;
2019-06-13 06:05:22 -07:00
setCurveValue ( CLT_MANUAL_IDLE_CORRECTION , - 40 , 1.5 ) ;
setCurveValue ( CLT_MANUAL_IDLE_CORRECTION , - 30 , 1.5 ) ;
setCurveValue ( CLT_MANUAL_IDLE_CORRECTION , - 20 , 40.0 / baseIdle ) ;
setCurveValue ( CLT_MANUAL_IDLE_CORRECTION , - 10 , 40.0 / baseIdle ) ;
setCurveValue ( CLT_MANUAL_IDLE_CORRECTION , 0 , 40.0 / baseIdle ) ;
setCurveValue ( CLT_MANUAL_IDLE_CORRECTION , 10 , 40.0 / baseIdle ) ;
setCurveValue ( CLT_MANUAL_IDLE_CORRECTION , 20 , 40.0 / baseIdle ) ;
setCurveValue ( CLT_MANUAL_IDLE_CORRECTION , 30 , 40.0 / baseIdle ) ;
setCurveValue ( CLT_MANUAL_IDLE_CORRECTION , 40 , 40.0 / baseIdle ) ;
setCurveValue ( CLT_MANUAL_IDLE_CORRECTION , 50 , 37.0 / baseIdle ) ;
setCurveValue ( CLT_MANUAL_IDLE_CORRECTION , 60 , 35.0 / baseIdle ) ;
setCurveValue ( CLT_MANUAL_IDLE_CORRECTION , 70 , 33.0 / baseIdle ) ;
2017-05-11 15:58:13 -07:00
}
2018-01-07 09:11:49 -08:00
/**
* see also setTargetRpmCurve ( )
*/
2021-11-16 01:15:29 -08:00
static void setDefaultIdleSpeedTarget ( ) {
2024-09-04 20:36:23 -07:00
# if CLT_CURVE_SIZE == 16
2022-06-29 15:48:30 -07:00
copyArray ( config - > cltIdleRpmBins , { - 30 , - 20 , - 10 , 0 , 10 , 20 , 30 , 40 , 50 , 60 , 70 , 80 , 90 , 100 , 110 , 120 } ) ;
copyArray ( config - > cltIdleRpm , { 1350 , 1350 , 1300 , 1200 , 1150 , 1100 , 1050 , 1000 , 1000 , 950 , 950 , 930 , 900 , 900 , 1000 , 1100 } ) ;
2024-09-04 20:36:23 -07:00
# endif // CLT_CURVE_SIZE
2017-05-11 16:03:31 -07:00
}
2023-11-05 12:55:29 -08:00
# endif // EFI_ENGINE_CONTROL
2017-05-11 16:03:31 -07:00
2018-01-07 09:11:49 -08:00
/**
* see also setDefaultIdleSpeedTarget ( )
*/
2024-09-25 21:34:00 -07:00
void setTargetRpmCurve ( float rpm ) {
2022-05-01 20:43:43 -07:00
setLinearCurve ( config - > cltIdleRpmBins , CLT_CURVE_RANGE_FROM , 140 , 10 ) ;
setLinearCurve ( config - > cltIdleRpm , rpm , rpm , 10 ) ;
2017-12-24 19:05:16 -08:00
}
2023-12-12 19:05:29 -08:00
static void setDefaultGppwmParameters ( ) {
2020-04-26 11:06:28 -07:00
// Same config for all channels
2021-11-17 00:54:21 -08:00
for ( size_t i = 0 ; i < efi : : size ( engineConfiguration - > gppwm ) ; i + + ) {
auto & cfg = engineConfiguration - > gppwm [ i ] ;
2022-10-13 17:30:30 -07:00
chsnprintf ( engineConfiguration - > gpPwmNote [ i ] , sizeof ( engineConfiguration - > gpPwmNote [ 0 ] ) , " GPPWM%d " , i ) ;
2020-04-26 11:06:28 -07:00
2023-02-06 04:53:31 -08:00
// Set default axes
cfg . loadAxis = GPPWM_Zero ;
cfg . rpmAxis = GPPWM_Rpm ;
2022-04-28 14:32:39 -07:00
cfg . pin = Gpio : : Unassigned ;
2020-04-26 11:06:28 -07:00
cfg . dutyIfError = 0 ;
cfg . onAboveDuty = 60 ;
cfg . offBelowDuty = 50 ;
cfg . pwmFrequency = 250 ;
for ( size_t j = 0 ; j < efi : : size ( cfg . loadBins ) ; j + + ) {
uint8_t z = j * 100 / ( efi : : size ( cfg . loadBins ) - 1 ) ;
cfg . loadBins [ j ] = z ;
// Fill some values in the table
for ( size_t k = 0 ; k < efi : : size ( cfg . rpmBins ) ; k + + ) {
cfg . table [ j ] [ k ] = z ;
}
2020-09-07 12:55:43 -07:00
2020-04-26 11:06:28 -07:00
}
for ( size_t j = 0 ; j < efi : : size ( cfg . rpmBins ) ; j + + ) {
2021-12-22 05:09:41 -08:00
cfg . rpmBins [ j ] = 1000 * j ;
2020-04-26 11:06:28 -07:00
}
}
}
2024-05-11 06:29:50 -07:00
static void setDefaultBoostOpenLoopParameters ( ) {
engineConfiguration - > boostOpenLoopYAxis = GPPWM_Tps ;
}
2023-11-05 12:55:29 -08:00
# if EFI_ENGINE_CONTROL
2021-11-16 01:15:29 -08:00
static void setDefaultEngineNoiseTable ( ) {
2024-03-17 12:06:14 -07:00
setRpmTableBin ( config - > knockNoiseRpmBins ) ;
2021-03-30 07:56:25 -07:00
2021-08-09 14:07:38 -07:00
engineConfiguration - > knockSamplingDuration = 45 ;
2024-03-17 12:06:14 -07:00
setArrayValues ( config - > knockBaseNoise , - 20 ) ;
2021-03-30 07:56:25 -07:00
}
2023-11-05 12:55:29 -08:00
# endif // EFI_ENGINE_CONTROL
2021-03-30 07:56:25 -07:00
2023-12-12 19:05:29 -08:00
static void setDefaultCanSettings ( ) {
// OBD-II default rate is 500kbps
engineConfiguration - > canBaudRate = B500KBPS ;
engineConfiguration - > can2BaudRate = B500KBPS ;
engineConfiguration - > canSleepPeriodMs = 50 ;
engineConfiguration - > canReadEnabled = true ;
engineConfiguration - > canWriteEnabled = true ;
engineConfiguration - > canVssScaling = 1.0f ;
// Don't enable, but set default address
engineConfiguration - > verboseCanBaseAddress = CAN_DEFAULT_BASE ;
}
static void setDefaultScriptParameters ( ) {
setLinearCurve ( config - > scriptTable1LoadBins , 20 , 120 , 10 ) ;
setRpmTableBin ( config - > scriptTable1RpmBins ) ;
setLinearCurve ( config - > scriptTable2LoadBins , 20 , 120 , 10 ) ;
setRpmTableBin ( config - > scriptTable2RpmBins ) ;
setLinearCurve ( config - > scriptTable3LoadBins , 20 , 120 , 10 ) ;
setRpmTableBin ( config - > scriptTable3RpmBins ) ;
setLinearCurve ( config - > scriptTable4LoadBins , 20 , 120 , 10 ) ;
setRpmTableBin ( config - > scriptTable4RpmBins ) ;
}
2015-07-10 06:01:56 -07:00
/**
* @ brief Global default engine configuration
2015-09-26 06:01:32 -07:00
* This method sets the global engine configuration defaults . These default values are then
* overridden by engine - specific defaults and the settings are saved in flash memory .
*
* This method is invoked only when new configuration is needed :
* * recently re - flashed chip
* * flash version of configuration failed CRC check or appears to be older then FLASH_DATA_VERSION
* * ' rewriteconfig ' command
2017-01-06 07:04:41 -08:00
* * ' set engine_type X ' command
2015-12-21 17:02:32 -08:00
*
* This method should only change the state of the configuration data structure but should NOT change the state of
* anything else .
2019-07-24 18:15:18 -07:00
*
* This method should NOT be setting any default pinout
2015-07-10 06:01:56 -07:00
*/
2021-11-16 01:15:29 -08:00
static void setDefaultEngineConfiguration ( ) {
2019-04-12 19:07:03 -07:00
# if (! EFI_UNIT_TEST)
2021-05-20 17:00:32 -07:00
efi : : clear ( persistentState . persistentConfiguration ) ;
2015-07-10 06:01:56 -07:00
# endif
prepareVoidConfiguration ( engineConfiguration ) ;
2023-12-12 19:05:29 -08:00
# if EFI_BOOST_CONTROL
setDefaultBoostParameters ( ) ;
# endif
setDefaultCanSettings ( ) ;
engineConfiguration - > sdCardLogFrequency = 50 ;
setDefaultGppwmParameters ( ) ;
2024-05-11 06:29:50 -07:00
setDefaultBoostOpenLoopParameters ( ) ;
2023-12-12 19:05:29 -08:00
setDefaultScriptParameters ( ) ;
# if EFI_ENGINE_CONTROL
2021-11-16 01:15:29 -08:00
setDefaultBaseEngine ( ) ;
setDefaultFuel ( ) ;
setDefaultIgnition ( ) ;
setDefaultCranking ( ) ;
2019-07-24 18:15:18 -07:00
2021-10-29 09:16:19 -07:00
// VVT closed loop, totally random values!
engineConfiguration - > auxPid [ 0 ] . pFactor = 2 ;
engineConfiguration - > auxPid [ 0 ] . iFactor = 0.005 ;
engineConfiguration - > auxPid [ 0 ] . dFactor = 0 ;
engineConfiguration - > auxPid [ 0 ] . offset = 33 ;
engineConfiguration - > auxPid [ 0 ] . minValue = 10 ;
engineConfiguration - > auxPid [ 0 ] . maxValue = 90 ;
2023-11-06 08:14:19 -08:00
engineConfiguration - > vvtOutputFrequency = DEFAULT_SOLENOID_FREQUENCY ; // VVT solenoid control
2021-10-29 09:16:19 -07:00
2021-11-24 20:32:55 -08:00
engineConfiguration - > isCylinderCleanupEnabled = true ;
2023-12-12 19:05:29 -08:00
engineConfiguration - > auxPid [ 0 ] . minValue = 10 ;
engineConfiguration - > auxPid [ 0 ] . maxValue = 90 ;
2021-10-29 09:16:19 -07:00
engineConfiguration - > auxPid [ 1 ] . minValue = 10 ;
2021-11-19 22:38:39 -08:00
engineConfiguration - > auxPid [ 1 ] . maxValue = 90 ;
2021-10-29 09:16:19 -07:00
2021-11-04 16:35:58 -07:00
engineConfiguration - > turboSpeedSensorMultiplier = 1 ;
2021-10-29 09:16:19 -07:00
2019-08-29 20:50:20 -07:00
# if EFI_IDLE_CONTROL
2021-11-16 01:15:29 -08:00
setDefaultIdleParameters ( ) ;
2019-08-29 20:50:20 -07:00
# endif /* EFI_IDLE_CONTROL */
2019-07-24 18:15:18 -07:00
# if EFI_ELECTRONIC_THROTTLE_BODY
2021-11-16 01:15:29 -08:00
setDefaultEtbParameters ( ) ;
setDefaultEtbBiasCurve ( ) ;
2019-07-24 18:15:18 -07:00
# endif /* EFI_ELECTRONIC_THROTTLE_BODY */
2020-09-01 19:24:25 -07:00
2021-11-17 00:54:21 -08:00
engineConfiguration - > mafSensorType = Bosch0280218037 ;
2023-11-01 14:12:46 -07:00
setBosch0280218037 ( ) ;
2015-07-10 06:01:56 -07:00
2021-11-17 00:54:21 -08:00
engineConfiguration - > mapMinBufferLength = 1 ;
2022-04-10 16:11:34 -07:00
engineConfiguration - > vvtActivationDelayMs = 6000 ;
2023-12-12 19:05:29 -08:00
2021-11-17 00:54:21 -08:00
engineConfiguration - > startCrankingDuration = 3 ;
2020-03-24 21:58:59 -07:00
2021-07-04 06:22:42 -07:00
engineConfiguration - > maxAcRpm = 5000 ;
engineConfiguration - > maxAcClt = 100 ;
engineConfiguration - > maxAcTps = 75 ;
2015-07-10 06:01:56 -07:00
2017-06-11 12:17:02 -07:00
initTemperatureCurve ( IAT_FUEL_CORRECTION_CURVE , 1 ) ;
2015-07-10 06:01:56 -07:00
2024-07-31 05:10:09 -07:00
initBoostTemperatureCurve ( config - > cltBoostCorrBins , config - > cltBoostCorr , 1.0f ) ;
initBoostTemperatureCurve ( config - > iatBoostCorrBins , config - > iatBoostCorr , 1.0f ) ;
initBoostTemperatureCurve ( config - > cltBoostAdderBins , config - > cltBoostAdder , 0.0f ) ;
initBoostTemperatureCurve ( config - > iatBoostAdderBins , config - > iatBoostAdder , 0.0f ) ;
2024-07-26 08:09:06 -07:00
2022-04-10 16:11:34 -07:00
engineConfiguration - > alternatorControl . minValue = 0 ;
2017-05-28 19:32:32 -07:00
engineConfiguration - > alternatorControl . maxValue = 90 ;
2017-04-10 11:59:21 -07:00
2022-05-01 20:43:43 -07:00
setLinearCurve ( config - > scriptCurve1Bins , 0 , 100 , 1 ) ;
setLinearCurve ( config - > scriptCurve1 , 0 , 100 , 1 ) ;
2017-11-27 18:49:58 -08:00
2023-06-06 16:26:21 -07:00
setLinearCurve ( config - > scriptCurve2Bins , 0 , 100 , /*precision*/ 1 ) ;
2022-05-01 20:43:43 -07:00
setLinearCurve ( config - > scriptCurve2 , 30 , 170 , 1 ) ;
2017-11-27 18:49:58 -08:00
2022-05-01 20:43:43 -07:00
setLinearCurve ( config - > scriptCurve3Bins , 0 , 100 , 1 ) ;
setLinearCurve ( config - > scriptCurve4Bins , 0 , 100 , 1 ) ;
setLinearCurve ( config - > scriptCurve5Bins , 0 , 100 , 1 ) ;
setLinearCurve ( config - > scriptCurve6Bins , 0 , 100 , 1 ) ;
2017-11-25 22:17:37 -08:00
2023-06-06 16:26:21 -07:00
setLinearCurve ( config - > alsIgnRetardLoadBins , 2 , 10 , /*precision*/ 1 ) ;
2022-12-21 18:29:01 -08:00
setRpmTableBin ( config - > alsIgnRetardrpmBins ) ;
2023-06-06 16:26:21 -07:00
setLinearCurve ( config - > alsFuelAdjustmentLoadBins , 2 , 10 , /*precision*/ 1 ) ;
2022-12-22 11:38:40 -08:00
setRpmTableBin ( config - > alsFuelAdjustmentrpmBins ) ;
2024-03-20 07:54:01 -07:00
setLinearCurve ( config - > fuelLevelBins , 0 , 5 ) ;
2022-12-21 18:29:01 -08:00
2021-11-16 01:15:29 -08:00
setDefaultWarmupIdleCorrection ( ) ;
2016-02-14 10:02:00 -08:00
2023-11-13 15:30:30 -08:00
setRpmTableBin ( engineConfiguration - > map . samplingAngleBins ) ;
2019-11-22 20:27:24 -08:00
setLinearCurve ( engineConfiguration - > map . samplingAngle , 100 , 130 , 1 ) ;
2023-11-13 15:30:30 -08:00
setRpmTableBin ( engineConfiguration - > map . samplingWindowBins ) ;
2019-11-22 20:27:24 -08:00
setLinearCurve ( engineConfiguration - > map . samplingWindow , 50 , 50 , 1 ) ;
2015-07-10 06:01:56 -07:00
2024-09-30 09:05:28 -07:00
# if VVT_TABLE_SIZE == 8
2021-02-10 09:41:38 -08:00
setLinearCurve ( config - > vvtTable1LoadBins , 20 , 120 , 10 ) ;
setLinearCurve ( config - > vvtTable2LoadBins , 20 , 120 , 10 ) ;
2024-09-30 09:05:28 -07:00
# else
setLinearCurve ( config - > vvtTable1LoadBins , 20 , 120 , 5 ) ;
setLinearCurve ( config - > vvtTable2LoadBins , 20 , 120 , 5 ) ;
# endif
setRpmTableBin ( config - > vvtTable1RpmBins ) ;
2022-12-13 13:47:35 -08:00
setRpmTableBin ( config - > vvtTable2RpmBins ) ;
2016-03-03 21:02:18 -08:00
2021-11-16 01:15:29 -08:00
setDefaultEngineNoiseTable ( ) ;
2016-01-01 14:02:49 -08:00
2023-06-12 16:33:05 -07:00
// is this same old setCommonNTCSensor?
2019-10-02 18:00:10 -07:00
engineConfiguration - > clt . config = { 0 , 23.8889 , 48.8889 , 9500 , 2100 , 1000 , 1500 } ;
2015-07-10 06:01:56 -07:00
2023-06-12 16:59:12 -07:00
setCommonNTCSensor ( & engineConfiguration - > iat , 2700 ) ;
2015-07-10 06:01:56 -07:00
2021-11-15 18:13:01 -08:00
// wow unit tests have much cooler setDefaultLaunchParameters method
2020-02-02 07:44:31 -08:00
engineConfiguration - > launchRpm = 3000 ;
2021-11-15 18:13:01 -08:00
// engineConfiguration->launchTimingRetard = 10;
2024-03-09 06:42:41 -08:00
engineConfiguration - > launchRpmWindow = 500 ;
2021-11-15 18:13:01 -08:00
engineConfiguration - > launchSpeedThreshold = 30 ;
2015-07-10 06:01:56 -07:00
2016-01-30 19:03:36 -08:00
engineConfiguration - > engineSnifferRpmThreshold = 2500 ;
engineConfiguration - > sensorSnifferRpmThreshold = 2500 ;
2016-07-01 07:02:58 -07:00
2018-01-07 09:11:49 -08:00
/**
* Idle control defaults
*/
2021-11-16 01:15:29 -08:00
setDefaultIdleSpeedTarget ( ) ;
// setTargetRpmCurve(1200);
2015-07-10 06:01:56 -07:00
2017-06-04 17:13:37 -07:00
engineConfiguration - > idleRpmPid . pFactor = 0.05 ;
engineConfiguration - > idleRpmPid . iFactor = 0.002 ;
2023-05-05 17:39:16 -07:00
engineConfiguration - > idleRpmPid . minValue = - 20 ;
engineConfiguration - > idleRpmPid . maxValue = 20 ;
2021-07-24 08:56:29 -07:00
/**
* between variation between different sensor and weather and fabrication tolerance
* five percent looks like a safer default
*/
engineConfiguration - > idlePidDeactivationTpsThreshold = 5 ;
2017-05-28 10:44:26 -07:00
2023-11-06 08:14:19 -08:00
engineConfiguration - > idle . solenoidFrequency = DEFAULT_SOLENOID_FREQUENCY ;
2018-01-07 09:11:49 -08:00
// set idle_position 50
2019-12-11 14:48:55 -08:00
engineConfiguration - > manIdlePosition = 50 ;
2018-01-07 09:11:49 -08:00
// engineConfiguration->idleMode = IM_AUTO;
engineConfiguration - > idleMode = IM_MANUAL ;
2015-07-10 06:01:56 -07:00
2019-12-11 14:48:55 -08:00
engineConfiguration - > useStepperIdle = false ;
2018-01-07 09:11:49 -08:00
2022-08-29 05:15:04 -07:00
setLinearCurve ( config - > iacCoastingRpmBins , 0 , 8000 , 1 ) ;
2019-06-17 09:18:55 -07:00
# if !EFI_UNIT_TEST
2018-01-07 09:11:49 -08:00
engineConfiguration - > analogInputDividerCoefficient = 2 ;
2019-06-17 09:18:55 -07:00
# endif
2018-01-07 09:11:49 -08:00
2015-07-10 06:01:56 -07:00
// performance optimization
2019-12-11 14:48:55 -08:00
engineConfiguration - > sensorChartMode = SC_OFF ;
2015-07-10 06:01:56 -07:00
2022-11-26 11:13:14 -08:00
setTPS1Calibration ( convertVoltageTo10bitADC ( 0 ) ,
convertVoltageTo10bitADC ( 5 ) ,
convertVoltageTo10bitADC ( 5 ) ,
convertVoltageTo10bitADC ( 0 ) ) ;
2020-05-10 13:13:15 -07:00
engineConfiguration - > tps2Min = convertVoltageTo10bitADC ( 0 ) ;
engineConfiguration - > tps2Max = convertVoltageTo10bitADC ( 5 ) ;
2022-11-26 11:13:14 -08:00
engineConfiguration - > tps2SecondaryMin = convertVoltageTo10bitADC ( 5 ) ;
engineConfiguration - > tps2SecondaryMax = convertVoltageTo10bitADC ( 0 ) ;
2020-11-14 15:05:27 -08:00
engineConfiguration - > idlePositionMin = PACK_MULT_VOLTAGE * 0 ;
engineConfiguration - > idlePositionMax = PACK_MULT_VOLTAGE * 5 ;
engineConfiguration - > wastegatePositionMin = PACK_MULT_VOLTAGE * 0 ;
engineConfiguration - > wastegatePositionMax = PACK_MULT_VOLTAGE * 5 ;
2016-01-08 08:01:40 -08:00
engineConfiguration - > tpsErrorDetectionTooLow = - 10 ; // -10% open
engineConfiguration - > tpsErrorDetectionTooHigh = 110 ; // 110% open
2015-07-10 06:01:56 -07:00
2017-11-15 11:30:13 -08:00
engineConfiguration - > oilPressure . v1 = 0.5f ;
engineConfiguration - > oilPressure . v2 = 4.5f ;
engineConfiguration - > oilPressure . value1 = 0 ;
engineConfiguration - > oilPressure . value2 = 689.476f ; // 100psi = 689.476kPa
2015-07-10 06:01:56 -07:00
2016-06-25 13:02:01 -07:00
engineConfiguration - > mapLowValueVoltage = 0 ;
// todo: start using this for custom MAP
engineConfiguration - > mapHighValueVoltage = 5 ;
2015-07-10 06:01:56 -07:00
engineConfiguration - > cylinderBore = 87.5 ;
2022-01-02 23:13:47 -08:00
setBoschHDEV_5_injectors ( ) ;
2021-11-16 01:15:29 -08:00
setEgoSensor ( ES_14Point7_Free ) ;
2015-07-10 06:01:56 -07:00
2017-06-12 05:41:32 -07:00
engineConfiguration - > adcVcc = 3.0 ;
2015-07-10 06:01:56 -07:00
engineConfiguration - > map . sensor . type = MT_MPX4250 ;
engineConfiguration - > baroSensor . type = MT_CUSTOM ;
2016-06-25 16:03:02 -07:00
engineConfiguration - > baroSensor . lowValue = 0 ;
engineConfiguration - > baroSensor . highValue = 500 ;
2015-07-10 06:01:56 -07:00
2019-04-12 19:07:03 -07:00
# if EFI_PROD_CODE
2015-07-10 06:01:56 -07:00
engineConfiguration - > engineChartSize = 300 ;
# else
// need more events for automated test
engineConfiguration - > engineChartSize = 400 ;
# endif
engineConfiguration - > isMapAveragingEnabled = true ;
engineConfiguration - > isWaveAnalyzerEnabled = true ;
2023-10-22 10:50:43 -07:00
engineConfiguration - > acIdleRpmTarget = 900 ;
2024-08-23 07:36:53 -07:00
engineConfiguration - > acDelay = engine_configuration_defaults : : AC_DELAY ;
engineConfiguration - > minAcPressure = engine_configuration_defaults : : MIN_AC_PRESSURE ;
engineConfiguration - > maxAcPressure = engine_configuration_defaults : : MAX_AC_PRESSURE ;
2024-08-23 07:17:36 -07:00
engineConfiguration - > acPressureEnableHyst = engine_configuration_defaults : : AC_PRESSURE_ENABLE_HYST ;
2023-06-19 07:12:18 -07:00
engineConfiguration - > acIdleExtraOffset = 15 ;
2021-05-08 15:43:55 -07:00
/* these two are used for HIP9011 only
* Currently this is offset from fire event , not TDC */
/* TODO: convert to offset from TDC */
engineConfiguration - > knockDetectionWindowStart = 15.0 + 5.0 ;
engineConfiguration - > knockDetectionWindowEnd = 15.0 + 45.0 ;
2015-07-10 06:01:56 -07:00
2023-10-25 15:49:23 -07:00
engineConfiguration - > triggerSimulatorRpm = DEFAULT_SELT_STIM_RPM ;
engineConfiguration - > simulatorCamPosition [ 0 ] = DEFAULT_SELT_STIM_VVT0 ;
2015-07-10 06:01:56 -07:00
2023-11-06 08:14:19 -08:00
engineConfiguration - > alternatorPwmFrequency = DEFAULT_SOLENOID_FREQUENCY ;
2015-07-10 06:01:56 -07:00
2019-08-01 19:27:23 -07:00
engineConfiguration - > isAlternatorControlEnabled = false ;
2015-07-10 06:01:56 -07:00
2023-03-16 07:37:27 -07:00
engineConfiguration - > driveWheelRevPerKm = 1000 ;
2023-03-15 19:38:15 -07:00
engineConfiguration - > finalGearRatio = 1 ;
2021-11-27 05:49:07 -08:00
engineConfiguration - > vssGearRatio = 3.73 ;
engineConfiguration - > vssToothCount = 21 ;
2015-07-10 06:01:56 -07:00
2016-01-08 08:01:40 -08:00
engineConfiguration - > mapErrorDetectionTooLow = 5 ;
2022-04-03 15:48:23 -07:00
// todo: default limits should be hard-coded for each sensor type
// https://github.com/rusefi/rusefi/issues/4030
engineConfiguration - > mapErrorDetectionTooHigh = 410 ;
2015-08-30 13:02:00 -07:00
2023-03-13 13:25:45 -07:00
setLinearCurve ( config - > throttleEstimateEffectiveAreaBins , 0 , 100 ) ;
2019-01-04 14:18:43 -08:00
engineConfiguration - > hip9011Gain = 1 ;
2020-02-24 16:08:02 -08:00
# endif // EFI_ENGINE_CONTROL
2022-12-20 11:48:24 -08:00
# include "default_script.lua"
2015-07-10 06:01:56 -07:00
}
2023-07-23 23:07:29 -07:00
# if defined(STM32F7) && defined(HARDWARE_CI)
// part of F7 drama looks like we are having a hard time erasing configuration on HW CI :(
# define IGNORE_FLASH_CONFIGURATION true
# endif
2021-03-25 15:16:26 -07:00
// by default, do not ignore config from flash! use it!
# ifndef IGNORE_FLASH_CONFIGURATION
# define IGNORE_FLASH_CONFIGURATION false
# endif
2021-11-16 01:15:29 -08:00
void loadConfiguration ( ) {
2021-03-25 15:16:26 -07:00
2021-03-30 04:28:22 -07:00
# if ! EFI_ACTIVE_CONFIGURATION_IN_FLASH
// Clear the active configuration so that registered output pins (etc) detect the change on startup and init properly
prepareVoidConfiguration ( & activeConfiguration ) ;
# endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */
2023-11-03 10:08:35 -07:00
/* If board have any storage */
2024-05-05 12:52:39 -07:00
# if EFI_CONFIGURATION_STORAGE
2023-07-23 23:05:14 -07:00
if ( IGNORE_FLASH_CONFIGURATION ) {
2023-06-18 08:05:44 -07:00
engineConfiguration - > engineType = DEFAULT_ENGINE_TYPE ;
2021-11-16 01:15:29 -08:00
resetConfigurationExt ( engineConfiguration - > engineType ) ;
2021-03-25 15:16:26 -07:00
writeToFlashNow ( ) ;
} else {
// this call reads configuration from flash memory or sets default configuration
// if flash state does not look right.
readFromFlash ( ) ;
}
2023-11-03 10:08:35 -07:00
# else
2021-03-25 15:16:26 -07:00
// This board doesn't load configuration, initialize the default
2023-06-18 08:05:44 -07:00
engineConfiguration - > engineType = DEFAULT_ENGINE_TYPE ;
2021-11-16 01:15:29 -08:00
resetConfigurationExt ( engineConfiguration - > engineType ) ;
2024-05-05 12:52:39 -07:00
# endif /* EFI_CONFIGURATION_STORAGE */
2021-03-31 11:46:50 -07:00
// Force any board configuration options that humans shouldn't be able to change
setBoardConfigOverrides ( ) ;
2021-03-25 15:16:26 -07:00
}
2021-11-16 01:15:29 -08:00
void resetConfigurationExt ( configuration_callback_t boardCallback , engine_type_e engineType ) {
2016-11-03 14:03:11 -07:00
enginePins . reset ( ) ; // that's mostly important for functional tests
2015-07-10 06:01:56 -07:00
/**
* Let ' s apply global defaults first
*/
2021-11-16 01:15:29 -08:00
setDefaultEngineConfiguration ( ) ;
2019-07-24 19:00:48 -07:00
2024-03-10 10:58:25 -07:00
/**
* custom board engine defaults . Yes , this overlaps with ( older ) engine_type_e approach .
*/
boardTuneDefaults ( ) ;
2019-07-24 19:00:48 -07:00
// set initial pin groups
2021-11-16 01:15:29 -08:00
setDefaultBasePins ( ) ;
2019-07-24 19:00:48 -07:00
2020-09-21 09:29:01 -07:00
if ( boardCallback ! = nullptr ) {
boardCallback ( engineConfiguration ) ;
}
2019-08-08 18:27:57 -07:00
2019-04-16 07:27:34 -07:00
# if EFI_PROD_CODE
// call overrided board-specific configuration setup, if needed (for custom boards only)
2021-03-22 11:15:09 -07:00
setBoardDefaultConfiguration ( ) ;
2021-03-31 11:46:50 -07:00
setBoardConfigOverrides ( ) ;
2023-07-19 18:51:38 -07:00
# endif // EFI_PROD_CODE
2019-04-16 07:27:34 -07:00
2015-07-10 06:01:56 -07:00
engineConfiguration - > engineType = engineType ;
2024-10-07 13:52:42 -07:00
applyEngineType ( engineType ) ;
2021-11-16 01:15:29 -08:00
applyNonPersistentConfiguration ( ) ;
2015-07-10 06:01:56 -07:00
}
2023-11-01 07:09:04 -07:00
void emptyCallbackWithConfiguration ( engine_configuration_s * p_engineConfiguration ) {
UNUSED ( p_engineConfiguration ) ;
2019-08-08 18:27:57 -07:00
}
2021-11-16 01:15:29 -08:00
void resetConfigurationExt ( engine_type_e engineType ) {
resetConfigurationExt ( & emptyCallbackWithConfiguration , engineType ) ;
2019-08-08 18:27:57 -07:00
}
2021-11-16 01:15:29 -08:00
void applyNonPersistentConfiguration ( ) {
2019-04-12 19:07:03 -07:00
# if EFI_PROD_CODE
2023-06-24 23:08:53 -07:00
efiAssertVoid ( ObdCode : : CUSTOM_APPLY_STACK , hasLotsOfRemainingStack ( ) , " apply c " ) ;
2021-04-21 09:53:13 -07:00
efiPrintf ( " applyNonPersistentConfiguration() " ) ;
2018-02-03 08:42:50 -08:00
# endif
2019-04-12 19:07:03 -07:00
# if EFI_ENGINE_CONTROL
2022-04-02 16:27:18 -07:00
engine - > updateTriggerWaveform ( ) ;
2020-05-22 15:07:19 -07:00
# endif // EFI_ENGINE_CONTROL
2015-07-10 06:01:56 -07:00
}
2022-04-02 23:21:37 -07:00
void setTwoStrokeOperationMode ( ) {
engineConfiguration - > twoStroke = true ;
2015-07-10 06:01:56 -07:00
}
2022-04-02 23:21:37 -07:00
void setCamOperationMode ( ) {
2022-04-02 21:43:28 -07:00
engineConfiguration - > skippedWheelOnCam = true ;
}
2022-04-02 23:21:37 -07:00
void setCrankOperationMode ( ) {
2022-04-02 21:43:28 -07:00
engineConfiguration - > skippedWheelOnCam = false ;
2022-04-02 21:34:18 -07:00
}
2023-02-10 16:09:39 -08:00
void commonFrankensoAnalogInputs ( ) {
2015-07-10 06:01:56 -07:00
/**
* VBatt
*/
engineConfiguration - > vbattAdcChannel = EFI_ADC_14 ;
}
2021-03-31 11:46:50 -07:00
// These symbols are weak so that a board_configuration.cpp file can override them
2024-07-27 09:36:35 -07:00
PUBLIC_API_WEAK void setBoardDefaultConfiguration ( ) { }
2024-01-06 15:51:18 -08:00
// specific firmware builds are meant for specific hardware. In order to provide best user experience on well-known boards sometimes we reduce user flexibility.
2024-07-27 09:36:35 -07:00
PUBLIC_API_WEAK_SOMETHING_WEIRD void setBoardConfigOverrides ( ) { }
2022-09-29 17:54:13 -07:00
2024-07-27 09:36:35 -07:00
PUBLIC_API_WEAK int hackHellenBoardId ( int detectedId ) { return detectedId ; }
2023-12-14 13:43:25 -08:00
2024-07-27 09:36:35 -07:00
PUBLIC_API_WEAK void onBoardStandBy ( ) { }
2023-05-12 15:13:27 -07:00
2024-07-27 09:36:35 -07:00
PUBLIC_API_WEAK_SOMETHING_WEIRD int getBoardMetaOutputsCount ( ) { return 0 ; }
2023-08-29 18:23:30 -07:00
// default implementation: treat all outputs as low side
2024-07-27 09:36:35 -07:00
PUBLIC_API_WEAK int getBoardMetaLowSideOutputsCount ( ) { return getBoardMetaOutputsCount ( ) ; }
PUBLIC_API_WEAK Gpio * getBoardMetaOutputs ( ) { return nullptr ; }
PUBLIC_API_WEAK int getBoardMetaDcOutputsCount ( ) { return 0 ; }