auto-sync

This commit is contained in:
rusEfi 2016-09-04 00:03:27 -04:00
parent ec6ef53b7b
commit c70364e18b
7 changed files with 26 additions and 8 deletions

View File

@ -37,7 +37,7 @@ public:
* It's more efficient to handle all injectors together if that's the case
*/
bool isSimultanious;
NamedOutputPin *output;
InjectorOutputPin *output;
int injectorIndex;
bool isOverlapping;

View File

@ -70,12 +70,11 @@ void turnPinHigh(NamedOutputPin *output) {
// signal->hi_time = hTimeNow();
#endif /* EFI_DEFAILED_LOGGING */
#if EFI_GPIO || defined(__DOXYGEN__)
// turn the output level ACTIVE
// todo: this XOR should go inside the setOutputPinValue method
doSetOutputPinValue2(output, true);
// sleep for the needed duration
#endif
#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__)
// explicit check here is a performance optimization to speed up no-chart mode
if (ENGINE(isEngineChartEnabled)) {
@ -91,10 +90,8 @@ void turnPinHigh(NamedOutputPin *output) {
void turnPinLow(NamedOutputPin *output) {
efiAssertVoid(output!=NULL, "NULL turnPinLow");
#if EFI_GPIO || defined(__DOXYGEN__)
// turn off the output
doSetOutputPinValue2(output, false);
#endif /* EFI_GPIO */
#if EFI_DEFAILED_LOGGING || defined(__DOXYGEN__)
systime_t after = hTimeNow();

View File

@ -138,7 +138,7 @@ void initializeIgnitionActions(angle_t advance, angle_t dwellAngle,
void FuelSchedule::registerInjectionEvent(int injectorIndex, float angle, angle_t injectionDuration,
bool isSimultanious DECLARE_ENGINE_PARAMETER_S) {
NamedOutputPin *output = &enginePins.injectors[injectorIndex];
InjectorOutputPin *output = &enginePins.injectors[injectorIndex];
if (!isSimultanious && !isPinAssigned(output)) {
// todo: extract method for this index math

View File

@ -26,6 +26,15 @@ NamedOutputPin::NamedOutputPin(const char *name) : OutputPin() {
this->name = name;
}
InjectorOutputPin::InjectorOutputPin() : NamedOutputPin() {
reset();
}
void InjectorOutputPin::reset() {
overlappingScheduleOffTime = 0;
cancelNextTurningInjectorOff = false;
}
OutputPin::OutputPin() {
modePtr = &OUTPUT_MODE_DEFAULT;
#if EFI_PROD_CODE || defined(__DOXYGEN__)

View File

@ -47,6 +47,14 @@ public:
const char *name;
};
class InjectorOutputPin : public NamedOutputPin {
public:
InjectorOutputPin();
void reset();
efitimeus_t overlappingScheduleOffTime;
bool cancelNextTurningInjectorOff;
};
typedef struct {
OutputPin mainRelay;
OutputPin fanRelay;
@ -56,7 +64,7 @@ typedef struct {
// OutputPin alternatorField;
OutputPin errorLedPin;
NamedOutputPin injectors[INJECTION_PIN_COUNT];
InjectorOutputPin injectors[INJECTION_PIN_COUNT];
NamedOutputPin coils[IGNITION_PIN_COUNT];
OutputPin dizzyOutput;
} engine_pins_s;

View File

@ -296,7 +296,7 @@ void firmwareError(const char *errorMsg, ...) {
}
}
static char UNUSED_RAM_SIZE[900];
static char UNUSED_RAM_SIZE[700];
static char UNUSED_CCM_SIZE[8500] CCM_OPTIONAL;

View File

@ -15,11 +15,15 @@
#include "advance_map.h"
extern int timeNow;
extern engine_pins_s enginePins;
EngineTestHelper::EngineTestHelper(engine_type_e engineType) : engine (&persistentConfig) {
ec = &persistentConfig.engineConfiguration;
initEnginePinsNames();
for (int i = 0; i < INJECTION_PIN_COUNT;i++) {
enginePins.injectors[i].reset();
}
engineConfiguration = ec;
board_configuration_s * boardConfiguration = &engineConfiguration->bc;