auto-sync

This commit is contained in:
rusEfi 2015-02-07 10:05:28 -06:00
parent 29c56ac36c
commit 2fee72c75e
15 changed files with 61 additions and 61 deletions

View File

@ -9,25 +9,33 @@
#include "main.h" #include "main.h"
#include "GY6_139QMB.h" #include "GY6_139QMB.h"
#include "engine_math.h"
void setGy6139qmbDefaultEngineConfiguration(
engine_configuration_s *engineConfiguration) {
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
void setGy6139qmbDefaultEngineConfiguration(engine_configuration_s *engineConfiguration) {
engineConfiguration->rpmHardLimit = 9000; engineConfiguration->rpmHardLimit = 9000;
engineConfiguration->cranking.rpm = 800; engineConfiguration->cranking.rpm = 1100;
engineConfiguration->analogInputDividerCoefficient = 1.52; engineConfiguration->analogInputDividerCoefficient = 1.52;
engineConfiguration->algorithm = LM_MAP; engineConfiguration->algorithm = LM_MAP;
engineConfiguration->globalTriggerAngleOffset = 15; engineConfiguration->globalTriggerAngleOffset = 45;
engineConfiguration->bc.analogChartMode = AC_MAP; engineConfiguration->bc.analogChartMode = AC_MAP;
engineConfiguration->specs.displacement = 0.072; // 72cc
engineConfiguration->cylindersCount = 1; engineConfiguration->cylindersCount = 1;
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR); setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
engineConfiguration->firingOrder = FO_ONE_CYLINDER; engineConfiguration->firingOrder = FO_ONE_CYLINDER;
/** /**
* We treat the trigger as 1/0 toothed wheel * We treat the trigger as 8-1 toothed wheel
*/ */
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL; engineConfiguration->trigger.type = TT_TOOTHED_WHEEL;
engineConfiguration->trigger.customTotalToothCount = 1; engineConfiguration->trigger.customTotalToothCount = 8;
engineConfiguration->trigger.customSkippedToothCount = 0; engineConfiguration->trigger.customSkippedToothCount = 1;
engineConfiguration->trigger.customIsSynchronizationNeeded = false; engineConfiguration->trigger.customIsSynchronizationNeeded = true;
engineConfiguration->trigger.customNeedSecondTriggerInput = false; engineConfiguration->trigger.customNeedSecondTriggerInput = false;
boardConfiguration->injectionPins[0] = GPIOC_9;
boardConfiguration->ignitionPins[0] = GPIOC_8;
} }

View File

@ -9,7 +9,7 @@
#include "MiniCooperR50.h" #include "MiniCooperR50.h"
void setMiniCooperR50(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration) { void setMiniCooperR50(engine_configuration_s *engineConfiguration) {
engineConfiguration->trigger.type = TT_MINI_COOPER_R50; engineConfiguration->trigger.type = TT_MINI_COOPER_R50;
} }

View File

@ -11,6 +11,6 @@
#include "main.h" #include "main.h"
#include "engine_configuration.h" #include "engine_configuration.h"
void setMiniCooperR50(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration); void setMiniCooperR50(engine_configuration_s *engineConfiguration);
#endif /* MINICOOPERR50_H_ */ #endif /* MINICOOPERR50_H_ */

View File

