auto-sync

This commit is contained in:
rusEfi 2017-01-19 17:04:15 -05:00
parent b482a9f93c
commit 1070520d7d
9 changed files with 97 additions and 27 deletions

View File

@ -12,26 +12,11 @@
#include "fsio_core.h"
#include "engine.h"
#include "table_helper.h"
#include "system_fsio.h"
typedef Map3D<FSIO_TABLE_8, FSIO_TABLE_8, float> fsio8_Map3D_f32t;
typedef Map3D<FSIO_TABLE_8, FSIO_TABLE_8, uint8_t> fsio8_Map3D_u8t;
/**
* In human language that's
* (time_since_boot < 4) OR (rpm > 0)
*/
// todo: the delay should probably be configurable?
#define FUEL_PUMP_LOGIC "time_since_boot 4 < rpm 0 > OR"
#define AC_RELAY_LOGIC "ac_on_switch"
#define ALTERNATOR_LOGIC "vbatt 14.5 <"
/**
* In human language that's
* (fan and (coolant > fan_off_setting)) OR (coolant > fan_on_setting)
*/
#define FAN_CONTROL_LOGIC "fan coolant fan_off_setting > & coolant fan_on_setting > OR"
float getLEValue(Engine *engine, calc_stack_t *s, le_action_e action);
void setFsio(int index, brain_pin_e pin, const char * exp DECLARE_ENGINE_PARAMETER_S);

View File

@ -0,0 +1,25 @@
// this https://en.wikipedia.org/wiki/Reverse_Polish_notation is generated automatically
// from controllers/system_fsio.txt
// on 2017-01-19_16_29_03
//
//
// in this file we define system FSIO expressions
//
// see http://rusefi.com/wiki/index.php?title=Manual:Flexible_Logic
//
// Jan 19, 2017
// Andrey Belomutskiy, (c) 2012-2017
//
// Human-readable: (fan and (coolant > fan_off_setting)) | (coolant > fan_on_setting)
#define FAN_CONTROL_LOGIC "fan coolant fan_off_setting > & coolant fan_on_setting > |"
// todo: star-up priming time should probably be configurable?
// Human-readable: (time_since_boot < 4) | (rpm > 0)
#define FUEL_PUMP_LOGIC "time_since_boot 4 < rpm 0 > |"
// Human-readable: vbatt < 14.5
#define ALTERNATOR_LOGIC "vbatt 14.5 <"
// Human-readable: ac_on_switch
#define AC_RELAY_LOGIC "ac_on_switch"

View File

@ -1,5 +1,5 @@
#
# in this file we define system FSIO expression
# in this file we define system FSIO expressions
#
# see http://rusefi.com/wiki/index.php?title=Manual:Flexible_Logic
#
@ -9,9 +9,10 @@
FAN_CONTROL_LOGIC=(fan and (coolant > fan_off_setting)) OR (coolant > fan_on_setting)
FAN_CONTROL_LOGIC=(fan and (coolant > fan_off_setting)) | (coolant > fan_on_setting)
FUEL_PUMP_LOGIC=(time_since_boot < 4) OR (rpm > 0)
# todo: start-up fuel pump priming time should probably be configurable?
FUEL_PUMP_LOGIC=(time_since_boot < 4) | (rpm > 0)
ALTERNATOR_LOGIC=vbatt < 14.5

View File

@ -1 +1 @@
java -jar ../java_console_binary/rusefi_console.jar compile_fsio_file controllers/system_fsio.txt a
java -jar ../java_console_binary/rusefi_console.jar compile_fsio_file controllers/system_fsio.txt controllers/system_fsio.h

View File

@ -249,5 +249,5 @@ int getRusEfiVersion(void) {
return 123; // this is here to make the compiler happy about the unused array
if (UNUSED_CCM_SIZE[0] * 0 != 0)
return 3211; // this is here to make the compiler happy about the unused array
return 20170116;
return 20170119;
}

View File

@ -1,7 +1,5 @@
package com.fathzer.soft.javaluator;
import sun.security.provider.certpath.CollectionCertStore;
import java.util.*;
/** An abstract evaluator, able to evaluate infix expressions.

View File

@ -1,16 +1,76 @@
package com.rusefi;
import com.fathzer.soft.javaluator.DoubleEvaluator;
import java.io.*;
import java.util.List;
import static org.junit.Assert.assertEquals;
/**
* http://rusefi.com/wiki/index.php?title=Manual:Flexible_Logic
*
* <p/>
* (c) Andrey Belomutskiy 2013-2017
* 1/19/2017
*/
public class CompileTool {
public static void run(List<String> args) {
public static void run(List<String> args) throws IOException {
System.out.println("Params " + args);
if (args.size() != 2) {
System.out.println("Please specify input file and output file name");
return;
}
String inputFileName = args.get(0);
System.out.println("Reading from " + inputFileName);
String outputFileName = args.get(1);
System.out.println("Writing to " + outputFileName);
BufferedReader br = new BufferedReader(new FileReader(inputFileName));
try (BufferedWriter bw = new BufferedWriter(new FileWriter(outputFileName))) {
bw.write("// this https://en.wikipedia.org/wiki/Reverse_Polish_notation is generated automatically\r\n");
bw.write("// from " + inputFileName + "\r\n");
bw.write("// on " + FileLog.getDate() + "\r\n//\r\n");
String line;
while ((line = br.readLine()) != null) {
line = line.trim();
// line = line.replaceAll("\\s+", " ");
handleOneFsioLine(line, bw);
}
}
System.out.println("Done!");
}
private static void handleOneFsioLine(String line, BufferedWriter bw) throws IOException {
if (line.isEmpty())
return;
if (line.charAt(0) == '#') {
// forwarding comment into the output
bw.write("//" + line.substring(1) + "\r\n");
return;
}
int indexOfEquals = line.indexOf('=');
if (indexOfEquals == -1) {
System.err.println("Unexpected line: " + line);
System.exit(-1);
}
String name = line.substring(0, indexOfEquals).trim();
String expression = line.substring(indexOfEquals + 1).trim();
DoubleEvaluator evaluator = new DoubleEvaluator();
evaluator.evaluate(expression.toLowerCase());
String rpn = evaluator.getRusEfi();
bw.write("\n// Human-readable: " + expression + "\r\n");
bw.write("#define " + name + " \"" + rpn + "\"\r\n");
}
}

View File

@ -39,7 +39,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
* @see EngineSnifferPanel
*/
public class Launcher {
public static final int CONSOLE_VERSION = 20170118;
public static final int CONSOLE_VERSION = 20170119;
public static final boolean SHOW_STIMULATOR = false;
private static final String TAB_INDEX = "main_tab";
protected static final String PORT_KEY = "port";
@ -255,7 +255,7 @@ public class Launcher {
public static void main(final String[] args) throws Exception {
String toolName = args.length == 0 ? null : args[0];
if ("compile_fsio_file".equalsIgnoreCase(toolName)) {
CompileTool.run(Arrays.asList(args).subList(1, args.length - 1));
CompileTool.run(Arrays.asList(args).subList(1, args.length));
return;
}

View File

@ -136,6 +136,7 @@ ASMSRC = $(PORTASM)
INCDIR = . \
$(PROJECT_DIR)/util \
$(PROJECT_DIR)/config/engines \
$(PROJECT_DIR)/controllers \
$(PROJECT_DIR)/controllers/sensors \
$(PROJECT_DIR)/controllers/algo \
$(PROJECT_DIR)/controllers/core \