Cosmetics

This commit is contained in:
Bertrand Songis
2019-07-19 13:49:35 +02:00
parent f897a7daf6
commit 8edae00886
2 changed files with 115 additions and 115 deletions
-105
View File
@@ -331,111 +331,6 @@ inline int8_t sentModuleChannels(uint8_t idx)
return 8 + g_model.moduleData[idx].channelsCount;
}
enum {
MODULE_OPTION_EXTERNAL_ANTENNA,
MODULE_OPTION_POWER,
MODULE_OPTION_SPECTRUM_ANALYSER,
MODULE_OPTION_POWER_METER,
};
/* Options order:
* - External antenna (0x01)
* - Power (0x02)
* - Spektrum analyser (0x04)
* - Power meter (0x08)
*/
static const uint8_t moduleOptions[] = {
#if defined(SIMU)
0b11111111, // None = display all options on SIMU
#else
0b00000000, // None = no option available on unknown modules
#endif
0b11110001, // XJT
0b11110001, // ISRM
0b11111101, // ISRM-PRO
0b11110101, // ISRM-S
0b11110010, // R9M
0b11110010, // R9MLite
0b11110110, // R9MLite-PRO
0b11110100, // ISRM-N
};
inline uint8_t getPXX2ModuleOptions(uint8_t modelId)
{
if (modelId < DIM(moduleOptions))
return moduleOptions[modelId];
else
return moduleOptions[0];
}
inline bool isModuleOptionAvailable(uint8_t modelId, uint8_t option)
{
return getPXX2ModuleOptions(modelId) & (1 << option);
}
enum {
RECEIVER_OPTION_OTA,
};
/* Options order:
* - OTA (0x01)
*/
static const uint8_t receiverOptions[] = {
#if defined(SIMU)
0b11111111, // None = display all options on SIMU
#else
0b00000000, // None = display all options on SIMU
#endif
0b11111110, // X8R
0b11111110, // RX8R
0b11111110, // RX8R-PRO
0b11111110, // RX6R
0b11111110, // RX4R
0b11111110, // G-RX8
0b11111110, // G-RX6
0b11111110, // X6R
0b11111110, // X4R
0b11111110, // X4R-SB
0b11111110, // XSR
0b11111110, // XSR-M
0b11111110, // RXSR
0b11111110, // S6R
0b11111110, // S8R
0b11111110, // XM
0b11111110, // XM+
0b11111110, // XMR
0b11111110, // R9
0b11111110, // R9-SLIM
0b11111110, // R9-SLIM+
0b11111110, // R9-MINI
0b11111110, // R9-MM
0b11111110, // R9-STAB
0b11111111, // R9-MINI+OTA
0b11111111, // R9-MM+OTA
};
enum ModuleCapabilities {
MODULE_CAPABILITY_COUNT
};
enum ReceiverCapabilities {
RECEIVER_CAPABILITY_FPORT,
RECEIVER_CAPABILITY_COUNT
};
inline uint8_t getPXX2ReceiverOptions(uint8_t modelId)
{
if (modelId < DIM(receiverOptions))
return receiverOptions[modelId];
else
return receiverOptions[0];
}
inline bool isReceiverOptionAvailable(uint8_t modelId, uint8_t option)
{
return getPXX2ReceiverOptions(modelId) & (1 << option);
}
inline bool isDefaultModelRegistrationID()
{
return memcmp(g_model.modelRegistrationID, g_eeGeneral.ownerRegistrationID, PXX2_LEN_REGISTRATION_ID) == 0;
+115 -10
View File
@@ -58,6 +58,18 @@
#define PXX2_HW_INFO_TX_ID 0xFF
enum PXX2ModuleModelID {
PXX2_MODULE_NONE,
PXX2_MODULE_XJT,
PXX2_MODULE_ISRM,
PXX2_MODULE_ISRM_PRO,
PXX2_MODULE_ISRM_S,
PXX2_MODULE_R9M,
PXX2_MODULE_R9M_LITE,
PXX2_MODULE_R9M_LITE_PRO,
PXX2_MODULE_ISRM_N
};
static const char * const PXX2ModulesNames[] = {
"---",
"XJT",
@@ -78,6 +90,52 @@ inline const char * getPXX2ModuleName(uint8_t modelId)
return PXX2ModulesNames[0];
}
enum {
MODULE_OPTION_EXTERNAL_ANTENNA,
MODULE_OPTION_POWER,
MODULE_OPTION_SPECTRUM_ANALYSER,
MODULE_OPTION_POWER_METER,
};
/* Module options order:
* - External antenna (0x01)
* - Power (0x02)
* - Spektrum analyser (0x04)
* - Power meter (0x08)
*/
static const uint8_t PXX2ModuleOptions[] = {
#if defined(SIMU)
0b11111111, // None = display all options on SIMU
#else
0b00000000, // None = no option available on unknown modules
#endif
0b11110001, // XJT
0b11110001, // ISRM
0b11111101, // ISRM-PRO
0b11110101, // ISRM-S
0b11110010, // R9M
0b11110010, // R9MLite
0b11110110, // R9MLite-PRO
0b11110100, // ISRM-N
};
inline uint8_t getPXX2ModuleOptions(uint8_t modelId)
{
if (modelId < DIM(PXX2ModuleOptions))
return PXX2ModuleOptions[modelId];
else
return PXX2ModuleOptions[0];
}
inline bool isModuleOptionAvailable(uint8_t modelId, uint8_t option)
{
return getPXX2ModuleOptions(modelId) & (1 << option);
}
enum ModuleCapabilities {
MODULE_CAPABILITY_COUNT
};
static const char * const PXX2ReceiversNames[] = {
"---",
"X8R",
@@ -116,16 +174,63 @@ inline const char * getPXX2ReceiverName(uint8_t modelId)
return PXX2ReceiversNames[0];
}
enum PXX2ModuleModelID {
PXX2_MODULE_NONE,
PXX2_MODULE_XJT,
PXX2_MODULE_ISRM,
PXX2_MODULE_ISRM_PRO,
PXX2_MODULE_ISRM_S,
PXX2_MODULE_R9M,
PXX2_MODULE_R9M_LITE,
PXX2_MODULE_R9M_LITE_PRO,
PXX2_MODULE_ISRM_N
enum {
RECEIVER_OPTION_OTA,
};
/* Receiver options order:
* - OTA (0x01)
*/
static const uint8_t PXX2ReceiverOptions[] = {
#if defined(SIMU)
0b11111111, // None = display all options on SIMU
#else
0b00000000, // None = display all options on SIMU
#endif
0b11111110, // X8R
0b11111110, // RX8R
0b11111110, // RX8R-PRO
0b11111110, // RX6R
0b11111110, // RX4R
0b11111110, // G-RX8
0b11111110, // G-RX6
0b11111110, // X6R
0b11111110, // X4R
0b11111110, // X4R-SB
0b11111110, // XSR
0b11111110, // XSR-M
0b11111110, // RXSR
0b11111110, // S6R
0b11111110, // S8R
0b11111110, // XM
0b11111110, // XM+
0b11111110, // XMR
0b11111110, // R9
0b11111110, // R9-SLIM
0b11111110, // R9-SLIM+
0b11111110, // R9-MINI
0b11111110, // R9-MM
0b11111110, // R9-STAB
0b11111111, // R9-MINI+OTA
0b11111111, // R9-MM+OTA
};
inline uint8_t getPXX2ReceiverOptions(uint8_t modelId)
{
if (modelId < DIM(PXX2ReceiverOptions))
return PXX2ReceiverOptions[modelId];
else
return PXX2ReceiverOptions[0];
}
inline bool isReceiverOptionAvailable(uint8_t modelId, uint8_t option)
{
return getPXX2ReceiverOptions(modelId) & (1 << option);
}
enum ReceiverCapabilities {
RECEIVER_CAPABILITY_FPORT,
RECEIVER_CAPABILITY_COUNT
};
enum PXX2Variant {