Difference between revisions of "Manual:Flexible Logic"

From rusEfi
Jump to navigation Jump to search
Line 13: Line 13:
  
  
''set_fsio 0 "rpm"''
+
''set_fsio 1 "rpm"''
  
 
''set_fsio_pin 1 pd11''
 
''set_fsio_pin 1 pd11''
Line 20: Line 20:
  
 
See https://svn.code.sf.net/p/rusefi/code/trunk/firmware/controllers/core/le_functions.cpp for list of available methods
 
See https://svn.code.sf.net/p/rusefi/code/trunk/firmware/controllers/core/le_functions.cpp for list of available methods
 +
 +
== More Examples ==
 +
 +
Let's set FSIO channel #1 to output 100Hz PWM
 +
 +
''set_fsio_frequency 1 100''
 +
 +
Now, let's assume we want duty cycle to be 10% if rpm is below 1000, 90% if rpm is above 5000, and have it grow linearly from 10% to 90% between 1000 rpm and 5000 rpm. The human-readable expression for that would be
 +
 +
if (rpm < 1000, 0.1, if (rpm > 5000, 0.9, 0.1 + (rpm - 1000) / 4000 * 0.8))

Revision as of 19:40, 4 December 2014

Flexible Logic is the fanciest-schmanciest feature of rusEfi.

Flexible Logic allows advanced users to get unprecedented level of configurability for custom outputs and engine control.

Fuel pump is already using this mechanism - see https://svn.code.sf.net/p/rusefi/code/trunk/firmware/controllers/core/le_functions.h

Here's a command to try:

eval "2 3 +"


eval "rpm 100 max"


set_fsio 1 "rpm"

set_fsio_pin 1 pd11


See https://svn.code.sf.net/p/rusefi/code/trunk/firmware/controllers/core/le_functions.cpp for list of available methods

More Examples

Let's set FSIO channel #1 to output 100Hz PWM

set_fsio_frequency 1 100

Now, let's assume we want duty cycle to be 10% if rpm is below 1000, 90% if rpm is above 5000, and have it grow linearly from 10% to 90% between 1000 rpm and 5000 rpm. The human-readable expression for that would be

if (rpm < 1000, 0.1, if (rpm > 5000, 0.9, 0.1 + (rpm - 1000) / 4000 * 0.8))