@ -54,7 +54,9 @@ static const ignition_table_t tps_advance_table = {
}; };
void setCitroenBerlingoTU3JPConfiguration(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration) { void setCitroenBerlingoTU3JPConfiguration(engine_configuration_s *engineConfiguration) {
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
engineConfiguration->engineType = CITROEN_TU3JP; engineConfiguration->engineType = CITROEN_TU3JP;
/** /**

View File

@ -10,6 +10,6 @@
#include "engine_configuration.h" #include "engine_configuration.h"
void setCitroenBerlingoTU3JPConfiguration(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration); void setCitroenBerlingoTU3JPConfiguration(engine_configuration_s *engineConfiguration);
#endif /* CITROENBERLINGOTU3JP_H_ */ #endif /* CITROENBERLINGOTU3JP_H_ */

View File

@ -198,7 +198,9 @@ static void common079721_2351(engine_configuration_s *engineConfiguration, board
} }
void setMiata1990(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration) { void setMiata1990(engine_configuration_s *engineConfiguration) {
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
common079721_2351(engineConfiguration, boardConfiguration); common079721_2351(engineConfiguration, boardConfiguration);
commonMiataNa(engineConfiguration, boardConfiguration); commonMiataNa(engineConfiguration, boardConfiguration);
@ -402,7 +404,8 @@ static void setMiata1994_common(engine_configuration_s *engineConfiguration,
* Frankenso board * Frankenso board
* set_engine_type 20 * set_engine_type 20
*/ */
void setMiata1994_d(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration) { void setMiata1994_d(engine_configuration_s *engineConfiguration) {
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
setMiata1994_common(engineConfiguration, boardConfiguration); setMiata1994_common(engineConfiguration, boardConfiguration);
engineConfiguration->vbattDividerCoeff = ((float) (8.2 + 33)) / 8.2 * 2; engineConfiguration->vbattDividerCoeff = ((float) (8.2 + 33)) / 8.2 * 2;
/** /**
@ -417,7 +420,8 @@ void setMiata1994_d(engine_configuration_s *engineConfiguration, board_configura
boardConfiguration->idleValvePin = GPIO_UNASSIGNED; boardConfiguration->idleValvePin = GPIO_UNASSIGNED;
} }
void setMiata1994_s(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration) { void setMiata1994_s(engine_configuration_s *engineConfiguration) {
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
setMiata1994_common(engineConfiguration, boardConfiguration); setMiata1994_common(engineConfiguration, boardConfiguration);
engineConfiguration->vbattDividerCoeff = ((float) (10.0 + 33)) / 10 * 2; engineConfiguration->vbattDividerCoeff = ((float) (10.0 + 33)) / 10 * 2;
@ -459,7 +463,8 @@ void setMiata1994_s(engine_configuration_s *engineConfiguration, board_configura
/** /**
* Tom tomiata, Frankenstein board * Tom tomiata, Frankenstein board
*/ */
void setMiata1996(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration) { void setMiata1996(engine_configuration_s *engineConfiguration) {
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
commonMiataNa(engineConfiguration, boardConfiguration); commonMiataNa(engineConfiguration, boardConfiguration);
engineConfiguration->specs.displacement = 1.839; engineConfiguration->specs.displacement = 1.839;

View File

@ -15,9 +15,9 @@
#include "engine_configuration.h" #include "engine_configuration.h"
void setFordEscortGt(engine_configuration_s *engineConfiguration); void setFordEscortGt(engine_configuration_s *engineConfiguration);
void setMiata1990(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration); void setMiata1990(engine_configuration_s *engineConfiguration);
void setMiata1994_d(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration); void setMiata1994_d(engine_configuration_s *engineConfiguration);
void setMiata1994_s(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration); void setMiata1994_s(engine_configuration_s *engineConfiguration);
void setMiata1996(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration); void setMiata1996(engine_configuration_s *engineConfiguration);
#endif /* MAZDA_MIATA_H_ */ #endif /* MAZDA_MIATA_H_ */

View File

@ -10,8 +10,8 @@
#include "mazda_miata_nb.h" #include "mazda_miata_nb.h"
#include "thermistors.h" #include "thermistors.h"
void setMazdaMiataNbEngineConfiguration(engine_configuration_s *engineConfiguration, void setMazdaMiataNbEngineConfiguration(engine_configuration_s *engineConfiguration) {
board_configuration_s *boardConfiguration) { board_configuration_s *boardConfiguration = &engineConfiguration->bc;
// set_rpm_hard_limit 3000 // set_rpm_hard_limit 3000
engineConfiguration->rpmHardLimit = 3000; // yes, 3k. let's play it safe for now engineConfiguration->rpmHardLimit = 3000; // yes, 3k. let's play it safe for now

View File

@ -11,6 +11,6 @@
#include "main.h" #include "main.h"
#include "engine_configuration.h" #include "engine_configuration.h"
void setMazdaMiataNbEngineConfiguration(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration); void setMazdaMiataNbEngineConfiguration(engine_configuration_s *engineConfiguration);
#endif /* MAZDA_MIATA_NB_H_ */ #endif /* MAZDA_MIATA_NB_H_ */

View File

@ -23,7 +23,8 @@ void setFrankenstein_01_LCD(board_configuration_s *boardConfiguration) {
boardConfiguration->HD44780_db7 = GPIOB_13; boardConfiguration->HD44780_db7 = GPIOB_13;
} }
void setRoverv8(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration) { void setRoverv8(engine_configuration_s *engineConfiguration) {
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR); setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_36_1; engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_36_1;

View File

@ -10,7 +10,6 @@
#include "engine_configuration.h" #include "engine_configuration.h"
void setFrankenstein_01_LCD(board_configuration_s *boardConfiguration); void setFrankenstein_01_LCD(board_configuration_s *boardConfiguration);
void setRoverv8(engine_configuration_s *engineConfiguration, void setRoverv8(engine_configuration_s *engineConfiguration);
board_configuration_s *boardConfiguration);
#endif /* ROVER_V8_H_ */ #endif /* ROVER_V8_H_ */

View File

@ -592,7 +592,7 @@ void resetConfigurationExt(Logging * logger, engine_type_e engineType, Engine *e
setGy6139qmbDefaultEngineConfiguration(engineConfiguration); setGy6139qmbDefaultEngineConfiguration(engineConfiguration);
break; break;
case MAZDA_MIATA_NB: case MAZDA_MIATA_NB:
setMazdaMiataNbEngineConfiguration(engineConfiguration, boardConfiguration); setMazdaMiataNbEngineConfiguration(engineConfiguration);
break; break;
case MAZDA_323: case MAZDA_323:
setMazda323EngineConfiguration(engineConfiguration); setMazda323EngineConfiguration(engineConfiguration);
@ -604,28 +604,28 @@ void resetConfigurationExt(Logging * logger, engine_type_e engineType, Engine *e
setSaturnIonEngineConfiguration(engineConfiguration); setSaturnIonEngineConfiguration(engineConfiguration);
break; break;
case MINI_COOPER_R50: case MINI_COOPER_R50:
setMiniCooperR50(engineConfiguration, boardConfiguration); setMiniCooperR50(engineConfiguration);
break; break;
case FORD_ESCORT_GT: case FORD_ESCORT_GT:
setFordEscortGt(engineConfiguration); setFordEscortGt(engineConfiguration);
break; break;
case MIATA_1990: case MIATA_1990:
setMiata1990(engineConfiguration, boardConfiguration); setMiata1990(engineConfiguration);
break; break;
case MIATA_1994_DEVIATOR: case MIATA_1994_DEVIATOR:
setMiata1994_d(engineConfiguration, boardConfiguration); setMiata1994_d(engineConfiguration);
break; break;
case MIATA_1994_SPAGS: case MIATA_1994_SPAGS:
setMiata1994_s(engineConfiguration, boardConfiguration); setMiata1994_s(engineConfiguration);
break; break;
case MIATA_1996: case MIATA_1996:
setMiata1996(engineConfiguration, boardConfiguration); setMiata1996(engineConfiguration);
break; break;
case CITROEN_TU3JP: case CITROEN_TU3JP:
setCitroenBerlingoTU3JPConfiguration(engineConfiguration, boardConfiguration); setCitroenBerlingoTU3JPConfiguration(engineConfiguration);
break; break;
case ROVER_V8: case ROVER_V8:
setRoverv8(engineConfiguration, boardConfiguration); setRoverv8(engineConfiguration);
break; break;
case SUBARU_2003_WRX: case SUBARU_2003_WRX:
setSubaru2003Wrx(engineConfiguration); setSubaru2003Wrx(engineConfiguration);

10
firmware/temp.bat Normal file
View File

@ -0,0 +1,10 @@
rem this is about programming stm32 directly - i.e. without ST Link/SWD or anything.
rem you need this if you've burned your st-link or if you have naked stm32 chip soldered somewhere
arm-none-eabi-objcopy -O binary rusefi.elf rusefi.dfu
rem dfu-util-static.exe -a 0 -D fm_rusefi.dfu

View File

@ -144,7 +144,7 @@ int main(void) {
testMenuTree(); testMenuTree();
// resizeMap(); // resizeMap();
printf("Success 20150127\r\n"); printf("Success 20150207\r\n");
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -313,32 +313,6 @@ static void testTriggerDecoder3(const char *msg, engine_type_e type, int synchPo
printGapRatio = false; printGapRatio = false;
} }
void testGY6_139QMB(void) {
printf("*************************************************** testGY6_139QMB\r\n");
EngineTestHelper eth(GY6_139QMB);
engine_configuration_s *ec = eth.ec;
Engine *engine = &eth.engine;
engine_configuration_s *engineConfiguration = ec;
TriggerState state;
assertFalseM("shaft_is_synchronized", state.shaft_is_synchronized);
TriggerShape * shape = &eth.engine.triggerShape;
assertFalseM("shaft_is_synchronized", state.shaft_is_synchronized);
assertEquals(0, state.getCurrentIndex());
int now = 0;
state.decodeTriggerEvent(SHAFT_PRIMARY_UP, now++ PASS_ENGINE_PARAMETER);
assertTrueM("shaft_is_synchronized", state.shaft_is_synchronized);
assertEquals(0, state.getCurrentIndex());
state.decodeTriggerEvent(SHAFT_PRIMARY_DOWN, now++ PASS_ENGINE_PARAMETER);
assertTrueM("shaft_is_synchronized", state.shaft_is_synchronized);
assertEquals(1, state.getCurrentIndex());
}
extern EventQueue schedulingQueue; extern EventQueue schedulingQueue;
extern int mockTps; extern int mockTps;
@ -517,7 +491,8 @@ void testTriggerDecoder(void) {
test1995FordInline6TriggerDecoder(); test1995FordInline6TriggerDecoder();
testMazdaMianaNbDecoder(); testMazdaMianaNbDecoder();
testGY6_139QMB(); testTriggerDecoder2("testGY6_139QMB", GY6_139QMB, 0, 0.4375, 0.0);
testTriggerDecoder2("testFordEscortGt", FORD_ESCORT_GT, 0, 0.8096, 0.3844); testTriggerDecoder2("testFordEscortGt", FORD_ESCORT_GT, 0, 0.8096, 0.3844);
testTriggerDecoder2("testMiniCooper", MINI_COOPER_R50, 121, 0.5222, 0.4959); testTriggerDecoder2("testMiniCooper", MINI_COOPER_R50, 121, 0.5222, 0.4959);
testTriggerDecoder2("testRoverV8", ROVER_V8, 0, 0.4861, 0); testTriggerDecoder2("testRoverV8", ROVER_V8, 0, 0.4861, 0);