log missed exti events (#4473)

* log missed exti events

* units

* s

* guard

* stub for non stm32
This commit is contained in:
Matthew Kennedy 2022-08-23 16:45:28 -07:00 committed by GitHub
parent a39d109ced
commit 58e27505db
4 changed files with 20 additions and 1 deletions

View File

@ -343,5 +343,7 @@ uint16_t rpmAcceleration;dRPM;"RPM/s",1, 0, 0, 5, 0
int16_t autoscale rawBattery;;"V",{1/@@PACK_MULT_VOLTAGE@@}, 0, 0, 5, 3
uint8_t[160 iterate] unusedAtTheEnd;;"",1, 0, 0, 0, 0
uint8_t extiOverflowCount;;"", 1, 0, 0, 255, 0
uint8_t[159 iterate] unusedAtTheEnd;;"",1, 0, 0, 0, 0
end_struct

View File

@ -54,6 +54,7 @@
#include "buffered_writer.h"
#include "dynoview.h"
#include "frequency_sensor.h"
#include "digital_input_exti.h"
extern bool main_loop_started;
@ -846,6 +847,9 @@ void updateTunerStudioState() {
tsOutputChannels->triggerVvtFall = engine->triggerCentral.vvtEventFallCounter[0];
#endif // EFI_SHAFT_POSITION_INPUT
#if HAL_USE_PAL && EFI_PROD_CODE
tsOutputChannels->extiOverflowCount = getExtiOverflowCounter();
#endif
switch (engineConfiguration->debugMode) {
case DBG_TPS_ACCEL:

View File

@ -161,6 +161,8 @@ private:
static ExtiQueue<ExtiQueueEntry, 32> queue;
static uint8_t overflowCounter = 0;
CH_IRQ_HANDLER(STM32_I2C1_EVENT_HANDLER) {
OSAL_IRQ_PROLOGUE();
@ -185,12 +187,18 @@ CH_IRQ_HANDLER(STM32_I2C1_EVENT_HANDLER) {
if (channel.Name) {
channel.Callback(channel.CallbackData, timestamp);
}
} else {
overflowCounter++;
}
}
OSAL_IRQ_EPILOGUE();
}
uint8_t getExtiOverflowCounter() {
return overflowCounter;
}
void handleExtiIsr(uint8_t index) {
// No need to lock anything, we're already the highest-pri interrupt!
@ -251,6 +259,10 @@ void efiExtiInit() {
void efiExtiEnablePin(const char *, brain_pin_e, uint32_t, ExtiCallback, void *) { }
void efiExtiDisablePin(brain_pin_e) { }
uint8_t getExtiOverflowCounter() {
return 0;
}
#endif
#endif /* HAL_USE_PAL && EFI_PROD_CODE */

View File

@ -14,4 +14,5 @@ using ExtiCallback = void(*)(void*, efitick_t);
void efiExtiInit();
void efiExtiEnablePin(const char *msg, brain_pin_e pin, uint32_t mode, ExtiCallback cb, void *cb_data);
void efiExtiDisablePin(brain_pin_e brainPin);
uint8_t getExtiOverflowCounter();
#endif /* HAL_USE_PAL */