Manual:Flexible Logic

From rusEfi
Revision as of 21:22, 4 December 2014 by Russian (talk | contribs)
Jump to navigation Jump to search

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. rusEfi supports up to 16 flexible outputs, each of these could be either an on/off or PWM signal. In case of a PWM signal the frequency is defined in the configuration and the duty cycle is dynamically controlled by the evaluated expression.

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

Here are some commands to try:

eval "2 3 +"


eval "rpm 100 max"


eval "100 200 1 if"


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))