Added support for Lemon-Rx DSMP
This commit is contained in:
committed by
Raphael Coeffic
parent
f09c10b49d
commit
9d5cd1876c
+45
-33
@@ -55,6 +55,32 @@ InternalModulePulsesData intmodulePulsesData __DMA;
|
||||
ExternalModulePulsesData extmodulePulsesData __DMA;
|
||||
TrainerPulsesData trainerPulsesData __DMA;
|
||||
|
||||
void restartModule(uint8_t idx)
|
||||
{
|
||||
if (idx == INTERNAL_MODULE) {
|
||||
if (!IS_INTERNAL_MODULE_ON()) return;
|
||||
} else if (idx == EXTERNAL_MODULE){
|
||||
if (!IS_EXTERNAL_MODULE_ON()) return;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
pauseMixerCalculations();
|
||||
pausePulses();
|
||||
|
||||
if (idx == INTERNAL_MODULE) INTERNAL_MODULE_OFF();
|
||||
else EXTERNAL_MODULE_OFF();
|
||||
|
||||
RTOS_WAIT_MS(20); // 20ms so that the pulses interrupt will reinit the frame rate
|
||||
telemetryProtocol = 255; // force telemetry port + module reinitialization
|
||||
|
||||
if (idx == INTERNAL_MODULE) INTERNAL_MODULE_ON();
|
||||
else EXTERNAL_MODULE_ON();
|
||||
|
||||
resumePulses();
|
||||
resumeMixerCalculations();
|
||||
}
|
||||
|
||||
// use only for PXX
|
||||
void ModuleState::startBind(BindInformation* destination,
|
||||
ModuleCallback bindCallback)
|
||||
@@ -69,39 +95,6 @@ void ModuleState::startBind(BindInformation* destination,
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_INTERNAL_MODULE)
|
||||
void restartInternalModule()
|
||||
{
|
||||
if (!IS_INTERNAL_MODULE_ON()) {
|
||||
return;
|
||||
}
|
||||
pauseMixerCalculations();
|
||||
pausePulses();
|
||||
INTERNAL_MODULE_OFF();
|
||||
RTOS_WAIT_MS(20); // 20ms so that the pulses interrupt will reinit the frame rate
|
||||
telemetryProtocol = 255; // force telemetry port + module reinitialization
|
||||
INTERNAL_MODULE_ON();
|
||||
resumePulses();
|
||||
resumeMixerCalculations();
|
||||
}
|
||||
#endif
|
||||
#if defined(HARDWARE_EXTERNAL_MODULE)
|
||||
void restartExternalModule()
|
||||
{
|
||||
if (!IS_EXTERNAL_MODULE_ON()) {
|
||||
return;
|
||||
}
|
||||
pauseMixerCalculations();
|
||||
pausePulses();
|
||||
EXTERNAL_MODULE_OFF();
|
||||
RTOS_WAIT_MS(20); // 20ms so that the pulses interrupt will reinit the frame rate
|
||||
telemetryProtocol = 255; // force telemetry port + module reinitialization
|
||||
EXTERNAL_MODULE_ON();
|
||||
resumePulses();
|
||||
resumeMixerCalculations();
|
||||
}
|
||||
#endif
|
||||
|
||||
void ModuleState::readModuleInformation(ModuleInformation* destination,
|
||||
int8_t first, int8_t last)
|
||||
{
|
||||
@@ -305,6 +298,10 @@ uint8_t getRequiredProtocol(uint8_t module)
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MODULE_TYPE_LEMON_DSMP:
|
||||
protocol = PROTOCOL_CHANNELS_DSMP;
|
||||
break;
|
||||
|
||||
default:
|
||||
protocol = PROTOCOL_CHANNELS_NONE;
|
||||
break;
|
||||
@@ -589,6 +586,11 @@ void enablePulsesExternalModule(uint8_t protocol)
|
||||
break;
|
||||
#endif
|
||||
|
||||
case PROTOCOL_CHANNELS_DSMP:
|
||||
extmoduleSerialStart();
|
||||
mixerSchedulerSetPeriod(EXTERNAL_MODULE, 11 * 1000 /* 11ms in us */);
|
||||
break;
|
||||
|
||||
default:
|
||||
// external module stopped, use default mixer period
|
||||
mixerSchedulerSetPeriod(EXTERNAL_MODULE, 0);
|
||||
@@ -670,6 +672,10 @@ bool setupPulsesExternalModule(uint8_t protocol)
|
||||
return true;
|
||||
#endif
|
||||
|
||||
case PROTOCOL_CHANNELS_DSMP:
|
||||
setupPulsesLemonDSMP();
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -730,6 +736,12 @@ void extmoduleSendNextFrame()
|
||||
extmodulePulsesData.dsm2.ptr - extmodulePulsesData.dsm2.pulses);
|
||||
break;
|
||||
#endif
|
||||
case PROTOCOL_CHANNELS_DSMP:
|
||||
extmoduleSendNextFrameSoftSerial(
|
||||
extmodulePulsesData.dsm2.pulses,
|
||||
extmodulePulsesData.dsm2.ptr - extmodulePulsesData.dsm2.pulses,
|
||||
true);
|
||||
break;
|
||||
|
||||
#if defined(GHOST)
|
||||
case PROTOCOL_CHANNELS_GHOST:
|
||||
|
||||
Reference in New Issue
Block a user