#368 progress
This commit is contained in:
parent
dae0b1d790
commit
6798352dfd
|
@ -354,3 +354,30 @@ void handleSpark(bool limitedSpark, uint32_t trgEventIndex, int rpm
|
|||
void initSparkLogic(Logging *sharedLogger) {
|
||||
logger = sharedLogger;
|
||||
}
|
||||
|
||||
/**
|
||||
* Number of sparks per physical coil
|
||||
* @see getNumberOfInjections
|
||||
*/
|
||||
int getNumberOfSparks(ignition_mode_e mode DECLARE_ENGINE_PARAMETER_S) {
|
||||
switch (mode) {
|
||||
case IM_ONE_COIL:
|
||||
return engineConfiguration->specs.cylindersCount;
|
||||
case IM_INDIVIDUAL_COILS:
|
||||
return 1;
|
||||
case IM_WASTED_SPARK:
|
||||
return 2;
|
||||
default:
|
||||
firmwareError(CUSTOM_ERR_6108, "Unexpected ignition_mode_e %d", mode);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see getInjectorDutyCycle
|
||||
*/
|
||||
percent_t getCoilDutyCycle(int rpm DECLARE_ENGINE_PARAMETER_S) {
|
||||
floatms_t totalPerCycle = 1/**getInjectionDuration(rpm PASS_ENGINE_PARAMETER)*/ * getNumberOfSparks(engineConfiguration->ignitionMode PASS_ENGINE_PARAMETER);
|
||||
floatms_t engineCycleDuration = getCrankshaftRevolutionTimeMs(rpm) * (engineConfiguration->operationMode == TWO_STROKE ? 1 : 2);
|
||||
return 100 * totalPerCycle / engineCycleDuration;
|
||||
}
|
||||
|
|
|
@ -15,5 +15,7 @@ void handleSpark(bool limitedSpark, uint32_t trgEventIndex, int rpm DECLARE_ENGI
|
|||
void initSparkLogic(Logging *sharedLogger);
|
||||
void turnSparkPinHigh(IgnitionEvent *event);
|
||||
void turnSparkPinLow(IgnitionEvent *event);
|
||||
int getNumberOfSparks(ignition_mode_e mode DECLARE_ENGINE_PARAMETER_S);
|
||||
percent_t getCoilDutyCycle(int rpm DECLARE_ENGINE_PARAMETER_S);
|
||||
|
||||
#endif /* CONTROLLERS_TRIGGER_SPARK_LOGIC_H_ */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// This file was generated by Version2Header
|
||||
// Mon Feb 27 13:00:19 EST 2017
|
||||
// Mon Mar 06 19:03:42 EST 2017
|
||||
#ifndef VCS_VERSION
|
||||
#define VCS_VERSION "13021"
|
||||
#define VCS_VERSION "13123"
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue