Title: MED9.1 Multimap Tool - vkKraQu based Post by: elias on January 21, 2024, 06:23:56 AM Hello together,
I fiddled together a tool which can patch a "multimap" solution into a MED9.1 Binary using the variable vkKraQu https://github.com/EliasKotlyar/MED9.1-Multimap-Tool What is vkKraQu? In some MED9.1 Binaries(for example 1Q0907115C), you will find following tables: LDRXN_0_A, LDRXN_1_A, LDRXN_2_A Most of the tuners are just setting the same values for all the 3 Tables and there are a lot of myths about which table is getting used when. After studying the code in ghidra, i found out that there is a ram variable called "vkKraQu" which stands for "Variantenkriterium für Kraftstoffqualität"(english"Variant Coding of Fuel Quality"). Its basically a var which decide which table to use. So if you set it to "0", LDRXN_0_A will be used. If you set it to "1", LDRXN_1_A will be used..etc vkKraQu is getting assigned a value from EEPROM at each start of ECU, but can be changed in runtime. How does it work? My tool patches some function which is running every 20ms, and sets the vkKraQu to a certain value depending on cruise control status. The source code is literally: Code:
B_fgr is a variable which tells if cruise is enabled/disabled. On which binaries does it work? Its working currently only on 1Q0907115C, but there is a adaptation guide in the repository. I will happy accept any MR covering other binaries. Which maps are influenced by vkKraQu? At least on 1Q0907115C, its directly switches following maps: Code: KFZWLB2_0_A How do i start? 1. First use the adaptation guide for your binary, and adjust the variables(see guide) 2. Change the map(s) <mapname>0_A to your needs (maps which will be used if cruise if off) 3. Change the map(s) <mapname>1_A to your needs (maps which will be used if cruise if on) 4. Have fun! Disclaimler As always i am not responsible for your adventures with my software. Binary changes always have some risk, and should be verified with Ghidra/IDA Pro afterwards before blindly applying to your ECU. PS: A cheapskate "mapswitch" might be possible using VCDS only. The vkKraQu is stored in EEPROM as a long-coding variable, however the label files of VCDS are not covering it as its not present in every MED9.1 Version. If someone have the time, he can modify the label files to cover vkKraQu, and switch the maps without any modifications to the binary. However its not that convinient in comparison to cruise-control. Title: Re: MED9.1 Multimap Tool - vkKraQu based Post by: prj on January 21, 2024, 11:01:14 AM Quote if (B_fgr== 1) { vkKraQu = 1; } else { vkKraQu = 0; } Why not make it usable? This removes the cruise control function from the car. Title: Re: MED9.1 Multimap Tool - vkKraQu based Post by: elias on January 21, 2024, 11:16:31 AM @prg:
First of all, it does not remove cruise control. What it does: It does use cruise control as trigger to switch the maps. What do you mean by usable? Any ideas on further improvement are appreciatet. Title: Re: MED9.1 Multimap Tool - vkKraQu based Post by: prj on January 21, 2024, 11:18:49 AM @prg: First of all, it does not remove cruise control. What it does: It does use cruise control as trigger to switch the maps. What do you mean by usable? Any ideas on further improvement are appreciatet. So how are you going to use the cruise control? Every time you turn it on and off you will have maps switching. You can't use cruise control on map 0. Use at least a little thought for implementation of the HMI, this is lazy. Title: Re: MED9.1 Multimap Tool - vkKraQu based Post by: elias on January 21, 2024, 11:25:32 AM Sorry for the misunderstanding, but this is the whole idea of this project:
Following is a little example: You have 2 map-sets, lets say a mapset A with "normal tune" and mapset B with "stage1". You drive around with your normal tune on the highway using no cruise control. This will enable mapset A. As soon as you want to have some fun, you switch on cruise and you will get your mapset B activated which will give you a performance boost. What would you recommend how it should work? Title: Re: MED9.1 Multimap Tool - vkKraQu based Post by: fknbrkn on January 21, 2024, 11:27:29 AM You should disable the stock vkKraQu setting proc also
Using tacho as HMI -> introduce 2 timers, nmot->CAN interception Quote if (B_fgr== 1) { vkKraQu = 1; } else { vkKraQu = 0; } Its basically turns second set when cruise activated, its not a trigger with that code Title: Re: MED9.1 Multimap Tool - vkKraQu based Post by: prj on January 21, 2024, 11:32:17 AM You drive around with your normal tune on the highway using no cruise control. This will enable mapset A. As soon as you want to have some fun, you switch on cruise and you will get your mapset B activated which will give you a performance boost. This is stupid, as is switching the map for changing power level - just use your right foot to press the throttle a different amount.Switching is useful for different fuel, e.g. RON98 and RON102 or even VP MS109. Use your imagination at least a tiny bit. You can even do the mapswitching with only the brake and the accelerator pedal when the engine is turned off. If you want to use the cruise control, then introduce some logic. Simplest way with 2 maps is set when brake is active to go to one map and then res when brake is active to go to other map. Maybe flash MIL to indicate it was switched. There are also much better solutions with edge detection (button pressed/released) and other logic. All without affecting the original function of the cruise control. But like this it is just bad. Title: Re: MED9.1 Multimap Tool - vkKraQu based Post by: elias on January 21, 2024, 11:56:09 AM Quote You should disable the stock vkKraQu setting proc also The stock vkKraQu setting proc is enabled only when the eeprom is getting initialized.It happens only once the ECU is being reset or you save some data into eeprom. My code is running every 20ms - even if someone changes it somehow, the vkKraQu will be swapped immidiately. Quote > Using tacho as HMI -> introduce 2 timers, nmot->CAN interception Can you please elaborate how it should work in your opinion? Like the user workflow, not the implementation. Implementation is something which i can handle. Quote Its basically turns second set when cruise activated, its not a trigger with that code Yes, thats the idea behind it. you activate the second set of maps with turning on cruise...Quote This is stupid, as is switching the map for changing power level - just use your right foot to press the throttle a different amount. I think its a matter of opinion. A lot of newer cars have different drivemodes which are basically doing same thing(in my humble opinion - it depends on the car, and implementation of that feature. ) Quote Use your imagination at least a tiny bit. Actually i did and i realized my need of switching it on/off during the ride. This is the solution which came out.... Title: Re: MED9.1 Multimap Tool - vkKraQu based Post by: fknbrkn on January 21, 2024, 12:51:29 PM Quote The stock vkKraQu setting proc is enabled only when the eeprom is getting initialized. Okay, its just my habits, costs 2 NOPs but eliminate some potential issues. The chances are low but not zeroes ::)It happens only once the ECU is being reset or you save some data into eeprom. My code is running every 20ms - even if someone changes it somehow, the vkKraQu will be swapped immidiately. Quote Can you please elaborate how it should work in your opinion? Like the user workflow, not the implementation. Implementation is something which i can handle. Well i make this many years ago with me7 so i can miss some details and those for 4 map sets, its better to flashing with CEL i believe if you just want to enable/disable something counter = 0; ticks, new var, should be 0 when initialised b_flag = false; new var b_brake b_fgrSet ;set button call instead of vkKraQu stock setting: Quote if (b_brake && b_fgrSet && !b_flag) { vkKraQu.0 = !vkKraQu.0; flip-flop bit 0 so the value is 0 or 1 b_flag = true; counter = (vkKraQu + 1) * 100; so the counter were 100 or 200 } else { b_flag = false; } next, if you using CEL blinks there is some variable to blink CEL in stock, i didnt remeber how it names (stock CEL blinks when misfiring), lets say it b_MILblink call where b_MILblink assigned Quote if (counter > 0) { b_MILblink = true; counter -= 1; { else { <stock assignation> } In this case counter is an overall time to b_MILblink is active and youve got to set counter multiplier in main routine to get 1 and 2 blinks ************ Tacho: (in case you have more than 1 set) counter = 0; delay, new var, should be 0 when initialised maxMaps = 3; maximum set which user can choose, new param b_flag = false; new var b_brake b_fgrSet ;set button Quote if (b_brake && b_fgrSet && !b_flag) { vkKraQu += 1; if (vkKraQu > maxMaps) { vkKraQu = 0 } ; cycle to first set b_flag = true; counter = 500; delay of tacho needle to stay at the selected position } else { b_flag = false; } nmot_can assignation call: Quote if(counter >0) { if (vkKraQu == 0) { nmot_can = 1000 ; =1000 rpm } if (vkKraQu == 1) { nmot_can = 2000 ; =2000 rpm } if (vkKraQu == 2) { nmot_can = 3000 ; =3000 rpm } counter -= 1; } else { <stock routine: nmot_can = nmot_w> } Quote Yes, thats the idea behind it. you activate the second set of maps with turning on cruise... IIRC b_fgr is true when cruise is active, literally cruise with the ecu holding target speed not you :) But in general i agree with prj, just use your foot. Properly tuned IRL/IOP etc gives you all abilities for that, im using multimap few times in a years just when leave the car in service or giving it to gf :P *ps As in idea based on DSG mode -> if (gwhpos == 12) || (gwhpos == 9) { vkKraQu = 1; } else { vkKraQu = 0;} // if sport or tt mode Or something similar with the ESP |