A more elegant approach (thank @bsongis)
This commit is contained in:
@@ -729,7 +729,7 @@ void menuModelSetup(event_t event)
|
|||||||
else if (isModuleDSM2(EXTERNAL_MODULE))
|
else if (isModuleDSM2(EXTERNAL_MODULE))
|
||||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+5*FW, y, STR_DSM_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, menuHorizontalPosition==1 ? attr : 0);
|
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+5*FW, y, STR_DSM_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, menuHorizontalPosition==1 ? attr : 0);
|
||||||
else if (isR9ModuleRunning(EXTERNAL_MODULE))
|
else if (isR9ModuleRunning(EXTERNAL_MODULE))
|
||||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+5*FW, y, STR_R9M_REGION, g_model.moduleData[EXTERNAL_MODULE].subType & 0x03, (menuHorizontalPosition==1 ? attr : 0));
|
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+5*FW, y, STR_R9M_REGION, g_model.moduleData[EXTERNAL_MODULE].r9m.region, (menuHorizontalPosition==1 ? attr : 0));
|
||||||
#if defined(MULTIMODULE)
|
#if defined(MULTIMODULE)
|
||||||
else if (isModuleMultimodule(EXTERNAL_MODULE)) {
|
else if (isModuleMultimodule(EXTERNAL_MODULE)) {
|
||||||
int multi_rfProto = g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(false);
|
int multi_rfProto = g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(false);
|
||||||
@@ -1232,13 +1232,11 @@ void menuModelSetup(event_t event)
|
|||||||
case ITEM_MODEL_EXTERNAL_MODULE_FREQ:
|
case ITEM_MODEL_EXTERNAL_MODULE_FREQ:
|
||||||
{
|
{
|
||||||
uint8_t moduleIdx = CURRENT_MODULE_EDITED(k);
|
uint8_t moduleIdx = CURRENT_MODULE_EDITED(k);
|
||||||
uint8_t frequency = BF_GET(g_model.moduleData[moduleIdx].r9m.freq, 2, 1);
|
|
||||||
lcdDrawTextAlignedLeft(y, STR_FREQUENCY);
|
lcdDrawTextAlignedLeft(y, STR_FREQUENCY);
|
||||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_R9MFLEX_FREQ, frequency, LEFT | attr);
|
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_R9MFLEX_FREQ, g_model.moduleData[moduleIdx].r9m.freq, LEFT | attr);
|
||||||
if (attr)
|
if (attr)
|
||||||
{
|
{
|
||||||
CHECK_INCDEC_MODELVAR_ZERO(event, frequency, 1);
|
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.moduleData[moduleIdx].r9m.freq, 1);
|
||||||
BF_SET(g_model.moduleData[moduleIdx].subType, frequency, 2, 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -502,7 +502,7 @@ bool isR9MModeAvailable(int mode)
|
|||||||
|
|
||||||
bool isR9MMFlex(int module)
|
bool isR9MMFlex(int module)
|
||||||
{
|
{
|
||||||
return g_model.moduleData[module].subType >= MODULE_SUBTYPE_R9M_EUPLUS;
|
return g_model.moduleData[module].r9m.region == 0x02;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isModuleAvailable(int module)
|
bool isModuleAvailable(int module)
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ void processFrskyPXX2Data(uint8_t data)
|
|||||||
R9ModuleStreaming = TELEMETRY_TIMEOUT10ms; // reset counter only if valid packets are being detected
|
R9ModuleStreaming = TELEMETRY_TIMEOUT10ms; // reset counter only if valid packets are being detected
|
||||||
uint8_t R9Region = (telemetryRxBuffer[3] & 0x30) >> 4;
|
uint8_t R9Region = (telemetryRxBuffer[3] & 0x30) >> 4;
|
||||||
if (R9Region != 0x04) {
|
if (R9Region != 0x04) {
|
||||||
BF_SET(g_model.moduleData[EXTERNAL_MODULE].subType, R9Region, 0, 2); // heading bit holds flex frequency
|
g_model.moduleData[EXTERNAL_MODULE].r9m.region = R9Region;
|
||||||
}
|
}
|
||||||
if (telemetryRxBuffer[2] & 0x80) {
|
if (telemetryRxBuffer[2] & 0x80) {
|
||||||
createFrSkyPXX2Sensor(RSSI_ID, telemetryRxBuffer[2] & 0x7f);
|
createFrSkyPXX2Sensor(RSSI_ID, telemetryRxBuffer[2] & 0x7f);
|
||||||
|
|||||||
Reference in New Issue
Block a user