Moved telemetry processing to module interface
This commit is contained in:
committed by
Raphael Coeffic
parent
39c61408e7
commit
246840f065
@@ -97,14 +97,17 @@ static void sendFailsafeChannels(uint8_t moduleIdx)
|
||||
int16_t failsafeValue = g_model.failsafeChannels[i];
|
||||
int pulseValue;
|
||||
|
||||
if (g_model.moduleData[moduleIdx].failsafeMode == FAILSAFE_HOLD || failsafeValue == FAILSAFE_CHANNEL_HOLD) {
|
||||
if (g_model.moduleData[moduleIdx].failsafeMode == FAILSAFE_HOLD ||
|
||||
failsafeValue == FAILSAFE_CHANNEL_HOLD) {
|
||||
pulseValue = 2047;
|
||||
}
|
||||
else if (g_model.moduleData[moduleIdx].failsafeMode == FAILSAFE_NOPULSES || failsafeValue == FAILSAFE_CHANNEL_NOPULSE) {
|
||||
} else if (g_model.moduleData[moduleIdx].failsafeMode ==
|
||||
FAILSAFE_NOPULSES ||
|
||||
failsafeValue == FAILSAFE_CHANNEL_NOPULSE) {
|
||||
pulseValue = 0;
|
||||
}
|
||||
else {
|
||||
failsafeValue += 2 * PPM_CH_CENTER(g_model.moduleData[moduleIdx].channelsStart + i) - 2 * PPM_CENTER;
|
||||
} else {
|
||||
failsafeValue +=
|
||||
2 * PPM_CH_CENTER(g_model.moduleData[moduleIdx].channelsStart + i) -
|
||||
2 * PPM_CENTER;
|
||||
pulseValue = limit(1, (failsafeValue * 800 / 1000) + 1024, 2046);
|
||||
}
|
||||
|
||||
@@ -270,6 +273,11 @@ static int multiGetByte(void* context, uint8_t* data)
|
||||
return IntmoduleSerialDriver.getByte(context, data);
|
||||
}
|
||||
|
||||
static void multiProcessData(void* context, uint8_t data, uint8_t* buffer, uint8_t* len)
|
||||
{
|
||||
processMultiTelemetryData(data, INTERNAL_MODULE);
|
||||
}
|
||||
|
||||
#include "hal/module_driver.h"
|
||||
|
||||
const etx_module_driver_t MultiInternalDriver = {
|
||||
@@ -279,6 +287,7 @@ const etx_module_driver_t MultiInternalDriver = {
|
||||
.setupPulses = multiSetupPulses,
|
||||
.sendPulses = multiSendPulses,
|
||||
.getByte = multiGetByte,
|
||||
.processData = multiProcessData,
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user