Page 3 of 5

Re: Flex Fuel Control

Posted: 2024 Dec 20, 09:14
by wwhite
Should you set R42 back to what was in [700], after you change it to aaaa?

This way your guaranteed to not mess with R42 setting it to a different value.

Re: Flex Fuel Control

Posted: 2024 Dec 20, 09:34
by efloth
It’s is earlier written as byte AA for KAMQA so I didn’t bother

Re: Flex Fuel Control

Posted: 2024 Dec 20, 13:11
by sailorbob
A 0x42 already holds 0xAA just load 0xAA into 0x43 instead of the 0xAAAA into 0x42 and save a state time :D

Re: Flex Fuel Control

Posted: 2024 Dec 20, 13:13
by efloth
sailorbob wrote: 2024 Dec 20, 13:11 A 0x42 already holds 0xAA just load 0xAA into 0x43 instead of the 0xAAAA into 0x42 and save a state time :D
lol love it!

Re: Flex Fuel Control

Posted: 2024 Dec 20, 20:54
by efloth
Making some progress on updating KAMAFR using the built in (U)ROLAV function. I borrowed the time constant tcegr which is 2 seconds. Not sure if I should increase that or not.

Code: Select all

Sub_a30d:
a30d: ef,2e,b1            call  543e             Sub_543e ();		'previously called from background fuel sub
a310: 32,9f,01            jnb   B2,R9f,a314      if (B2_R9f = 1)  {	'Return if in open loop
a313: f0                  ret                    return; }

a314: a3,ee,96,32         ldw   R32,[Ree+96]     R32 = [716];		'KAMAFR
a318: a0,96,34            ldw   R34,R96          R34 = R96;		'LAMBSE1
a31b: a3,f8,18,36         ldw   R36,[Rf8+18]     R36 = [adf0];		'TCEGR 0800h = 2 seconds according to docs
a31f: ef,50,a4            call  4772             Sub_4772 ();		'UROLAV function, not sure how that differs from ROLAV
a322: c3,ee,96,3e         stw   R3e,[Ree+96]     [716] = R3e;		'New value for KAMAFR. More code is needed here to make sure valid
a326: f0                  ret                    return;

Re: Flex Fuel Control

Posted: 2024 Dec 20, 22:43
by decipha
prob best to use the adaptive delay timer and conditions before trying to assimilate the lambse

Re: Flex Fuel Control

Posted: 2024 Dec 20, 22:57
by efloth
Thinking r34 needs to be kamafr * lambse1 yeah? Looks like I need to do some math/conversion here. Lambse is x/32768 and AFR is 524288/x

Re: Flex Fuel Control

Posted: 2024 Dec 20, 23:44
by efloth
decipha wrote: 2024 Dec 20, 22:43 prob best to use the adaptive delay timer and conditions before trying to assimilate the lambse
Was thinking of just using a minimum temperature. is that sufficient?

Re: Flex Fuel Control

Posted: 2024 Dec 21, 00:23
by decipha
no

you want to be able to define a range
i.e. part throttle, 1500-2500 rpm, 50-70 mapope, etc...

temp alone wont cut it

Re: Flex Fuel Control

Posted: 2024 Dec 21, 03:49
by sailorbob
Out of curiosity have you datalogged LAMBSE to see how stable the value is when using a fuel with a different stoichiometric A/F ratio to petrol. Or seen how long it takes to stabilise when a different fuel is added to what is already in the tank? I think these behaviours are important for how you need to determine the nominal stoichiometric A/F ratio.

LAMAVE might be a better value to use instead of LAMBSE.

Regarding code thrift, whilst my prior comment was a bit tongue in cheek, it is worth considering keeping any additional code as short and concise as possible. For example, at 0xA310 if you change it to a jump to quit if in open loop you can omit the return instruction at 0xA313 and fall through if in closed loop.