mirror of https://github.com/FOME-Tech/fome-fw.git
auto-sync
This commit is contained in:
parent
2514c05a8a
commit
84b71b475b
|
@ -13,7 +13,7 @@
|
||||||
#define EFI_USE_CCM TRUE
|
#define EFI_USE_CCM TRUE
|
||||||
|
|
||||||
#ifndef EFI_ENABLE_ASSERTS
|
#ifndef EFI_ENABLE_ASSERTS
|
||||||
#define EFI_ENABLE_ASSERTS TRUE
|
#define EFI_ENABLE_ASSERTS FALSE
|
||||||
#endif /* EFI_ENABLE_ASSERTS */
|
#endif /* EFI_ENABLE_ASSERTS */
|
||||||
|
|
||||||
//#define EFI_UART_ECHO_TEST_MODE TRUE
|
//#define EFI_UART_ECHO_TEST_MODE TRUE
|
||||||
|
|
|
@ -25,12 +25,15 @@
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "signal_executor.h"
|
#include "signal_executor.h"
|
||||||
#include "efiGpio.h"
|
#include "efiGpio.h"
|
||||||
|
#include "engine.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signal executors feed digital events right into WaveChart used by Sniffer tab of Dev Console
|
* Signal executors feed digital events right into WaveChart used by Sniffer tab of Dev Console
|
||||||
*/
|
*/
|
||||||
#include "rpm_calculator.h"
|
#include "rpm_calculator.h"
|
||||||
|
|
||||||
|
EXTERN_ENGINE;
|
||||||
|
|
||||||
#include "wave_chart.h"
|
#include "wave_chart.h"
|
||||||
extern WaveChart waveChart;
|
extern WaveChart waveChart;
|
||||||
|
|
||||||
|
@ -38,6 +41,9 @@ extern WaveChart waveChart;
|
||||||
static Logging logger;
|
static Logging logger;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern OutputPin outputs[IO_PIN_COUNT];
|
||||||
|
extern pin_output_mode_e *pinDefaultState[IO_PIN_COUNT];
|
||||||
|
|
||||||
void initSignalExecutor(void) {
|
void initSignalExecutor(void) {
|
||||||
#if EFI_PROD_CODE || EFI_SIMULATOR
|
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||||
initLogging(&logger, "s exec");
|
initLogging(&logger, "s exec");
|
||||||
|
@ -60,32 +66,25 @@ void turnPinHigh(io_pin_e pin) {
|
||||||
#endif /* EFI_DEFAILED_LOGGING */
|
#endif /* EFI_DEFAILED_LOGGING */
|
||||||
// turn the output level ACTIVE
|
// turn the output level ACTIVE
|
||||||
// todo: this XOR should go inside the setOutputPinValue method
|
// todo: this XOR should go inside the setOutputPinValue method
|
||||||
setOutputPinValue(pin, TRUE);
|
doSetOutputPinValue(pin, true);
|
||||||
// sleep for the needed duration
|
// sleep for the needed duration
|
||||||
|
|
||||||
#if EFI_PROD_CODE || EFI_SIMULATOR
|
|
||||||
// if (pin == SPARKOUT_1_OUTPUT || pin == SPARKOUT_3_OUTPUT) {
|
|
||||||
// time_t now = hTimeNow();
|
|
||||||
// float an = getCrankshaftAngle(now);
|
|
||||||
// scheduleMsg(&logger, "spark up%d %d", pin, now);
|
|
||||||
// scheduleMsg(&logger, "spark angle %d %f", (int)an, an);
|
|
||||||
// }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if EFI_WAVE_CHART
|
#if EFI_WAVE_CHART
|
||||||
// this is a performance optimization - array index is cheaper then invoking a method with 'switch'
|
// explicit check here is a performance optimization to speed up no-chart mode
|
||||||
const char *pinName = namedPinsArray[pin];
|
if (!engineConfiguration->isDigitalChartEnabled) {
|
||||||
|
// this is a performance optimization - array index is cheaper then invoking a method with 'switch'
|
||||||
|
const char *pinName = namedPinsArray[pin];
|
||||||
// dbgDurr = hal_lld_get_counter_value() - dbgStart;
|
// dbgDurr = hal_lld_get_counter_value() - dbgStart;
|
||||||
|
|
||||||
addWaveChartEvent(pinName, WC_UP);
|
addWaveChartEvent(pinName, WC_UP);
|
||||||
|
}
|
||||||
#endif /* EFI_WAVE_ANALYZER */
|
#endif /* EFI_WAVE_ANALYZER */
|
||||||
// dbgDurr = hal_lld_get_counter_value() - dbgStart;
|
// dbgDurr = hal_lld_get_counter_value() - dbgStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
void turnPinLow(io_pin_e pin) {
|
void turnPinLow(io_pin_e pin) {
|
||||||
// turn off the output
|
// turn off the output
|
||||||
// todo: this XOR should go inside the setOutputPinValue method
|
doSetOutputPinValue(pin, false);
|
||||||
setOutputPinValue(pin, false);
|
|
||||||
|
|
||||||
#if EFI_DEFAILED_LOGGING
|
#if EFI_DEFAILED_LOGGING
|
||||||
systime_t after = hTimeNow();
|
systime_t after = hTimeNow();
|
||||||
|
@ -94,10 +93,12 @@ void turnPinLow(io_pin_e pin) {
|
||||||
#endif /* EFI_DEFAILED_LOGGING */
|
#endif /* EFI_DEFAILED_LOGGING */
|
||||||
|
|
||||||
#if EFI_WAVE_CHART
|
#if EFI_WAVE_CHART
|
||||||
// this is a performance optimization - array index is cheaper then invoking a method with 'switch'
|
if (!engineConfiguration->isDigitalChartEnabled) {
|
||||||
const char *pinName = namedPinsArray[pin];
|
// this is a performance optimization - array index is cheaper then invoking a method with 'switch'
|
||||||
|
const char *pinName = namedPinsArray[pin];
|
||||||
|
|
||||||
addWaveChartEvent(pinName, WC_DOWN);
|
addWaveChartEvent(pinName, WC_DOWN);
|
||||||
|
}
|
||||||
#endif /* EFI_WAVE_ANALYZER */
|
#endif /* EFI_WAVE_ANALYZER */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,10 @@ static LEElementPool lePool(mainPool, LE_ELEMENT_POOL_SIZE);
|
||||||
static LEElement * fuelPumpLogic;
|
static LEElement * fuelPumpLogic;
|
||||||
static LEElement * radiatorFanLogic;
|
static LEElement * radiatorFanLogic;
|
||||||
|
|
||||||
|
extern OutputPin outputs[IO_PIN_COUNT];
|
||||||
|
extern pin_output_mode_e *pinDefaultState[IO_PIN_COUNT];
|
||||||
|
|
||||||
|
|
||||||
persistent_config_container_s persistentState CCM_OPTIONAL;
|
persistent_config_container_s persistentState CCM_OPTIONAL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -99,7 +99,7 @@ void onUnlockHook(void) {
|
||||||
if (t > maxLockTime) {
|
if (t > maxLockTime) {
|
||||||
maxLockTime = t;
|
maxLockTime = t;
|
||||||
}
|
}
|
||||||
// if (t > 10000) {
|
// if (t > 2800) {
|
||||||
// // uncomment this if you want a nice stop for a breakpoint
|
// // uncomment this if you want a nice stop for a breakpoint
|
||||||
// maxLockTime = t + 1;
|
// maxLockTime = t + 1;
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -96,18 +96,7 @@ extern uint32_t dbgStart;
|
||||||
extern uint32_t dbgDurr;
|
extern uint32_t dbgDurr;
|
||||||
|
|
||||||
void setOutputPinValue(io_pin_e pin, int logicValue) {
|
void setOutputPinValue(io_pin_e pin, int logicValue) {
|
||||||
#if EFI_PROD_CODE
|
doSetOutputPinValue(pin, logicValue);
|
||||||
if (outputs[pin].port != GPIO_NULL) {
|
|
||||||
efiAssertVoid(pinDefaultState[pin]!=NULL, "pin mode not initialized");
|
|
||||||
pin_output_mode_e mode = *pinDefaultState[pin];
|
|
||||||
efiAssertVoid(mode <= OM_OPENDRAIN_INVERTED, "invalid pin_output_mode_e");
|
|
||||||
#else
|
|
||||||
pin_output_mode_e mode = OM_DEFAULT;
|
|
||||||
#endif
|
|
||||||
OutputPin *output = &outputs[pin];
|
|
||||||
int eValue = getElectricalValue(logicValue, mode);
|
|
||||||
setPinValue(output, eValue, logicValue);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isPinAssigned(io_pin_e pin) {
|
bool isPinAssigned(io_pin_e pin) {
|
||||||
|
|
|
@ -79,6 +79,28 @@ void setOutputPinValue(io_pin_e pin, int logicValue);
|
||||||
bool isPinAssigned(io_pin_e pin);
|
bool isPinAssigned(io_pin_e pin);
|
||||||
const char *getPinName(io_pin_e io_pin);
|
const char *getPinName(io_pin_e io_pin);
|
||||||
|
|
||||||
|
|
||||||
|
#if EFI_PROD_CODE
|
||||||
|
#define doSetOutputPinValue(pin, logicValue) { \
|
||||||
|
if (outputs[(pin)].port != GPIO_NULL) { \
|
||||||
|
efiAssertVoid(pinDefaultState[pin]!=NULL, "pin mode not initialized"); \
|
||||||
|
pin_output_mode_e mode = *pinDefaultState[pin]; \
|
||||||
|
efiAssertVoid(mode <= OM_OPENDRAIN_INVERTED, "invalid pin_output_mode_e"); \
|
||||||
|
OutputPin *output = &outputs[pin]; \
|
||||||
|
int eValue = getElectricalValue(logicValue, mode); \
|
||||||
|
setPinValue(output, eValue, logicValue); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define doSetOutputPinValue(pin, logicValue) { \
|
||||||
|
pin_output_mode_e mode = OM_DEFAULT; \
|
||||||
|
OutputPin *output = &outputs[pin]; \
|
||||||
|
int eValue = getElectricalValue(logicValue, mode); \
|
||||||
|
setPinValue(output, eValue, logicValue); \
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
|
@ -76,6 +76,7 @@ uint64_t EventQueue::getNextEventTime(uint64_t nowX) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// static scheduling_s * longScheduling;
|
// static scheduling_s * longScheduling;
|
||||||
|
// static uint32_t cost;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoke all pending actions prior to specified timestamp
|
* Invoke all pending actions prior to specified timestamp
|
||||||
|
@ -111,7 +112,7 @@ bool EventQueue::executeAll(uint64_t now) {
|
||||||
// uint32_t before = hal_lld_get_counter_value();
|
// uint32_t before = hal_lld_get_counter_value();
|
||||||
current->callback(current->param);
|
current->callback(current->param);
|
||||||
// even with overflow it's safe to substract here
|
// even with overflow it's safe to substract here
|
||||||
// uint32_t cost = hal_lld_get_counter_value() - before;
|
// cost = hal_lld_get_counter_value() - before;
|
||||||
// if (cost > 2000) {
|
// if (cost > 2000) {
|
||||||
// longScheduling = current;
|
// longScheduling = current;
|
||||||
// cost++;
|
// cost++;
|
||||||
|
|
Loading…
Reference in New Issue