@@ -93,13 +93,18 @@ struct Data
|
||||
|
||||
void reset()
|
||||
{
|
||||
#if defined(EXTMODULE_USART) && defined(EXTMODULE_TX_INVERT_GPIO)
|
||||
#else
|
||||
pulsesSize = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(EXTMODULE_USART) && defined(EXTMODULE_TX_INVERT_GPIO)
|
||||
void sendByte(uint8_t b)
|
||||
{
|
||||
#if !defined(SIMU)
|
||||
*ptr++ = b;
|
||||
#endif
|
||||
}
|
||||
|
||||
const uint8_t* getData()
|
||||
|
||||
@@ -38,6 +38,7 @@ enum ModuleType {
|
||||
MODULE_TYPE_SBUS,
|
||||
MODULE_TYPE_XJT_LITE_PXX2,
|
||||
MODULE_TYPE_AFHDS3, //no more protocols possible because of 4 bits value
|
||||
//MODULE_TYPE_AFHDS2A,
|
||||
MODULE_TYPE_COUNT,
|
||||
MODULE_TYPE_MAX = MODULE_TYPE_COUNT - 1
|
||||
};
|
||||
@@ -222,6 +223,11 @@ enum ModuleSubtypeDSM2 {
|
||||
DSM2_PROTO_DSMX,
|
||||
};
|
||||
|
||||
enum ModuleSubtypeFlysky {
|
||||
FLYSKY_SUBTYPE_AFHDS3=0,
|
||||
FLYSKY_SUBTYPE_AFHDS2A
|
||||
};
|
||||
|
||||
enum FailsafeModes {
|
||||
FAILSAFE_NOT_SET,
|
||||
FAILSAFE_HOLD,
|
||||
|
||||
@@ -319,9 +319,22 @@ inline bool isModuleSBUS(uint8_t moduleIdx)
|
||||
return g_model.moduleData[moduleIdx].type == MODULE_TYPE_SBUS;
|
||||
}
|
||||
|
||||
inline bool isModuleFlySky(uint8_t idx)
|
||||
{
|
||||
return
|
||||
(g_model.moduleData[idx].type == MODULE_TYPE_AFHDS3);
|
||||
}
|
||||
|
||||
inline bool isModuleAFHDS2A(uint8_t idx)
|
||||
{
|
||||
return isModuleFlySky(idx)
|
||||
&& (g_model.moduleData[idx].subType == FLYSKY_SUBTYPE_AFHDS2A);
|
||||
}
|
||||
|
||||
inline bool isModuleAFHDS3(uint8_t idx)
|
||||
{
|
||||
return g_model.moduleData[idx].type == MODULE_TYPE_AFHDS3;
|
||||
return isModuleFlySky(idx)
|
||||
&& (g_model.moduleData[idx].subType == FLYSKY_SUBTYPE_AFHDS3);
|
||||
}
|
||||
|
||||
// order is the same as in enum Protocols in myeeprom.h (none, ppm, pxx, pxx2, dsm, crossfire, multi, r9m, r9m2, sbus)
|
||||
|
||||
@@ -187,9 +187,13 @@ uint8_t getRequiredProtocol(uint8_t module)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(AFHDS3)
|
||||
#if defined(AFHDS3) || defined(AFHDS2)
|
||||
case MODULE_TYPE_AFHDS3:
|
||||
protocol = PROTOCOL_CHANNELS_AFHDS3;
|
||||
if (isModuleAFHDS3(module)) {
|
||||
protocol = PROTOCOL_CHANNELS_AFHDS3;
|
||||
} else if (isModuleAFHDS2A(module)) {
|
||||
protocol = PROTOCOL_CHANNELS_AFHDS2A;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -474,6 +478,14 @@ static void enablePulsesInternalModule(uint8_t protocol)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(AFHDS2)
|
||||
case PROTOCOL_CHANNELS_AFHDS2A:
|
||||
/* extmodulePulsesData.afhds2.init(INTERNAL_MODULE);
|
||||
extmoduleSerialStart();*/
|
||||
mixerSchedulerSetPeriod(INTERNAL_MODULE, 2 * 1000 /* us */);
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
// internal module stopped, set internal period to 0 and start the scheduler
|
||||
mixerSchedulerSetPeriod(INTERNAL_MODULE, 0);
|
||||
|
||||
@@ -273,6 +273,7 @@ union InternalModulePulsesData {
|
||||
#if defined(INTERNAL_MODULE_PPM)
|
||||
PpmPulsesData<pulse_duration_t> ppm;
|
||||
#endif
|
||||
|
||||
} __ALIGNED(4);
|
||||
|
||||
union ExternalModulePulsesData {
|
||||
@@ -389,6 +390,7 @@ enum ChannelsProtocols {
|
||||
PROTOCOL_CHANNELS_SBUS,
|
||||
PROTOCOL_CHANNELS_PXX2_LOWSPEED,
|
||||
PROTOCOL_CHANNELS_PXX2_HIGHSPEED,
|
||||
PROTOCOL_CHANNELS_AFHDS2A,
|
||||
PROTOCOL_CHANNELS_AFHDS3,
|
||||
PROTOCOL_CHANNELS_GHOST
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user