auto-sync

This commit is contained in:
rusEfi 2015-04-25 22:09:28 -04:00
parent b03cb58454
commit fc3b92cf61
6 changed files with 41 additions and 14 deletions

View File

@ -451,7 +451,7 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) {
for (int i = 0; i < LE_COMMAND_COUNT; i++) {
boardConfiguration->fsioPins[i] = GPIO_UNASSIGNED;
config->le_formulas[i][0] = 0;
boardConfiguration->fsioInputs[i] = GPIO_UNASSIGNED;
boardConfiguration->fsioDigitalInputs[i] = GPIO_UNASSIGNED;
engineConfiguration->fsioInputModes[i] = PI_DEFAULT;
}
for (int i = 0; i < JOYSTICK_PIN_COUNT; i++) {

View File

@ -1,4 +1,4 @@
// this section was generated by config_definition.jar on Sat Apr 25 18:11:41 EDT 2015
// this section was generated by config_definition.jar on Sat Apr 25 21:03:34 EDT 2015
// begin
#include "rusefi_types.h"
typedef struct {
@ -623,9 +623,10 @@ typedef struct {
*/
pin_input_mode_e clutchUpPinMode;
/**
* These input pins allow us to pull toggle buttons state
* offset 804
*/
brain_pin_e fsioInputs[LE_COMMAND_COUNT];
brain_pin_e fsioDigitalInputs[LE_COMMAND_COUNT];
/**
* offset 868
*/
@ -1289,4 +1290,4 @@ typedef struct {
} persistent_config_s;
// end
// this section was generated by config_definition.jar on Sat Apr 25 18:11:41 EDT 2015
// this section was generated by config_definition.jar on Sat Apr 25 21:03:34 EDT 2015

View File

@ -98,7 +98,23 @@ float getLEValue(Engine *engine, calc_stack_t *s, le_action_e action) {
// todo: that's about bench test mode, wrong header for sure!
#include "injector_central.h"
static void setFsioPin(const char *indexStr, const char *pinName) {
static void setFsioInputPin(const char *indexStr, const char *pinName) {
int index = atoi(indexStr) - 1;
if (index < 0 || index >= LE_COMMAND_COUNT) {
scheduleMsg(logger, "invalid index %d", index);
return;
}
brain_pin_e pin = parseBrainPin(pinName);
// todo: extract method - code duplication with other 'set_xxx_pin' methods?
if (pin == GPIO_INVALID) {
scheduleMsg(logger, "invalid pin name [%s]", pinName);
return;
}
boardConfiguration->fsioDigitalInputs[index] = pin;
scheduleMsg(logger, "FSIO input pin #%d [%s]", (index + 1), hwPortname(pin));
}
static void setFsioOutputPin(const char *indexStr, const char *pinName) {
int index = atoi(indexStr) - 1;
if (index < 0 || index >= LE_COMMAND_COUNT) {
scheduleMsg(logger, "invalid index %d", index);
@ -111,7 +127,7 @@ static void setFsioPin(const char *indexStr, const char *pinName) {
return;
}
boardConfiguration->fsioPins[index] = pin;
scheduleMsg(logger, "FSIO pin #%d [%s]", (index + 1), hwPortname(pin));
scheduleMsg(logger, "FSIO output pin #%d [%s]", (index + 1), hwPortname(pin));
}
#endif
@ -267,6 +283,13 @@ static void showFsioInfo(void) {
scheduleMsg(logger, "user property #%d: %f", i + 1, v);
}
}
for (int i = 0; i < LE_COMMAND_COUNT; i++) {
brain_pin_e inputPin = boardConfiguration->fsioDigitalInputs[i];
if (inputPin != GPIO_UNASSIGNED) {
scheduleMsg(logger, "FSIO digital input #%d: %s", i, hwPortname(inputPin));
}
}
}
/**
@ -292,7 +315,7 @@ static void setFsioFrequency(int index, int frequency) {
scheduleMsg(logger, "Setting FSIO frequency %d on #%d", frequency, index + 1);
}
static void setUserOutput(const char *indexStr, const char *quotedLine, Engine *engine) {
static void setFsioExpression(const char *indexStr, const char *quotedLine, Engine *engine) {
int index = atoi(indexStr) - 1;
if (index < 0 || index >= LE_COMMAND_COUNT) {
scheduleMsg(logger, "invalid index %d", index);
@ -390,20 +413,22 @@ void initFsioImpl(Logging *sharedLogger, Engine *engine) {
}
for (int i = 0; i < LE_COMMAND_COUNT; i++) {
brain_pin_e inputPin = boardConfiguration->fsioInputs[i];
brain_pin_e inputPin = boardConfiguration->fsioDigitalInputs[i];
if (inputPin != GPIO_UNASSIGNED) {
mySetPadMode2("FSIO input", inputPin, getInputMode(engineConfiguration->fsioInputModes[i]));
}
}
#endif /* EFI_PROD_CODE */
addConsoleActionSSP("set_fsio", (VoidCharPtrCharPtrVoidPtr) setUserOutput, engine);
addConsoleActionSS("set_fsio_pin", (VoidCharPtrCharPtr) setFsioPin);
addConsoleActionII("set_fsio_frequency", (VoidIntInt) setFsioFrequency);
addConsoleActionSSP("set_fsio_expression", (VoidCharPtrCharPtrVoidPtr) setFsioExpression, engine);
addConsoleActionSS("set_fsio_output_pin", (VoidCharPtrCharPtr) setFsioOutputPin);
addConsoleActionII("set_fsio_output_frequency", (VoidIntInt) setFsioFrequency);
addConsoleActionFF("set_fsio_setting", setFsioSetting);
addConsoleActionSS("set_fsio_input_pin", (VoidCharPtrCharPtr) setFsioInputPin);
addConsoleAction("fsioinfo", showFsioInfo);
addConsoleActionSP("eval", (VoidCharPtrVoidPtr) eval, engine);

View File

@ -484,6 +484,7 @@ static void configureInputs(void) {
addChannel(engineConfiguration->cltAdcChannel, ADC_SLOW);
addChannel(engineConfiguration->iatAdcChannel, ADC_SLOW);
addChannel(engineConfiguration->afr.hwChannel, ADC_SLOW);
addChannel(engineConfiguration->acSwitchAdc, ADC_SLOW);
}
void initAdcInputs(bool boardTestMode) {

View File

@ -402,7 +402,7 @@ brain_pin_e vehicleSpeedSensorInputPin;
brain_pin_e clutchUpPin;Some vehicles have a switch to indicate that clutch pedal is all the way up
pin_input_mode_e clutchUpPinMode;
brain_pin_e[LE_COMMAND_COUNT iterate] fsioInputs;
brain_pin_e[LE_COMMAND_COUNT iterate] fsioDigitalInputs;These input pins allow us to pull toggle buttons state;
int unusedbs;

View File

@ -32,7 +32,7 @@ public class FlexibleControls {
panel.add(new JLabel("Human-readable"));
panel.add(normalForm);
panel.add(human2rpm);
panel.add(new JLabel("RPM form"));
panel.add(new JLabel("RPN form"));
panel.add(rpnForm);
normalForm.setText("(time_since_boot < 4) | (rpm > 0)");