auto-sync

This commit is contained in:
rusEfi 2017-01-06 17:01:28 -05:00
parent d12047f1a3
commit f0566c887a
8 changed files with 33 additions and 34 deletions

View File

@ -123,13 +123,13 @@ static void apply(void) {
pid.updateFactors(engineConfiguration->etb.pFactor, engineConfiguration->etb.iFactor, 0); pid.updateFactors(engineConfiguration->etb.pFactor, engineConfiguration->etb.iFactor, 0);
} }
static void setEtbPFactor(float value) { void setEtbPFactor(float value) {
engineConfiguration->etb.pFactor = value; engineConfiguration->etb.pFactor = value;
apply(); apply();
showEthInfo(); showEthInfo();
} }
static void setEtbIFactor(float value) { void setEtbIFactor(float value) {
engineConfiguration->etb.iFactor = value; engineConfiguration->etb.iFactor = value;
apply(); apply();
showEthInfo(); showEthInfo();
@ -172,9 +172,6 @@ void initElectronicThrottle(void) {
addConsoleAction("ethinfo", showEthInfo); addConsoleAction("ethinfo", showEthInfo);
addConsoleActionF("set_etb_p", setEtbPFactor);
addConsoleActionF("set_etb_i", setEtbIFactor);
apply(); apply();
chThdCreateStatic(etbTreadStack, sizeof(etbTreadStack), NORMALPRIO, (tfunc_t) etbThread, NULL); chThdCreateStatic(etbTreadStack, sizeof(etbTreadStack), NORMALPRIO, (tfunc_t) etbThread, NULL);

View File

@ -10,5 +10,7 @@
void initElectronicThrottle(void); void initElectronicThrottle(void);
void setDefaultEtbParameters(void); void setDefaultEtbParameters(void);
void setEtbPFactor(float value);
void setEtbIFactor(float value);
#endif /* ELECTRONIC_THROTTLE_H_ */ #endif /* ELECTRONIC_THROTTLE_H_ */

View File

@ -483,8 +483,6 @@ static void initMockVoltage(void) {
setCltVoltage(2); setCltVoltage(2);
#endif /* EFI_SIMULATOR */ #endif /* EFI_SIMULATOR */
addConsoleActionF("set_mock_clt_voltage", setCltVoltage);
#if EFI_SIMULATOR || defined(__DOXYGEN__) #if EFI_SIMULATOR || defined(__DOXYGEN__)
setIatVoltage(2); setIatVoltage(2);
#endif /* EFI_SIMULATOR */ #endif /* EFI_SIMULATOR */

View File

@ -83,7 +83,7 @@ static void showIdleInfo(void) {
engineConfiguration->idleDT); engineConfiguration->idleDT);
} }
static void setIdleControlEnabled(int value) { void setIdleControlEnabled(int value) {
engineConfiguration->idleMode = value ? IM_AUTO : IM_MANUAL; engineConfiguration->idleMode = value ? IM_AUTO : IM_MANUAL;
showIdleInfo(); showIdleInfo();
} }
@ -128,7 +128,7 @@ static void manualIdleController(int positionPercent) {
} }
} }
static void setIdleValvePosition(int positionPercent) { void setIdleValvePosition(int positionPercent) {
if (positionPercent < 1 || positionPercent > 99) if (positionPercent < 1 || positionPercent > 99)
return; return;
scheduleMsg(logger, "setting idle valve position %d", positionPercent); scheduleMsg(logger, "setting idle valve position %d", positionPercent);
@ -222,7 +222,7 @@ static msg_t ivThread(int param) {
#endif #endif
} }
static void setTargetRpm(int value) { void setTargetIdleRpm(int value) {
idlePositionController.setTargetRpm(value); idlePositionController.setTargetRpm(value);
scheduleMsg(logger, "target idle RPM %d", value); scheduleMsg(logger, "target idle RPM %d", value);
} }
@ -318,7 +318,6 @@ void startIdleThread(Logging*sharedLogger, Engine *engine) {
addConsoleAction("idleinfo", showIdleInfo); addConsoleAction("idleinfo", showIdleInfo);
addConsoleActionI("set_idle_position", setIdleValvePosition);
addConsoleActionI("set_idle_enabled", (VoidInt) setIdleControlEnabled); addConsoleActionI("set_idle_enabled", (VoidInt) setIdleControlEnabled);
@ -326,8 +325,6 @@ void startIdleThread(Logging*sharedLogger, Engine *engine) {
// split this whole file into manual controller and auto controller? move these commands into the file // split this whole file into manual controller and auto controller? move these commands into the file
// which would be dedicated to just auto-controller? // which would be dedicated to just auto-controller?
addConsoleActionI("set_idle_rpm", setTargetRpm);
addConsoleActionI("set_idle_dt", setIdleDT);
addConsoleAction("idlebench", startIdleBench); addConsoleAction("idlebench", startIdleBench);
apply(); apply();

View File

@ -12,6 +12,7 @@
#include "engine.h" #include "engine.h"
percent_t getIdlePosition(void); percent_t getIdlePosition(void);
void setIdleValvePosition(int positionPercent);
void startIdleThread(Logging*sharedLogger, Engine *engine); void startIdleThread(Logging*sharedLogger, Engine *engine);
void setDefaultIdleParameters(void); void setDefaultIdleParameters(void);
void startIdleBench(void); void startIdleBench(void);
@ -19,5 +20,8 @@ void setIdleDT(int value);
void setIdlePFactor(float value); void setIdlePFactor(float value);
void setIdleIFactor(float value); void setIdleIFactor(float value);
void setIdleDFactor(float value); void setIdleDFactor(float value);
void setIdleControlEnabled(int value);
void setTargetIdleRpm(int value);
void setIdleDT(int value);
#endif /* IDLE_THREAD_H_ */ #endif /* IDLE_THREAD_H_ */

View File

@ -26,6 +26,7 @@
#include "idle_thread.h" #include "idle_thread.h"
#if EFI_PROD_CODE || defined(__DOXYGEN__) #if EFI_PROD_CODE || defined(__DOXYGEN__)
#include "electronic_throttle.h"
#include "rtc_helper.h" #include "rtc_helper.h"
#include "rusefi.h" #include "rusefi.h"
#include "pin_repository.h" #include "pin_repository.h"
@ -970,6 +971,7 @@ command_f_s commandsF[] = {{"mock_iat_voltage", setIatVoltage},
{"mock_tps_voltage", setTpsVoltage}, {"mock_tps_voltage", setTpsVoltage},
{"mock_map_voltage", setMapVoltage}, {"mock_map_voltage", setMapVoltage},
{"mock_vbatt_voltage", setVBattVoltage}, {"mock_vbatt_voltage", setVBattVoltage},
{"mock_clt_voltage", setCltVoltage},
{"ignition_offset", setIgnitionOffset}, {"ignition_offset", setIgnitionOffset},
{"injection_offset", setInjectionOffset}, {"injection_offset", setInjectionOffset},
{"global_trigger_offset_angle", setGlobalTriggerAngleOffset}, {"global_trigger_offset_angle", setGlobalTriggerAngleOffset},
@ -989,9 +991,12 @@ command_f_s commandsF[] = {{"mock_iat_voltage", setIatVoltage},
{"idle_p", setIdlePFactor}, {"idle_p", setIdlePFactor},
{"idle_i", setIdleIFactor}, {"idle_i", setIdleIFactor},
{"idle_d", setIdleDFactor}, {"idle_d", setIdleDFactor},
#if EFI_PROD_CODE || defined(__DOXYGEN__)
{"etb_p", setEtbPFactor},
{"etb_i", setEtbIFactor},
#endif /* EFI_PROD_CODE */
// {"", }, // {"", },
// {"", },
// {"", },
// {"", }, // {"", },
// {"", }, // {"", },
// {"", }, // {"", },
@ -1020,9 +1025,9 @@ command_i_s commandsI[] = {{"ignition_mode", setIgnitionMode},
{"idle_solenoid_freq", setIdleSolenoidFrequency}, {"idle_solenoid_freq", setIdleSolenoidFrequency},
{"tps_accel_len", setTpsAccelLen}, {"tps_accel_len", setTpsAccelLen},
{"engine_load_accel_len", setEngineLoadAccelLen}, {"engine_load_accel_len", setEngineLoadAccelLen},
// {"", }, {"idle_position", setIdleValvePosition},
// {"", }, {"idle_rpm", setTargetIdleRpm},
// {"", }, {"idle_dt", setIdleDT},
// {"", }, // {"", },
// {"", }, // {"", },
// {"", }, // {"", },
@ -1113,15 +1118,6 @@ void initSettings(engine_configuration_s *engineConfiguration) {
addConsoleAction("tpsinfo", printTPSInfo); addConsoleAction("tpsinfo", printTPSInfo);
addConsoleAction("info", printAllInfo); addConsoleAction("info", printAllInfo);
addConsoleActionF("set_ignition_offset", setIgnitionOffset);
addConsoleActionF("set_injection_offset", setInjectionOffset);
addConsoleActionF("set_global_trigger_offset_angle", setGlobalTriggerAngleOffset);
addConsoleActionI("set_sensor_chart_mode", setSensorChartMode);
addConsoleActionI("set_fixed_mode_timing", setFixedModeTiming);
addConsoleActionI("set_timing_mode", setTimingMode);
addConsoleActionI("set_engine_type", setEngineType);
addConsoleActionF("set_global_fuel_correction", setGlobalFuelCorrection); addConsoleActionF("set_global_fuel_correction", setGlobalFuelCorrection);
addConsoleAction("set_one_coil_ignition", setOneCoilIgnition); addConsoleAction("set_one_coil_ignition", setOneCoilIgnition);

View File

@ -237,26 +237,26 @@ static void intHoldCallback(trigger_event_e ckpEventType, uint32_t index DECLARE
engine->m.hipCbTime = GET_TIMESTAMP() - engine->m.beforeHipCb; engine->m.hipCbTime = GET_TIMESTAMP() - engine->m.beforeHipCb;
} }
static void setMaxKnockSubDeg(int value){ void setMaxKnockSubDeg(int value) {
engineConfiguration->maxKnockSubDeg = value; engineConfiguration->maxKnockSubDeg = value;
showHipInfo(); showHipInfo();
} }
static void setKnockThresh(float value){ void setKnockThresh(float value) {
engineConfiguration->knockVThreshold = value; engineConfiguration->knockVThreshold = value;
showHipInfo(); showHipInfo();
} }
static void setPrescalerAndSDO(int value) { void setPrescalerAndSDO(int value) {
engineConfiguration->hip9011PrescalerAndSDO = value; engineConfiguration->hip9011PrescalerAndSDO = value;
} }
static void setBand(float value) { void setHipBand(float value) {
engineConfiguration->knockBandCustom = value; engineConfiguration->knockBandCustom = value;
showHipInfo(); showHipInfo();
} }
static void setGain(float value) { void setHipGain(float value) {
boardConfiguration->hip9011Gain = value; boardConfiguration->hip9011Gain = value;
showHipInfo(); showHipInfo();
} }
@ -442,8 +442,8 @@ void initHip9011(Logging *sharedLogger) {
// MOSI PB15 // MOSI PB15
// palSetPadMode(GPIOB, 15, PAL_MODE_ALTERNATE(EFI_SPI2_AF) | PAL_STM32_OTYPE_OPENDRAIN); // palSetPadMode(GPIOB, 15, PAL_MODE_ALTERNATE(EFI_SPI2_AF) | PAL_STM32_OTYPE_OPENDRAIN);
addConsoleActionF("set_gain", setGain); addConsoleActionF("set_gain", setHipGain);
addConsoleActionF("set_band", setBand); addConsoleActionF("set_band", setHipBand);
addConsoleActionI("set_hip_prescalerandsdo", setPrescalerAndSDO); addConsoleActionI("set_hip_prescalerandsdo", setPrescalerAndSDO);
addConsoleActionF("set_knock_threshold", setKnockThresh); addConsoleActionF("set_knock_threshold", setKnockThresh);
addConsoleActionI("set_max_knock_sub_deg", setMaxKnockSubDeg); addConsoleActionI("set_max_knock_sub_deg", setMaxKnockSubDeg);

View File

@ -56,5 +56,10 @@ typedef enum {
void initHip9011(Logging *sharedLogger); void initHip9011(Logging *sharedLogger);
void setHip9011FrankensoPinout(void); void setHip9011FrankensoPinout(void);
void hipAdcCallback(adcsample_t value); void hipAdcCallback(adcsample_t value);
void setHipGain(float value);
void setHipBand(float value);
void setPrescalerAndSDO(int value);
void setKnockThresh(float value);
void setMaxKnockSubDeg(int value);
#endif /* HIP9011_H_ */ #endif /* HIP9011_H_ */