Future R9MEU firmware preparation (#5869)

PXX update for R9M FCC/EU
This commit is contained in:
3djc
2018-05-07 21:54:20 +02:00
committed by Bertrand Songis
parent 2d207b528a
commit 23e2e3743c
20 changed files with 163 additions and 259 deletions
+33 -6
View File
@@ -216,12 +216,37 @@ inline void SEND_FAILSAFE_1S()
// for channels not set previously to HOLD or NOPULSE
void setCustomFailsafe(uint8_t moduleIndex);
#define LEN_R9M_MODES "\007"
#define TR_R9M_MODES "FCC\0 ""LBT(EU)"
#if defined(PCBXLITE) && !defined(MODULE_R9M_FULLSIZE)
#define LEN_R9M_REGION "\007"
#define TR_R9M_REGION "FCC\0 ""LBT(EU)"
#define LEN_R9M_FCC_POWER_VALUES "\006"
#define LEN_R9M_LBT_POWER_VALUES "\006"
#define LEN_R9M_LBT_POWER_VALUES "\015"
#define TR_R9M_FCC_POWER_VALUES "100 mW"
#define TR_R9M_LBT_POWER_VALUES "25 mW 8ch\0 ""25 mW 16ch\0 ""100mW no tele"
enum R9MFCCPowerValues {
R9M_FCC_POWER_100 = 0,
R9M_FCC_POWER_MAX = R9M_FCC_POWER_100
};
enum R9MLBTPowerValues {
R9M_LBT_POWER_25 = 0,
R9M_LBT_POWER_25_16,
R9M_LBT_POWER_100,
R9M_LBT_POWER_MAX = R9M_LBT_POWER_100
};
#define BIND_TELEM_ALLOWED(idx) (!(IS_TELEMETRY_INTERNAL_MODULE() && moduleIdx == EXTERNAL_MODULE) && (!IS_MODULE_R9M_LBT(idx) || g_model.moduleData[idx].pxx.power < R9M_LBT_POWER_100))
#define BIND_CH9TO16_ALLOWED(idx) (!IS_MODULE_R9M_LBT(idx) || g_model.moduleData[idx].pxx.power != R9M_LBT_POWER_25)
#else
#define LEN_R9M_REGION "\007"
#define TR_R9M_REGION "FCC\0 ""LBT(EU)"
#define LEN_R9M_FCC_POWER_VALUES "\006"
#define LEN_R9M_LBT_POWER_VALUES "\013"
#define TR_R9M_FCC_POWER_VALUES "10 mW\0" "100 mW" "500 mW" "1 W\0"
#define TR_R9M_LBT_POWER_VALUES "25 mW\0" "500 mW"
#define TR_R9M_LBT_POWER_VALUES "25 mW 8ch\0 ""25 mW 16ch\0" "200 mW 16ch" "500 mW 16ch"
enum R9MFCCPowerValues {
R9M_FCC_POWER_10 = 0,
@@ -233,11 +258,13 @@ enum R9MFCCPowerValues {
enum R9MLBTPowerValues {
R9M_LBT_POWER_25 = 0,
R9M_LBT_POWER_25_16,
R9M_LBT_POWER_200,
R9M_LBT_POWER_500,
R9M_LBT_POWER_MAX = R9M_LBT_POWER_500
};
#define BIND_TELEM_ALLOWED(idx) (!IS_MODULE_R9M_LBT(idx) || g_model.moduleData[idx].pxx.power == R9M_LBT_POWER_25)
#define BIND_TELEM_ALLOWED(idx) (!(IS_TELEMETRY_INTERNAL_MODULE() && moduleIdx == EXTERNAL_MODULE) && (!IS_MODULE_R9M_LBT(idx) || g_model.moduleData[idx].pxx.power < R9M_LBT_POWER_200))
#define BIND_CH9TO16_ALLOWED(idx) (!IS_MODULE_R9M_LBT(idx) || g_model.moduleData[idx].pxx.power != R9M_LBT_POWER_25)
#endif
#endif // _PULSES_ARM_H_
+5 -7
View File
@@ -409,17 +409,15 @@ inline void setupFramePXX(uint8_t port, uint8_t sendUpperChannels)
}
#endif
// Bit1 is ignored by R9M EU when power is set to 1500 mW
extra_flags |= (g_model.moduleData[port].pxx.receiver_telem_off << 1);
extra_flags |= (g_model.moduleData[port].pxx.receiver_channel_9_16 << 2);
if (IS_MODULE_R9M(port)) {
// For R9M EU, bit3 (MODE) is taken into account ONLY at bind time. Value change requires re-bind
extra_flags |= (min(g_model.moduleData[port].pxx.power, IS_MODULE_R9M_FCC(port) ? (uint8_t)R9M_FCC_POWER_MAX : (uint8_t)R9M_LBT_POWER_MAX) << 3);
// Disable S.PORT if internal module is active
if (IS_TELEMETRY_INTERNAL_MODULE()) {
extra_flags |= (1 << 5);
}
}
// Disable S.PORT if internal module is active
if (IS_TELEMETRY_INTERNAL_MODULE()) {
extra_flags |= (1 << 5);
}
putPcmByte(port, extra_flags);