auto-sync

This commit is contained in:
rusEfi 2015-04-14 20:08:04 -04:00
parent 9530d884f0
commit 4e0f8021b2
7 changed files with 30 additions and 15 deletions

View File

@ -594,6 +594,9 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) {
boardConfiguration->idle.stepperStepPin = GPIO_UNASSIGNED;
boardConfiguration->idle.stepperDirectionPin = GPIO_UNASSIGNED;
engineConfiguration->idleStepperReactionTime = 10;
engineConfiguration->idleStepperTotalSteps = 150;
engineConfiguration->mapAccelLength = 6;
engineConfiguration->mapAccelEnrichmentThreshold = 5; // kPa
engineConfiguration->mapAccelEnrichmentMultiplier = 2;

View File

@ -1,4 +1,4 @@
// this section was generated by config_definition.jar on Tue Apr 14 17:41:48 EDT 2015
// this section was generated by config_definition.jar on Tue Apr 14 19:23:48 EDT 2015
// begin
#include "rusefi_types.h"
typedef struct {
@ -1059,7 +1059,7 @@ typedef struct {
/**
* offset 1548
*/
int unusedCP;
float idleStepperReactionTime;
/**
* offset 1552
*/
@ -1087,7 +1087,11 @@ typedef struct {
/**
* offset 1636
*/
int unused3[137];
int idleStepperTotalSteps;
/**
* offset 1640
*/
int unused3[136];
/**
* offset 2184
*/
@ -1267,4 +1271,4 @@ typedef struct {
} persistent_config_s;
// end
// this section was generated by config_definition.jar on Tue Apr 14 17:41:48 EDT 2015
// this section was generated by config_definition.jar on Tue Apr 14 19:23:48 EDT 2015

View File

@ -153,7 +153,9 @@ void startIdleThread(Logging*sharedLogger, Engine *engine) {
logger = sharedLogger;
if (boardConfiguration->useStepperIdle) {
iacMotor.initialize(boardConfiguration->idle.stepperStepPin, boardConfiguration->idle.stepperDirectionPin);
iacMotor.initialize(boardConfiguration->idle.stepperStepPin, boardConfiguration->idle.stepperDirectionPin,
engineConfiguration->idleStepperReactionTime,
engineConfiguration->idleStepperTotalSteps);
} else {
/**
* Start PWM for idleValvePin

View File

@ -12,15 +12,13 @@
#define ST_DELAY_MS 10
#define ST_COUNT 100
static msg_t stThread(StepperMotor *motor) {
chRegSetThreadName("stepper");
palWritePad(motor->directionPort, motor->directionPin, false);
// let's park the motor in a known position to begin with
for (int i = 0; i < ST_COUNT; i++) {
for (int i = 0; i < motor->totalSteps; i++) {
motor->pulse();
}
@ -57,6 +55,8 @@ StepperMotor::StepperMotor() {
directionPin = 0;
stepPort = NULL;
stepPin = 0;
reactionTime = 0;
totalSteps = 0;
}
void StepperMotor::pulse() {
@ -66,7 +66,9 @@ void StepperMotor::pulse() {
chThdSleepMilliseconds(ST_DELAY_MS);
}
void StepperMotor::initialize(brain_pin_e stepPin, brain_pin_e directionPin) {
void StepperMotor::initialize(brain_pin_e stepPin, brain_pin_e directionPin, float reactionTime, int totalSteps) {
this->reactionTime = reactionTime;
this->totalSteps = totalSteps;
if (stepPin == GPIO_UNASSIGNED || directionPin == GPIO_UNASSIGNED) {
return;
}

View File

@ -12,13 +12,15 @@
class StepperMotor {
public:
StepperMotor();
void initialize(brain_pin_e stepPin, brain_pin_e directionPin);
void initialize(brain_pin_e stepPin, brain_pin_e directionPin, float reactionTime, int totalSteps);
void pulse();
GPIO_TypeDef * directionPort;
ioportmask_t directionPin;
int currentPosition;
int targetPosition;
float reactionTime;
int totalSteps;
private:

View File

@ -473,7 +473,7 @@ bit hasMapSensor;@see isMapAveragingEnabled
float cylinderBore;Cylinder diameter, in mm.
int unusedCP;
float idleStepperReactionTime;
float hipThreshold;
custom pin_input_mode_e 4 scalar, F32, @OFFSET@, "ms", 1, 0, 0, 200, 1
@ -483,7 +483,8 @@ custom pin_input_mode_e 4 scalar, F32, @OFFSET@, "ms", 1, 0, 0, 200, 1
float alternatorControlPFactor;
float alternatorControlIFactor;
float alternatorControlDFactor;
int[137] unused3;
int idleStepperTotalSteps;
int[136] unused3;
int tpsAccelLength;;"len", 1, 0, 1, 200, 3
float tpsAccelEnrichmentThreshold;;"roc", 1, 0, 0, 200, 3

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 Tue Apr 14 17:41:52 EDT 2015
; this section was generated by ConfigDefinition.jar on Tue Apr 14 19:23:50 EDT 2015
pageSize = 15288
page = 1
@ -428,7 +428,7 @@ page = 1
;skipping knockDetectionWindowStart offset 1536
;skipping knockDetectionWindowEnd offset 1540
;skipping cylinderBore offset 1544
;skipping unusedCP offset 1548
;skipping idleStepperReactionTime offset 1548
;skipping hipThreshold offset 1552
fsioInputModes1 = scalar, F32, 1556, "ms", 1, 0, 0, 200, 1
fsioInputModes2 = scalar, F32, 1560, "ms", 1, 0, 0, 200, 1
@ -450,7 +450,8 @@ page = 1
;skipping alternatorControlPFactor offset 1624
;skipping alternatorControlIFactor offset 1628
;skipping alternatorControlDFactor offset 1632
;skipping unused3 offset 1636
;skipping idleStepperTotalSteps offset 1636
;skipping unused3 offset 1640
tpsAccelLength = scalar, S32, 2184, "len", 1, 0, 1, 200, 3
tpsAccelEnrichmentThreshold = scalar, F32, 2188, "roc", 1, 0, 0, 200, 3
tpsAccelEnrichmentMultiplier = scalar, F32, 2192, "coeff", 1, 0, 0, 200, 3