auto-sync

This commit is contained in:
rusEfi 2015-04-03 22:10:08 -05:00
parent f479be80df
commit 3f841aead2
12 changed files with 37 additions and 27 deletions

View File

@ -82,7 +82,7 @@ void setBmwE34(DECLARE_ENGINE_PARAMETER_F) {
boardConfiguration->idle.solenoidPinMode = OM_INVERTED;
boardConfiguration->idle.solenoidFrequency = 300;
// set_idle_pwm 50
boardConfiguration->idlePosition = 0.5;
boardConfiguration->idlePosition = 50;
// turbocharger boost control solenoid: TODO output: GPIOE_6
// water injection #1 TODO GPIOD_7

View File

@ -360,7 +360,7 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) {
boardConfiguration->idle.solenoidFrequency = 200;
// set_idle_position 50
boardConfiguration->idlePosition = 0.5;
boardConfiguration->idlePosition = 50;
engineConfiguration->targetIdleRpm = 1200;
// engineConfiguration->idleMode = IM_AUTO;
engineConfiguration->idleMode = IM_MANUAL;

View File

@ -1,4 +1,4 @@
// this section was generated by config_definition.jar on Fri Apr 03 20:20:44 EDT 2015
// this section was generated by config_definition.jar on Fri Apr 03 21:10:20 EDT 2015
// begin
#include "rusefi_types.h"
typedef struct {
@ -255,7 +255,7 @@ typedef struct {
*/
idle_hardware_s idle;
/**
* value between 0 and 1
* value between 0 and 100
* offset 20
*/
float idlePosition;
@ -1235,4 +1235,4 @@ typedef struct {
} engine_configuration_s;
// end
// this section was generated by config_definition.jar on Fri Apr 03 20:20:44 EDT 2015
// this section was generated by config_definition.jar on Fri Apr 03 21:10:20 EDT 2015

View File

@ -12,7 +12,7 @@
#include "engine_configuration.h"
#include "engine.h"
#define FLASH_DATA_VERSION 7599
#define FLASH_DATA_VERSION 7600
void readFromFlash(void);
void initFlash(Logging *sharedLogger, Engine *engine);

View File

@ -46,6 +46,11 @@ static SimplePwm idleValvePwm;
static StepperMotor iacMotor;
/**
* that's the position with CLT and IAT corrections
*/
static float actualIdlePosition = -1.0f;
/**
* Idle level calculation algorithm lives in idle_controller.cpp
*/
@ -75,17 +80,17 @@ static void setIdleValvePwm(percent_t value) {
if (value < 0.01 || value > 99.9)
return;
scheduleMsg(logger, "setting idle valve PWM %f", value);
float f = 0.01 * value;
boardConfiguration->idlePosition = f;
showIdleInfo();
/**
* currently idle level is an percent value (0-100 range), and PWM takes a float in the 0..1 range
* todo: unify?
*/
idleValvePwm.setSimplePwmDutyCycle(f);
idleValvePwm.setSimplePwmDutyCycle(value / 100);
}
static void setIdleValvePosition(int position) {
boardConfiguration->idlePosition = position;
if (boardConfiguration->useStepperIdle) {
iacMotor.targetPosition = position;
} else {
@ -153,7 +158,7 @@ void startIdleThread(Logging*sharedLogger, Engine *engine) {
* Start PWM for idleValvePin
*/
startSimplePwmExt(&idleValvePwm, "Idle Valve", boardConfiguration->idle.solenoidPin, &idlePin,
boardConfiguration->idle.solenoidFrequency, boardConfiguration->idlePosition,
boardConfiguration->idle.solenoidFrequency, boardConfiguration->idlePosition / 100,
applyIdleSolenoidPinState);
}

View File

@ -1,5 +1,5 @@
/**
* @file io_pins.c
* @file io_pins.cpp
* @brief It could be that the main purpose of this file is the status LED blinking
*
* @date Jan 24, 2013
@ -64,7 +64,7 @@ GPIO_TypeDef * getHwPort(brain_pin_e brainPin) {
firmwareError("Invalid brain_pin_e: %d", brainPin);
return GPIO_NULL;
}
return PORTS[brainPin / 16];
return PORTS[brainPin / PORT_SIZE];
}
ioportmask_t getHwPin(brain_pin_e brainPin) {
@ -74,7 +74,7 @@ ioportmask_t getHwPin(brain_pin_e brainPin) {
firmwareError("Invalid brain_pin_e: %d", brainPin);
return EFI_ERROR_CODE;
}
return brainPin % 16;
return brainPin % PORT_SIZE;
}
void outputPinRegisterExt2(const char *msg, OutputPin *output, brain_pin_e brainPin, pin_output_mode_e *outputMode) {

View File

@ -16,7 +16,7 @@
#include "chprintf.h"
#include "rusefi.h"
#define PIN_REPO_SIZE 7 * 16
#define PIN_REPO_SIZE 7 * PORT_SIZE
const char *PIN_USED[PIN_REPO_SIZE];
static int initialized = FALSE;
@ -70,8 +70,9 @@ static int getPortIndex(GPIO_TypeDef* port) {
static void reportPins(void) {
for (int i = 0; i < PIN_REPO_SIZE; i++) {
const char *name = PIN_USED[i];
if (name != NULL)
print("ping %d: %s\r\n", i, name);
if (name != NULL) {
print("pin %d: %s\r\n", i, name);
}
}
print("Total pins count: %d\r\n", totalPinsUsed);
@ -157,7 +158,7 @@ iomode_t getInputMode(pin_input_mode_e mode) {
static int getIndex(ioportid_t port, ioportmask_t pin) {
int portIndex = getPortIndex(port);
return portIndex * 16 + pin;
return portIndex * PORT_SIZE + pin;
}
const char * getPinFunction(brain_input_pin_e brainPin) {

View File

@ -21,27 +21,29 @@
void outputPinRegister(const char *msg, OutputPin *output, GPIO_TypeDef *port, uint32_t pin);
#endif /* __cplusplus */
#define PORT_SIZE 16
void initPinRepository(void);
brain_pin_e parseBrainPin(const char *str);
void mySetPadMode(const char *msg, ioportid_t port, ioportmask_t pin, iomode_t mode);
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
void initPinRepository(void);
const char *hwPortname(brain_pin_e brainPin);
brain_pin_e parseBrainPin(const char *str);
void mySetPadMode(const char *msg, ioportid_t port, ioportmask_t pin, iomode_t mode);
const char * getPinFunction(brain_input_pin_e brainPin);
void mySetPadMode2(const char *msg, brain_pin_e pin, iomode_t mode);
const char *portname(GPIO_TypeDef* GPIOx);
iomode_t getInputMode(pin_input_mode_e mode);
ioportmask_t getHwPin(brain_pin_e brainPin);
GPIO_TypeDef * getHwPort(brain_pin_e brainPin);
#ifdef __cplusplus
}
#endif /* __cplusplus */
iomode_t getInputMode(pin_input_mode_e mode);
void efiIcuStart(ICUDriver *icup, const ICUConfig *config);
ioportmask_t getHwPin(brain_pin_e brainPin);
GPIO_TypeDef * getHwPort(brain_pin_e brainPin);
#endif /* PIN_REPOSITORY_H_ */

View File

@ -54,7 +54,9 @@ StepperMotor::StepperMotor() {
currentPosition = 0;
targetPosition = 0;
directionPort = NULL;
directionPin = 0;
stepPort = NULL;
stepPin = 0;
}
void StepperMotor::pulse() {

View File

@ -267,7 +267,7 @@ struct_no_prefix board_configuration_s
idle_hardware_s idle;
float idlePosition;value between 0 and 1;"%", 1, 0, 0, 100, 0
float idlePosition;value between 0 and 100;"%", 1, 0, 0, 100, 0
brain_pin_e fuelPumpPin;
pin_output_mode_e fuelPumpPinMode;

View File

@ -40,7 +40,7 @@ enable2ndByteCanID = false
; see PAGE_0_SIZE in C source code
; CONFIG_DEFINITION_START
; this section was generated by ConfigDefinition.jar on Fri Apr 03 20:20:46 EDT 2015
; this section was generated by ConfigDefinition.jar on Fri Apr 03 21:10:22 EDT 2015
pageSize = 15288
page = 1

View File

@ -389,7 +389,7 @@ int tokenLength(const char *msgp) {
void initConsoleLogic(Logging *sharedLogger) {
logging = sharedLogger;
resetConsoleActions();
// resetConsoleActions();
addConsoleAction("help", helpCommand);
addConsoleActionI("echo", echo);
}