Latency optimization using hearbeat bugfix
This commit is contained in:
@@ -65,10 +65,14 @@ void stop_intmodule_heartbeat()
|
||||
EXTI_Init(&EXTI_InitStructure);
|
||||
}
|
||||
|
||||
void check_xjt_heartbeat()
|
||||
void check_intmodule_heartbeat()
|
||||
{
|
||||
if (EXTI_GetITStatus(INTMODULE_HEARTBEAT_EXTI_LINE) != RESET) {
|
||||
heartbeatCapture.timestamp = TIMER_2MHz_TIMER->CNT;
|
||||
#if defined(PXX2)
|
||||
heartbeatCapture.timestamp = RTOS_GET_MS();
|
||||
#else
|
||||
heartbeatCapture.timestamp = getTmr2MHz();
|
||||
#endif
|
||||
heartbeatCapture.count++;
|
||||
EXTI_ClearITPendingBit(INTMODULE_HEARTBEAT_EXTI_LINE);
|
||||
}
|
||||
@@ -78,6 +82,6 @@ void check_xjt_heartbeat()
|
||||
#if defined(INTMODULE_HEARTBEAT) && !defined(INTMODULE_HEARTBEAT_REUSE_INTERRUPT_ROTARY_ENCODER)
|
||||
extern "C" void INTMODULE_HEARTBEAT_EXTI_IRQHandler()
|
||||
{
|
||||
check_xjt_heartbeat();
|
||||
check_intmodule_heartbeat();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -92,7 +92,7 @@ extern "C" void ROTARY_ENCODER_EXTI_IRQHandler1(void)
|
||||
#endif
|
||||
|
||||
#if !defined(BOOT) && defined(INTMODULE_HEARTBEAT_REUSE_INTERRUPT_ROTARY_ENCODER)
|
||||
check_xjt_heartbeat();
|
||||
check_intmodule_heartbeat();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -273,11 +273,11 @@ void extmoduleSendNextFrame();
|
||||
#if defined(INTMODULE_HEARTBEAT_GPIO)
|
||||
void init_intmodule_heartbeat();
|
||||
void stop_intmodule_heartbeat();
|
||||
void check_xjt_heartbeat();
|
||||
void check_intmodule_heartbeat();
|
||||
#else
|
||||
#define init_intmodule_heartbeat()
|
||||
#define stop_intmodule_heartbeat()
|
||||
#define check_xjt_heartbeat()
|
||||
#define check_intmodule_heartbeat()
|
||||
#endif
|
||||
|
||||
// SBUS
|
||||
|
||||
@@ -46,7 +46,7 @@ void intmoduleSendNextFrame()
|
||||
{
|
||||
uint32_t last = intmodulePulsesData.pxx.getLast();
|
||||
if (heartbeatCapture.valid) {
|
||||
if (TIMER_2MHz_TIMER->CNT - heartbeatCapture.timestamp > HEARBEAT_OFFSET)
|
||||
if (getTmr2MHz() - heartbeatCapture.timestamp > HEARBEAT_OFFSET)
|
||||
last -= 21;
|
||||
else
|
||||
last += 19;
|
||||
|
||||
Reference in New Issue
Block a user