auto-sync

This commit is contained in:
rusEfi 2014-11-22 14:03:12 -06:00
parent 064af6a3e4
commit 11670b61e0
5 changed files with 18 additions and 10 deletions

View File

@ -292,6 +292,7 @@ void setDefaultConfiguration(engine_configuration_s *engineConfiguration, board_
engineConfiguration->isDigitalChartEnabled = true;
boardConfiguration->idleSolenoidFrequency = 200;
boardConfiguration->idleSolenoidPwm = 0.5;
// engineConfiguration->idleMode = IM_AUTO;
engineConfiguration->idleMode = IM_MANUAL;

View File

@ -228,7 +228,12 @@ typedef struct {
brain_pin_e triggerErrorPin;
pin_output_mode_e triggerErrorPinMode;
int unusedbs[52];
/**
* value between 0 and 1
*/
float idleSolenoidPwm;
int unusedbs[51];
le_formula_t le_formulas[LE_COMMAND_COUNT];

View File

@ -12,7 +12,7 @@
#include "engine_configuration.h"
#include "engine.h"
#define FLASH_DATA_VERSION 5452
#define FLASH_DATA_VERSION 5466
void readFromFlash(void);
void initFlash(Engine *engine);

View File

@ -61,17 +61,23 @@ void idleDebug(const char *msg, int value) {
scheduleLogging(&logger);
}
static void showIdleInfo(void) {
scheduleMsg(&logger, "isIdleControlActive=%d", engineConfiguration->idleMode);
scheduleMsg(&logger, "idle valve freq=%d on %s", boardConfiguration->idleSolenoidFrequency,
hwPortname(boardConfiguration->idleValvePin));
}
static void setIdleControlEnabled(int value, Engine *engine) {
engineConfiguration->idleMode = value ? IM_MANUAL : IM_AUTO;
scheduleMsg(&logger, "isIdleControlActive=%d", engineConfiguration->idleMode);
showIdleInfo();
}
static void setIdleValvePwm(int value) {
// todo: change parameter type, maybe change parameter validation?
if (value < 1 || value > 999)
return;
scheduleMsg(&logger, "setting idle valve PWM %d @%d on %s", value, boardConfiguration->idleSolenoidFrequency,
hwPortname(boardConfiguration->idleValvePin));
scheduleMsg(&logger, "setting idle valve PWM %d", value);
showIdleInfo();
/**
* currently idle level is an integer per mil (0-1000 range), and PWM takes a float in the 0..1 range
* todo: unify?
@ -134,6 +140,7 @@ void startIdleThread(Engine *engine) {
// this switch is not used yet
mySetPadMode2("idle switch", boardConfiguration->idleSwitchPin, PAL_MODE_INPUT);
addConsoleAction("idleinfo", showIdleInfo);
addConsoleActionI("set_idle_rpm", setIdleRpmAction);
addConsoleActionI("set_idle_pwm", setIdleValvePwm);
addConsoleActionIP("set_idle_enabled", (VoidIntVoidPtr)setIdleControlEnabled, engine);

View File

@ -206,10 +206,6 @@ static void setTimingMode(int value) {
incrementGlobalConfigurationVersion();
}
static void setIdleMode(int mode) {
engineConfiguration->idleMode = (idle_mode_e) mode;
}
void setEngineType(int value) {
engineConfiguration->engineType = (engine_type_e) value;
resetConfigurationExt(&logger, (engine_type_e) value, engine);
@ -766,7 +762,6 @@ void initSettings(engine_configuration_s *engineConfiguration) {
addConsoleActionI("set_fixed_mode_timing", setFixedModeTiming);
addConsoleActionI("set_timing_mode", setTimingMode);
addConsoleActionI("set_engine_type", setEngineType);
addConsoleActionI("set_idle_mode", setIdleMode);
addConsoleActionI("set_injection_pin_mode", setInjectionPinMode);
addConsoleActionI("set_ignition_pin_mode", setIgnitionPinMode);