mirror of https://github.com/rusefi/rusefi-1.git
auto-sync
This commit is contained in:
parent
770c680909
commit
775950e919
|
@ -21,7 +21,7 @@ static LoggingWithStorage logger;
|
|||
static SimplePwm pwmTest[5];
|
||||
|
||||
extern OutputPin warningPin;
|
||||
extern engine_pins_s enginePins;
|
||||
extern EnginePins enginePins;
|
||||
|
||||
EXTERN_ENGINE;
|
||||
|
||||
|
|
|
@ -230,26 +230,6 @@ void Engine::init(persistent_config_s *config) {
|
|||
memset(config, 0, sizeof(persistent_config_s));
|
||||
}
|
||||
|
||||
static bool stopPin(NamedOutputPin *output) {
|
||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||
if (output->isInitialized() && output->getLogicValue()) {
|
||||
output->setValue(false);
|
||||
scheduleMsg(&logger, "turning off %s", output->name);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Engine::stopPins() {
|
||||
bool result = false;
|
||||
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
|
||||
result |= stopPin(&enginePins.coils[i]);
|
||||
result |= stopPin(&enginePins.injectors[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void Engine::printKnockState(void) {
|
||||
scheduleMsg(&logger, "knock now=%s/ever=%s", boolToString(knockNow), boolToString(knockEver));
|
||||
}
|
||||
|
@ -287,7 +267,7 @@ void Engine::watchdog() {
|
|||
if (isRunningPwmTest)
|
||||
return;
|
||||
if (!isSpinning) {
|
||||
if (!isRunningBenchTest() && stopPins()) {
|
||||
if (!isRunningBenchTest() && enginePins.stopPins()) {
|
||||
firmwareError(CUSTOM_ERR_2ND_WATCHDOG, "Some pins were turned off by 2nd pass watchdog");
|
||||
}
|
||||
return;
|
||||
|
@ -318,7 +298,7 @@ void Engine::watchdog() {
|
|||
triggerInfo();
|
||||
#endif
|
||||
|
||||
stopPins();
|
||||
enginePins.stopPins();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -424,7 +424,6 @@ private:
|
|||
* 'spinning' means the engine is not stopped
|
||||
*/
|
||||
bool isSpinning;
|
||||
bool stopPins();
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -44,7 +44,7 @@ static LENameOrdinalPair leKnock(LE_METHOD_KNOCK, "knock");
|
|||
|
||||
#define LE_EVAL_POOL_SIZE 32
|
||||
|
||||
extern engine_pins_s enginePins;
|
||||
extern EnginePins enginePins;
|
||||
|
||||
static LECalculator evalCalc;
|
||||
static LEElement evalPoolElements[LE_EVAL_POOL_SIZE];
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#define MFI_BLINK_SEPARATOR 400
|
||||
#define MFI_CHECKENGINE_LIGHT 10000
|
||||
|
||||
extern engine_pins_s enginePins;
|
||||
extern EnginePins enginePins;
|
||||
|
||||
static THD_WORKING_AREA(mfiThreadStack, UTILITY_THREAD_STACK_SIZE); // declare thread
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
EXTERN_ENGINE
|
||||
;
|
||||
|
||||
extern engine_pins_s enginePins;
|
||||
extern EnginePins enginePins;
|
||||
|
||||
/**
|
||||
* @return number of milliseconds in one crank shaft revolution
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
pin_output_mode_e OUTPUT_MODE_DEFAULT = OM_DEFAULT;
|
||||
|
||||
// todo: clean this mess, this should become 'static'/private
|
||||
engine_pins_s enginePins;
|
||||
EnginePins enginePins;
|
||||
extern LoggingWithStorage sharedLogger;
|
||||
|
||||
NamedOutputPin::NamedOutputPin() : OutputPin() {
|
||||
name = NULL;
|
||||
|
@ -37,7 +38,7 @@ static const char *injectorNames[INJECTION_PIN_COUNT] = { "i1", "i2", "i3", "i4"
|
|||
"j9", "iA", "iB", "iC"};
|
||||
|
||||
|
||||
engine_pins_s::engine_pins_s() {
|
||||
EnginePins::EnginePins() {
|
||||
dizzyOutput.name = DIZZY_NAME;
|
||||
tachOut.name = TACH_NAME;
|
||||
|
||||
|
@ -49,7 +50,18 @@ engine_pins_s::engine_pins_s() {
|
|||
}
|
||||
}
|
||||
|
||||
void engine_pins_s::reset() {
|
||||
bool EnginePins::stopPins() {
|
||||
bool result = false;
|
||||
for (int i = 0; i < IGNITION_PIN_COUNT; i++) {
|
||||
result |= coils[i].stop();
|
||||
}
|
||||
for (int i = 0; i < INJECTION_PIN_COUNT; i++) {
|
||||
result |= injectors[i].stop();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void EnginePins::reset() {
|
||||
for (int i = 0; i < INJECTION_PIN_COUNT;i++) {
|
||||
injectors[i].reset();
|
||||
}
|
||||
|
@ -58,6 +70,17 @@ void engine_pins_s::reset() {
|
|||
}
|
||||
}
|
||||
|
||||
bool NamedOutputPin::stop() {
|
||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||
if (isInitialized() && getLogicValue()) {
|
||||
setValue(false);
|
||||
scheduleMsg(&sharedLogger, "turning off %s", name);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
void InjectorOutputPin::reset() {
|
||||
overlappingScheduleOffTime = 0;
|
||||
cancelNextTurningInjectorOff = false;
|
||||
|
|
|
@ -44,6 +44,10 @@ class NamedOutputPin : public OutputPin {
|
|||
public:
|
||||
NamedOutputPin();
|
||||
NamedOutputPin(const char *name);
|
||||
/**
|
||||
* @return true if pin was stopped
|
||||
*/
|
||||
bool stop();
|
||||
const char *name;
|
||||
};
|
||||
|
||||
|
@ -64,10 +68,11 @@ public:
|
|||
bool outOfOrder; // https://sourceforge.net/p/rusefi/tickets/319/
|
||||
};
|
||||
|
||||
class engine_pins_s {
|
||||
class EnginePins {
|
||||
public:
|
||||
engine_pins_s();
|
||||
EnginePins();
|
||||
void reset();
|
||||
bool stopPins();
|
||||
OutputPin mainRelay;
|
||||
OutputPin fanRelay;
|
||||
OutputPin acRelay;
|
||||
|
|
|
@ -93,7 +93,7 @@ typedef VirtualTimer virtual_timer_t;
|
|||
extern Engine _engine; \
|
||||
extern persistent_config_s *config; \
|
||||
extern engine_configuration2_s * engineConfiguration2; \
|
||||
extern engine_pins_s enginePins
|
||||
extern EnginePins enginePins
|
||||
|
||||
#define DECLARE_ENGINE_PARAMETER_F void
|
||||
#define DECLARE_ENGINE_PARAMETER_S
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
static NamedOutputPin intHold(HIP_NAME);
|
||||
|
||||
extern uint32_t lastExecutionCount;
|
||||
extern engine_pins_s enginePins;
|
||||
extern EnginePins enginePins;
|
||||
|
||||
uint32_t hipLastExecutionCount;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ extern board_configuration_s *boardConfiguration;
|
|||
static LoggingWithStorage logger("io_pins");
|
||||
|
||||
|
||||
extern engine_pins_s enginePins;
|
||||
extern EnginePins enginePins;
|
||||
|
||||
#if defined(STM32F4XX)
|
||||
static ioportid_t PORTS[] = { GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF, GPIOG, GPIOH };
|
||||
|
|
|
@ -119,11 +119,7 @@
|
|||
#include "engine_emulator.h"
|
||||
#endif /* EFI_ENGINE_EMULATOR */
|
||||
|
||||
#if FUEL_MATH_EXTREME_LOGGING
|
||||
LoggingWithStorage sharedLogger("main");
|
||||
#else
|
||||
static LoggingWithStorage sharedLogger("main");
|
||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||
|
||||
bool main_loop_started = false;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "advance_map.h"
|
||||
|
||||
extern int timeNow;
|
||||
extern engine_pins_s enginePins;
|
||||
extern EnginePins enginePins;
|
||||
|
||||
EngineTestHelper::EngineTestHelper(engine_type_e engineType) : engine (&persistentConfig) {
|
||||
ec = &persistentConfig.engineConfiguration;
|
||||
|
|
|
@ -35,7 +35,7 @@ typedef int bool_t;
|
|||
|
||||
#define CCM_OPTIONAL
|
||||
|
||||
#define EXTERN_ENGINE extern engine_pins_s enginePins
|
||||
#define EXTERN_ENGINE extern EnginePins enginePins
|
||||
|
||||
#ifdef __cplusplus
|
||||
class Engine;
|
||||
|
|
|
@ -286,7 +286,7 @@ static void assertREqualsM(const char *msg, void *expected, void *actual) {
|
|||
}
|
||||
|
||||
extern bool_t debugSignalExecutor;
|
||||
extern engine_pins_s enginePins;
|
||||
extern EnginePins enginePins;
|
||||
|
||||
// todo: move method body here after merge
|
||||
void assertEvent(const char *msg, int index, void *callback, efitime_t start, efitime_t momentX, long param);
|
||||
|
|
|
@ -103,7 +103,7 @@ void applyNewConfiguration(void);
|
|||
extern persistent_config_s *config; \
|
||||
extern persistent_config_container_s persistentState; \
|
||||
extern engine_configuration2_s * engineConfiguration2; \
|
||||
extern engine_pins_s enginePins
|
||||
extern EnginePins enginePins
|
||||
|
||||
#define DECLARE_ENGINE_PARAMETER_F void
|
||||
#define DECLARE_ENGINE_PARAMETER_S
|
||||
|
|
Loading…
Reference in New Issue