ford byte status fix for no dtcs, fbkw fixes and 004002 phi1

This commit is contained in:
2026-04-23 15:38:02 +02:00
parent 367ffc6950
commit aa5f88979b
7 changed files with 26 additions and 15 deletions

View File

@@ -37,7 +37,16 @@ void UpdateFBKW_MODULATION(TIM_HandleTypeDef* pwmHandle, uint32_t pwmChannel, fl
/*Assign the new dutyCycle count to the capture compare register.*/
__HAL_TIM_SET_COMPARE(pwmHandle, pwmChannel, (uint32_t)(roundf(newRegVal)));
}
void UpdatePWM(TIM_HandleTypeDef* pwmHandle, uint32_t pwmChannel, uint16_t period_on, uint16_t period){
if(period_on > period)
{
period_on = period;
}
pwmHandle->Instance->ARR = period;
pwmHandle->Instance->CCR2 = period_on;
}
/* =======================================================================
* VP44 reverse-engineered pipeline bridge
* -----------------------------------------------------------------------
@@ -151,7 +160,7 @@ void FBKW_service(void) {
/* pwm_duty is a 12-bit (0..4095) command. Convert to percentage for
* the existing UpdateFBKW_MODULATION helper, which expects 0..100. */
float duty_pct = ((float)fbkw_rt.pwm_duty) * (100.0f / 4095.0f);
/*float duty_pct = ((float)fbkw_rt.pwm_duty) * (100.0f / 4095.0f);
duty_pct = duty_pct < FBKW_PWM_MIN ? FBKW_PWM_MIN : duty_pct;
duty_pct = duty_pct > FBKW_PWM_MAX ? FBKW_PWM_MAX : duty_pct;
@@ -159,9 +168,11 @@ void FBKW_service(void) {
FBKW_DC = (float)forceDC;
} else {
FBKW_DC = duty_pct;
}
UpdateFBKW_MODULATION(&htim4, TIM_CHANNEL_2, FBKW_DC);
}*/
UpdatePWM(&htim4, TIM_CHANNEL_2, fbkw_rt.pwm_on_time, fbkw_rt.pwm_period);
FBKW_DC = ((float)fbkw_rt.pwm_duty) * (100.0f / 4095.0f);
FBKW_DEMAND = fbkw_rt.target * (3.0f / 256.0f);
//UpdateFBKW_MODULATION(&htim4, TIM_CHANNEL_2, FBKW_DC);
}
const pwm_runtime_t *FBKW_pipeline_runtime(void) {

View File

@@ -105,7 +105,7 @@ uint8_t QTY_valve_status = 1; //---* tein, --*- feedback, -*-- rpm,
static CanSymbolDef SYM_ID_EMPF1[] = {
#if defined(T06301)
{ "TEIN_STATUS", 8, 1, CAN_ENDIAN_INTEL, CAN_SYM_UX, 0,0, &T_ein_status, NULL, CAN_STORE_U8, INVERTED},
{ "QTY_VALVE_STATUS", 9, 1, CAN_ENDIAN_INTEL, CAN_SYM_UX, 0,0, &QTY_valve_status, NULL, CAN_STORE_U8},
{ "QTY_VALVE_STATUS", 9, 1, CAN_ENDIAN_INTEL, CAN_SYM_UX, 0,0, &QTY_valve_status, NULL, CAN_STORE_U8, INVERTED},
{ "ANGLESENSOR_STATUS", 10, 1, CAN_ENDIAN_INTEL, CAN_SYM_UX, 0,0, &hasCapturedTeeth, NULL, CAN_STORE_U8, INVERTED},
{ "CIL_COUNT", 0, 3, CAN_ENDIAN_INTEL, CAN_SYM_UX, 0,0, &cilCount, NULL, CAN_STORE_U8},

View File

@@ -126,7 +126,7 @@ void Fieona_SEND3_Handler(const uint8_t in_data[8]){
FIEONA_TRANS2 = 0x0001;
FIEONA_TRANS2 = 0;
eps_fieona_override = 1;
}else{
}else if(!isCar){ //si no es el coche no enviar
Timeout_StopByIndex(18);
}
Timeout_ResetByIndex(1, TIM16->CNT);

View File

@@ -32,7 +32,7 @@
#define CYLINDERS 4
/* TIMING COMPENSATIONS */
#define PHI1 24.914
#define PHI1 25.4
#define TEIN_NOMINAL 0
#define TEIN_FAULT 950.5
@@ -51,7 +51,7 @@
#define FBKW_DEM_MIN 0
#define FBKW_FEEDBACK_ZERO 8.135//cambia de modulo a modulo
#define FBKW_FEEDBACK_ZERO 7.617
#define FBKW_FEEDBACK_MIN -3.188
#define FBKW_FEEDBACK_MAX 17.813
#define FBKW_FEEDBACK_IC_DT 27

View File

@@ -32,7 +32,7 @@
#define CYLINDERS 4
/* TIMING COMPENSATIONS */
#define PHI1 24.914
#define PHI1 25.4
#define TEIN_NOMINAL 0
#define TEIN_FAULT 950.5

View File

@@ -1074,9 +1074,9 @@ static void MX_TIM4_Init(void)
/* USER CODE END TIM4_Init 1 */
htim4.Instance = TIM4;
htim4.Init.Prescaler = 160-1;
htim4.Init.Prescaler = 80-1;
htim4.Init.CounterMode = TIM_COUNTERMODE_UP;
htim4.Init.Period = 20000;
htim4.Init.Period = 29851;
htim4.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
htim4.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
if (HAL_TIM_Base_Init(&htim4) != HAL_OK)
@@ -1133,7 +1133,7 @@ static void MX_TIM6_Init(void)
htim6.Instance = TIM6;
htim6.Init.Prescaler = 160-1;
htim6.Init.CounterMode = TIM_COUNTERMODE_UP;
htim6.Init.Period = 9999;
htim6.Init.Period = 999;
htim6.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
if (HAL_TIM_Base_Init(&htim6) != HAL_OK)
{

View File

@@ -369,11 +369,11 @@ TIM3.Prescaler=160-1
TIM3.TIM_MasterOutputTrigger=TIM_TRGO_UPDATE
TIM4.Channel-PWM\ Generation2\ CH2=TIM_CHANNEL_2
TIM4.IPParameters=Channel-PWM Generation2 CH2,Prescaler,PeriodNoDither,PulseNoDither_2
TIM4.PeriodNoDither=20000
TIM4.Prescaler=160-1
TIM4.PeriodNoDither=29851
TIM4.Prescaler=80-1
TIM4.PulseNoDither_2=5000
TIM6.IPParameters=Prescaler,PeriodNoDither
TIM6.PeriodNoDither=10000-1
TIM6.PeriodNoDither=1000-1
TIM6.Prescaler=160-1
TIM7.IPParameters=Prescaler,PeriodNoDither,TIM_MasterOutputTrigger
TIM7.PeriodNoDither=9