I have been able read my stock S2000 ECU using Honda Tuning Suite CANBUS Edition (after unmarrying FlashPro) and analyze some of the logic.
Anyway, my reason for this post is to shed light on how Throttle Change Enrichment/Enleanment is done on these Honda S2000 ECUs. It seems Hondata gives us two tables to adjust but I believe their explanation is flawed. Also, I know there are several more tables that define the Wall-Wetting phenomenon that are not yet defined. Well, here is some of the decompiled ASM as per Ghidra version 10.2.2 in addition to my personal renaming of variables and commenting on the code.
I believe that the TipInFuel_ECT table actually is a Decaying table while the other one actually Adds to the Fuel pulse. This is in contradiction of the help notes posted on the Hondata website regarding "Throttle Tip In Fuel" which says both tables are Adders.
https://www.hondata.com/help/flashpro/i ... meters.htm
I was hoping someone at Hondata could look over my review of the commented decomplied source code and see if it agrees with your assessment.
Anyway, my end goal is to improve Honda Tuning specifically for my car and by association everyone by coming to a better understanding of how the stock logic works.
Code: Select all
void TipInFuel_FUN_00050f3c(void)
{
short wVar2;
int extraout_r0;
uint Z;
int TipInFuel;
bool TipInEnrich;
word wVar1;
short sVar2;
TipInFuel *TIF;
TIF = &TipInFuel_ffff2f20;
TipInFuel = (int)?_TipInFuel_LastApplied_SHORT_ffff2576;
if (TipInFuel < 0x8000) {
if ((-0x7fff < TipInFuel) && (Ready_BOOL_ffff292a)) {
/* if (-7fff < xffff2576 < 8000) and (xffff292a == true) then normal decay */
Z = 2DTableLookup(&2D_TipInFuel?Decay_ECT_0000a61c,(int)?_ECT_SHORT_ffff24ac);
TIF->Z_TipInFuel?Decay_ECT = (word)Z;
TipInFuel = (uint)TIF->TipInFuel - (Z & 0xffff);
if ((int)&TipInFuel_Min_BYTE_00007fff < TipInFuel) goto LAB_000510ac;
}
TipInFuel = -0x8000;
}
else {
/* (x8000h <= xffff2576) */
if ((int)TipInFuel_New_SHORT_ffff2baa < (int)TipInFuel_Last_SHORT_ffff2bdc) {
/* decay */
TipInFuel = Math_Limit_-8000to7fff_FUN_00008f28
(TipInFuel -
((int)TipInFuel_Last_SHORT_ffff2bdc - (int)TipInFuel_New_SHORT_ffff2b aa
));
TIF->TipInFuel_Applied = (short)TipInFuel;
sVar2 = (short)TipInFuel;
}
else {
/* no decay */
TipInFuel_ffff2f20.TipInFuel_Applied = ?_TipInFuel_LastApplied_SHORT_ffff2576;
sVar2 = ?_TipInFuel_LastApplied_SHORT_ffff2576;
}
/*
*/
if (TipInFuel_New_SHORT_ffff2baa == 0) {
TipInFuel = Math_Limit_-8000to7fff_FUN_00008f28((int)sVar2 << 15);
wVar2 = (short)TipInFuel;
wVar1 = wVar2;
}
else {
Math_FUN_000a0e2c();
TipInFuel = Math_Limit_-8000to7fff_FUN_00008f28(extraout_r0);
wVar1 = (word)TipInFuel;
}
/*
*/
TIF->TipInFuel_AppliedFinal = wVar1;
if ((TIF->TipInStatus != false) ||
((SHORT_ffff2bda < (short)5501 && (SHORT_ffff2bde <= TipInFuel_New_SHORT_ffff2baa)))) {
Z = 2DTableLookup(&2D_TipInFuel_Throttle_0000a628,(int)(short)wVar1);
TIF->Z_TipInFuel?Adder_Throttle = (word)Z;
if ((uint)TIF->TipInFuel < (Z & 0xffff)) {
TIF->TipInFuel = (word)Z;
}
TipInEnrich = true;
goto LAB_000510b0;
}
Z = 2DTableLookup(&2D_TipInFuel?Decay_ECT_0000a61c,(int)?_ECT_SHORT_ffff24ac);
TIF->Z_TipInFuel?Decay_ECT = (word)Z;
TipInFuel = (uint)TIF->TipInFuel - (Z & 0xffff);
if (TipInFuel < (int)&Min_TipInFuelEnrich_WORD_00008000) {
TipInFuel = -0x8000;
}
}
LAB_000510ac:
TIF->TipInFuel = (word)TipInFuel;
TipInEnrich = false;
LAB_000510b0:
TIF->TipInStatus = TipInEnrich;
return;
}