diff --git a/firmware/controllers/actuators/dc_motors.h b/firmware/controllers/actuators/dc_motors.h index 1c20cdef9b..0f2933ce89 100644 --- a/firmware/controllers/actuators/dc_motors.h +++ b/firmware/controllers/actuators/dc_motors.h @@ -51,13 +51,13 @@ public: DcHardware() : dcMotor(m_disablePin) {} void start(bool useTwoWires, - brain_pin_e pinEnable, - brain_pin_e pinDir1, - brain_pin_e pinDir2, - brain_pin_e pinDisable, - bool isInverted, - ExecutorInterface* executor, - int frequency); + brain_pin_e pinEnable, + brain_pin_e pinDir1, + brain_pin_e pinDir2, + brain_pin_e pinDisable, + bool isInverted, + ExecutorInterface* executor, + int frequency); TwoPinDcMotor dcMotor; diff --git a/firmware/controllers/actuators/electronic_throttle.cpp b/firmware/controllers/actuators/electronic_throttle.cpp index 0416b0b510..2206a545ac 100644 --- a/firmware/controllers/actuators/electronic_throttle.cpp +++ b/firmware/controllers/actuators/electronic_throttle.cpp @@ -222,9 +222,9 @@ void EtbController::onConfigurationChange(pid_s* previousConfiguration) { if (m_motor && !m_pid.isSame(previousConfiguration)) { m_shouldResetPid = true; } - m_dutyRocAverage.init(engineConfiguration->etbRocExpAverageLength); - m_dutyAverage.init(engineConfiguration->etbExpAverageLength); - doInitElectronicThrottle(); + m_dutyRocAverage.init(engineConfiguration->etbRocExpAverageLength); + m_dutyAverage.init(engineConfiguration->etbExpAverageLength); + doInitElectronicThrottle(); } void EtbController::showStatus() { @@ -297,9 +297,9 @@ expected EtbController::getSetpointEtb() { percent_t targetPosition = idlePosition + getLuaAdjustment(); #if EFI_ANTILAG_SYSTEM - if (engine->antilagController.isAntilagCondition) { - targetPosition += engineConfiguration->ALSEtbAdd; - } + if (engine->antilagController.isAntilagCondition) { + targetPosition += engineConfiguration->ALSEtbAdd; + } #endif /* EFI_ANTILAG_SYSTEM */ // Apply any adjustment that this throttle alone needs @@ -376,7 +376,7 @@ expected EtbController::getOpenLoop(percent_t target) { if (m_function != DC_Wastegate) { etbFeedForward = interpolate2d(target, config->etbBiasBins, config->etbBiasValues); } else { - etbFeedForward = 0; + etbFeedForward = 0; } return etbFeedForward; @@ -541,10 +541,10 @@ bool EtbController::checkStatus() { #endif /* EFI_TUNER_STUDIO */ if (!isEtbMode()) { - // no validation for h-bridge or idle mode - return true; - } - // ETB-specific code belo. The whole mix-up between DC and ETB is shameful :( + // no validation for h-bridge or idle mode + return true; + } + // ETB-specific code belo. The whole mix-up between DC and ETB is shameful :( m_pid.iTermMin = engineConfiguration->etb_iTermMin; m_pid.iTermMax = engineConfiguration->etb_iTermMax; @@ -596,7 +596,7 @@ bool EtbController::checkStatus() { etbErrorCode = (int8_t)localReason; - return localReason == TpsState::None; + return localReason == TpsState::None; } void EtbController::update() { @@ -613,7 +613,7 @@ void EtbController::update() { return; } - bool isOk = checkStatus(); + bool isOk = checkStatus(); if (!isOk) { // If engine is stopped and so configured, skip the ETB update entirely diff --git a/firmware/controllers/actuators/electronic_throttle_impl.h b/firmware/controllers/actuators/electronic_throttle_impl.h index a4d02987ad..d9fb5175b5 100644 --- a/firmware/controllers/actuators/electronic_throttle_impl.h +++ b/firmware/controllers/actuators/electronic_throttle_impl.h @@ -93,13 +93,13 @@ private: // todo: rename to m_targetErrorAccumulator ErrorAccumulator m_errorAccumulator; - /** - * @return true if OK, false if should be disabled - */ - bool checkStatus(); - bool isEtbMode() { - return m_function == DC_Throttle1 || m_function == DC_Throttle2; - } + /** + * @return true if OK, false if should be disabled + */ + bool checkStatus(); + bool isEtbMode() { + return m_function == DC_Throttle1 || m_function == DC_Throttle2; + } ExpAverage m_dutyRocAverage; ExpAverage m_dutyAverage; diff --git a/firmware/controllers/actuators/idle_thread.cpp b/firmware/controllers/actuators/idle_thread.cpp index 1187aa36f6..521c3f2138 100644 --- a/firmware/controllers/actuators/idle_thread.cpp +++ b/firmware/controllers/actuators/idle_thread.cpp @@ -318,7 +318,7 @@ float IdleController::getIdlePosition(float rpm) { bool isAutomaticIdle = tps.Valid && engineConfiguration->idleMode == IM_AUTO; - isVerboseIAC = engineConfiguration->isVerboseIAC && isAutomaticIdle; + isVerboseIAC = engineConfiguration->isVerboseIAC && isAutomaticIdle; if (isVerboseIAC) { efiPrintf("Idle state %s", getIdle_state_e(idleState)); getIdlePid()->showPidStatus("idle"); diff --git a/firmware/controllers/actuators/vvt.cpp b/firmware/controllers/actuators/vvt.cpp index dfd97c3d79..96bada4378 100644 --- a/firmware/controllers/actuators/vvt.cpp +++ b/firmware/controllers/actuators/vvt.cpp @@ -159,9 +159,9 @@ void stopVvtControlPins() { } void initVvtActuators() { - if (engineConfiguration->vvtControlMinRpm < engineConfiguration->cranking.rpm) { - engineConfiguration->vvtControlMinRpm = engineConfiguration->cranking.rpm; - } + if (engineConfiguration->vvtControlMinRpm < engineConfiguration->cranking.rpm) { + engineConfiguration->vvtControlMinRpm = engineConfiguration->cranking.rpm; + } vvtTable1.init(config->vvtTable1, config->vvtTable1LoadBins, config->vvtTable1RpmBins); diff --git a/firmware/controllers/algo/advance_map.cpp b/firmware/controllers/algo/advance_map.cpp index 2a4b204cb7..e84df18f78 100644 --- a/firmware/controllers/algo/advance_map.cpp +++ b/firmware/controllers/algo/advance_map.cpp @@ -53,15 +53,15 @@ static angle_t getRunningAdvance(int rpm, float engineLoad) { ); #if EFI_ANTILAG_SYSTEM - if (engine->antilagController.isAntilagCondition) { - float throttleIntent = Sensor::getOrZero(SensorType::DriverThrottleIntent); + if (engine->antilagController.isAntilagCondition) { + float throttleIntent = Sensor::getOrZero(SensorType::DriverThrottleIntent); engine->antilagController.timingALSCorrection = interpolate3d( config->ALSTimingRetardTable, config->alsIgnRetardLoadBins, throttleIntent, config->alsIgnRetardrpmBins, rpm ); advanceAngle += engine->antilagController.timingALSCorrection; - } + } #endif /* EFI_ANTILAG_SYSTEM */ // Add any adjustments if configured @@ -78,7 +78,7 @@ static angle_t getRunningAdvance(int rpm, float engineLoad) { // get advance from the separate table for Idle #if EFI_IDLE_CONTROL if (engineConfiguration->useSeparateAdvanceForIdle && - engine->module()->isIdlingOrTaper()) { + engine->module()->isIdlingOrTaper()) { float idleAdvance = interpolate2d(rpm, config->idleAdvanceBins, config->idleAdvance); auto tps = Sensor::get(SensorType::DriverThrottleIntent); @@ -91,15 +91,15 @@ static angle_t getRunningAdvance(int rpm, float engineLoad) { #if EFI_LAUNCH_CONTROL if (engine->launchController.isLaunchCondition && engineConfiguration->enableLaunchRetard) { - if (engineConfiguration->launchSmoothRetard) { - float launchAngle = engineConfiguration->launchTimingRetard; - int launchRpm = engineConfiguration->launchRpm; - int launchRpmWithTimingRange = launchRpm + engineConfiguration->launchTimingRpmRange; + if (engineConfiguration->launchSmoothRetard) { + float launchAngle = engineConfiguration->launchTimingRetard; + int launchRpm = engineConfiguration->launchRpm; + int launchRpmWithTimingRange = launchRpm + engineConfiguration->launchTimingRpmRange; // interpolate timing from rpm at launch triggered to full retard at launch launchRpm + launchTimingRpmRange return interpolateClamped(launchRpm, advanceAngle, launchRpmWithTimingRange, launchAngle, rpm); } else { return engineConfiguration->launchTimingRetard; - } + } } #endif /* EFI_LAUNCH_CONTROL */ diff --git a/firmware/controllers/algo/antilag_system.cpp b/firmware/controllers/algo/antilag_system.cpp index 0807516b2e..f71094841a 100644 --- a/firmware/controllers/algo/antilag_system.cpp +++ b/firmware/controllers/algo/antilag_system.cpp @@ -69,12 +69,12 @@ bool AntilagSystemBase::isAntilagConditionMet(int rpm) { ALSMaxThrottleIntentCondition = isALSMaxThrottleIntentCondition(); ALSSwitchCondition = isInsideALSSwitchCondition(); - return ALSMinRPMCondition && - ALSMaxRPMCondition && - ALSMinCLTCondition && - ALSMaxCLTCondition && - ALSMaxThrottleIntentCondition && - ALSSwitchCondition; + return ALSMinRPMCondition && + ALSMaxRPMCondition && + ALSMinCLTCondition && + ALSMaxCLTCondition && + ALSMaxThrottleIntentCondition && + ALSSwitchCondition; } void AntilagSystemBase::update() { diff --git a/firmware/controllers/algo/engine.cpp b/firmware/controllers/algo/engine.cpp index 3f81a4923c..4e0ecb66dc 100644 --- a/firmware/controllers/algo/engine.cpp +++ b/firmware/controllers/algo/engine.cpp @@ -74,7 +74,7 @@ trigger_type_e getVvtTriggerType(vvt_mode_e vvtMode) { case VVT_BOSCH_QUICK_START: return TT_VVT_BOSCH_QUICK_START; case VVT_HONDA_K_EXHAUST: - return TT_HONDA_K_CAM_4_1; + return TT_HONDA_K_CAM_4_1; case VVT_HONDA_K_INTAKE: case VVT_FIRST_HALF: case VVT_SECOND_HALF: @@ -85,7 +85,7 @@ trigger_type_e getVvtTriggerType(vvt_mode_e vvtMode) { case VVT_BARRA_3_PLUS_1: return TT_VVT_BARRA_3_PLUS_1; case VVT_MAZDA_SKYACTIV: - return TT_VVT_MAZDA_SKYACTIV; + return TT_VVT_MAZDA_SKYACTIV; case VVT_NISSAN_VQ: return TT_VVT_NISSAN_VQ35; case VVT_TOYOTA_4_1: diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index 256a62bca5..5464694ec1 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -420,12 +420,12 @@ static void setDefaultEngineConfiguration() { setDefaultEtbBiasCurve(); #endif /* EFI_ELECTRONIC_THROTTLE_BODY */ #if EFI_BOOST_CONTROL - setDefaultBoostParameters(); + setDefaultBoostParameters(); #endif - // OBD-II default rate is 500kbps - engineConfiguration->canBaudRate = B500KBPS; - engineConfiguration->can2BaudRate = B500KBPS; + // OBD-II default rate is 500kbps + engineConfiguration->canBaudRate = B500KBPS; + engineConfiguration->can2BaudRate = B500KBPS; engineConfiguration->mafSensorType = Bosch0280218037; setBosch0280218037(config); @@ -504,7 +504,7 @@ static void setDefaultEngineConfiguration() { engineConfiguration->launchRpm = 3000; // engineConfiguration->launchTimingRetard = 10; engineConfiguration->launchTimingRpmRange = 500; - engineConfiguration->launchSpeedThreshold = 30; + engineConfiguration->launchSpeedThreshold = 30; engineConfiguration->hardCutRpmRange = 500; engineConfiguration->engineSnifferRpmThreshold = 2500; @@ -978,8 +978,8 @@ void validateConfiguration() { engineConfiguration->adcVcc = 3.3f; } if (engineConfiguration->instantRpmRange == 0) { - // todo: extract constant in instant_rpm_calculator.h? - engineConfiguration->instantRpmRange = 90; + // todo: extract constant in instant_rpm_calculator.h? + engineConfiguration->instantRpmRange = 90; } engine->preCalculate(); } diff --git a/firmware/controllers/algo/engine_types.h b/firmware/controllers/algo/engine_types.h index a05740a909..3fa2566b1f 100644 --- a/firmware/controllers/algo/engine_types.h +++ b/firmware/controllers/algo/engine_types.h @@ -177,7 +177,7 @@ typedef enum __attribute__ ((__packed__)) { // 84 HELLEN_121_NISSAN_4_CYL = 84, - HELLEN_121_NISSAN_8_CYL = 85, + HELLEN_121_NISSAN_8_CYL = 85, HELLEN_NB2_36 = 86, @@ -195,14 +195,14 @@ typedef enum __attribute__ ((__packed__)) { ET_UNUSED_93 = 93, - HELLEN_NB1_36 = 94, + HELLEN_NB1_36 = 94, HELLEN_154_HYUNDAI_COUPE_BK2 = 95, - WASTEGATE_PROTEUS_TEST = 96, + WASTEGATE_PROTEUS_TEST = 96, PROTEUS_MIATA_NA6 = 4, - ET_UNUSED_97 = 97, - ET_UNUSED_98 = 98, + ET_UNUSED_97 = 97, + ET_UNUSED_98 = 98, ET_UNUSED_17 = 17, ET_UNUSED_11 = 11, ET_UNUSED_12 = 12, @@ -220,8 +220,8 @@ typedef enum __attribute__ ((__packed__)) { TEST_101 = 101, TEST_102 = 102, - // java code generator handles this value in a special way - // also looks like 2 enums are either 1 byte or 4 bytes + // java code generator handles this value in a special way + // also looks like 2 enums are either 1 byte or 4 bytes Force_4_bytes_size_engine_type = 70000, } engine_type_e; diff --git a/firmware/controllers/algo/fuel_math.cpp b/firmware/controllers/algo/fuel_math.cpp index b55e4fed06..f4b02096f0 100644 --- a/firmware/controllers/algo/fuel_math.cpp +++ b/firmware/controllers/algo/fuel_math.cpp @@ -394,17 +394,17 @@ float getBaroCorrection() { percent_t getFuelALSCorrection(int rpm) { #if EFI_ANTILAG_SYSTEM - if (engine->antilagController.isAntilagCondition) { - float throttleIntent = Sensor::getOrZero(SensorType::DriverThrottleIntent); - auto AlsFuelAdd = interpolate3d( + if (engine->antilagController.isAntilagCondition) { + float throttleIntent = Sensor::getOrZero(SensorType::DriverThrottleIntent); + auto AlsFuelAdd = interpolate3d( config->ALSFuelAdjustment, config->alsFuelAdjustmentLoadBins, throttleIntent, config->alsFuelAdjustmentrpmBins, rpm - ); - return AlsFuelAdd; - } else + ); + return AlsFuelAdd; + } else #endif /* EFI_ANTILAG_SYSTEM */ - { + { return 0; } } diff --git a/firmware/controllers/algo/launch_control.cpp b/firmware/controllers/algo/launch_control.cpp index 4a1932ad4d..3b08157cb5 100644 --- a/firmware/controllers/algo/launch_control.cpp +++ b/firmware/controllers/algo/launch_control.cpp @@ -113,7 +113,7 @@ void LaunchControlBase::update() { or it is supposed to be referencing 'launchTimingRpmRange'? + (engineConfiguration->enableLaunchRetard ? engineConfiguration->launchAdvanceRpmRange : 0) */ - + engineConfiguration->hardCutRpmRange; + + engineConfiguration->hardCutRpmRange; if (!combinedConditions) { // conditions not met, reset timer diff --git a/firmware/controllers/can/can_verbose.cpp b/firmware/controllers/can/can_verbose.cpp index d088d67aaf..ae7770ba22 100644 --- a/firmware/controllers/can/can_verbose.cpp +++ b/firmware/controllers/can/can_verbose.cpp @@ -204,12 +204,12 @@ void sendCanVerbose() { auto base = engineConfiguration->verboseCanBaseAddress; auto isExt = engineConfiguration->rusefiVerbose29b; - transmitStruct (base + 0, isExt); - transmitStruct (base + 1, isExt); - transmitStruct (base + CAN_PEDAL_TPS_OFFSET, isExt); + transmitStruct (base + 0, isExt); + transmitStruct (base + 1, isExt); + transmitStruct (base + CAN_PEDAL_TPS_OFFSET, isExt); transmitStruct (base + CAN_SENSOR_1_OFFSET, isExt); transmitStruct (base + 4, isExt); - transmitStruct (base + 5, isExt); + transmitStruct (base + 5, isExt); transmitStruct (base + 6, isExt); transmitStruct (base + 7, isExt); transmitStruct (base + 8, isExt);