I've added some info on using the loop feature of MS3. I'm using this on my car to control how the two radiator fans are turned on.
I think it would be nicer if we could just add extra conditions in the standard menu but this may have been easier way for the developers to add extra logic for the programmable outputs to the source code..
https://bartuneengineering.wordpress.co ... irt-loops/Ever wanted to turn on an output based on more than the two conditions allowed using the programmable on/off outputs?
First off this unfortunately is only applicable to Megasquirt 3 based controllers.
The loop outputs are located in the 'Programmable On/Off Outputs 2' menu. In this example I'll go through an example them to turn on two radiator fans.
Firstly the conditions for each fan to turn on need to be determined.
Thermofan 1 requires engine coolant temperature to be above 97degC or PWM_DutyA to be greater than 20% while the engine is running or the intake air temperature to be above 40degC while the engine is running to turn the fan on.
Thermofan 2 requires the engine coolant temperature to be above 105degC or manifold pressure to be above 110kPa or intake air temperature to be above 35degC while the engine is running to turn on.
Next these conditions need to be added to different loops.
When using the loops both the threshold and hysteresis should be set to the loop number. Each loop state is stored into a single 8-bit variable so the value to use for each loop is as follows:
Loop 1: 2^0 = 1
Loop 2: 2^1 = 2
Loop 3: 2^2 = 4
Loop 4: 2^3 = 8
Loop 5: 2^4 = 16
Loop 6: 2^5 = 32
Loop 7: 2^6 = 64
Loop 8: 2^7 = 128
So if you wanted to turn on the output when loop 6 is active the threshold and hysteresis should be set to 32. It is also possible to turn on the output based on two or more of the loops by adding the values together. For example if you wanted to turn on an ouput when both loop2 and loop 4 are true, then the threshold and hysteresis should be set to 2+8=10. If you wanted to turn on an output when loop4 is true and loop5 is false then the threshold is set to 8+16=24 and hysteresis set to 8.
The physical output port 1 runs off Loop1 however the loop ends at Loop2 due to the AND condition so Loop4 would never run. An OR condition needs to be added to the output to run loop 4.
Final settings in Tunerstudio shown below.