Fix pulse timing issue

This commit is contained in:
3djc
2021-06-23 06:27:39 +02:00
committed by Raphael Coeffic
parent 546a139b40
commit 90c730d5da
2 changed files with 9 additions and 8 deletions
+7 -7
View File
@@ -268,12 +268,12 @@ void enablePulsesExternalModule(uint8_t protocol)
#if defined(PXX2) && defined(EXTMODULE_USART)
case PROTOCOL_CHANNELS_PXX2_HIGHSPEED:
extmoduleInvertedSerialStart(PXX2_HIGHSPEED_BAUDRATE);
mixerSchedulerSetPeriod(EXTERNAL_MODULE, PXX2_PERIOD);
mixerSchedulerSetPeriod(EXTERNAL_MODULE, PXX2_NO_HEARTBEAT_PERIOD);
break;
case PROTOCOL_CHANNELS_PXX2_LOWSPEED:
extmoduleInvertedSerialStart(PXX2_LOWSPEED_BAUDRATE);
mixerSchedulerSetPeriod(EXTERNAL_MODULE, PXX2_PERIOD);
mixerSchedulerSetPeriod(EXTERNAL_MODULE, PXX2_NO_HEARTBEAT_PERIOD);
break;
#endif
@@ -347,7 +347,7 @@ bool setupPulsesExternalModule(uint8_t protocol)
case PROTOCOL_CHANNELS_PXX2_LOWSPEED:
extmodulePulsesData.pxx2.setupFrame(EXTERNAL_MODULE);
#if defined(PCBSKY9X)
sheduleNextMixerCalculation(EXTERNAL_MODULE, PXX2_PERIOD);
sheduleNextMixerCalculation(EXTERNAL_MODULE, PXX2_NO_HEARTBEAT_PERIOD);
#endif
return true;
#endif
@@ -487,9 +487,9 @@ static void enablePulsesInternalModule(uint8_t protocol)
#if defined(INTMODULE_HEARTBEAT)
// use backup trigger (1 ms later)
init_intmodule_heartbeat();
mixerSchedulerSetPeriod(INTERNAL_MODULE, PXX2_PERIOD + 1000/*us*/);
mixerSchedulerSetPeriod(INTERNAL_MODULE, PXX2_MAX_HEARTBEAT_PERIOD);
#else
mixerSchedulerSetPeriod(INTERNAL_MODULE, PXX2_PERIOD);
mixerSchedulerSetPeriod(INTERNAL_MODULE, PXX2_NO_HEARTBEAT_PERIOD);
#endif
break;
#endif
@@ -547,9 +547,9 @@ bool setupPulsesInternalModule(uint8_t protocol)
else {
#if defined(INTMODULE_HEARTBEAT)
mixerSchedulerResetTimer();
mixerSchedulerSetPeriod(INTERNAL_MODULE, PXX2_PERIOD + 2000 /* backup */);
mixerSchedulerSetPeriod(INTERNAL_MODULE, PXX2_MAX_HEARTBEAT_PERIOD);
#else
mixerSchedulerSetPeriod(INTERNAL_MODULE, PXX2_PERIOD);
mixerSchedulerSetPeriod(INTERNAL_MODULE, PXX2_NO_HEARTBEAT_PERIOD);
#endif
}
return result;
+2 -1
View File
@@ -29,7 +29,8 @@
#define PXX2_LOWSPEED_BAUDRATE 230400
#define PXX2_HIGHSPEED_BAUDRATE 450000
#define PXX2_PERIOD 4000/*us*/
#define PXX2_NO_HEARTBEAT_PERIOD 4000/*us*/
#define PXX2_MAX_HEARTBEAT_PERIOD (7000 + 1000)/*us 7ms frame rate + 1ms heartbeat backup*/
#define PXX2_TOOLS_PERIOD 1000/*us*/
#define PXX2_FRAME_MAXLENGTH 64