USB-VCP no OFF if internal RF module is set to CRSF (#1957)
* Do not list OFF on VCP menu if internal RF module is set to CRSF to allow pass-through flashing. Set USB-VCP automatically to CLI when CRSF mode is selected for internal module and it was previously OFF. Activate CLI when iCRSF is selected. * Companion part Co-authored-by: elecpower <neilh713@tpg.com.au>
This commit is contained in:
@@ -312,6 +312,11 @@ class InternalModuleWindow : public FormGroup {
|
||||
restartModule(INTERNAL_MODULE);
|
||||
});
|
||||
grid.nextLine();
|
||||
#if defined(USB_SERIAL)
|
||||
// If USB-VCP was off, set it to CLI to enable passthrough flashing
|
||||
if (serialGetMode(SP_VCP) == UART_MODE_NONE)
|
||||
serialSetMode(SP_VCP, UART_MODE_CLI);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
getParent()->moveWindowsTop(top() + 1, adjustHeight());
|
||||
|
||||
@@ -532,6 +532,11 @@ void menuRadioHardware(event_t event)
|
||||
memclear(&g_model.moduleData[INTERNAL_MODULE], sizeof(ModuleData));
|
||||
storageDirty(EE_MODEL);
|
||||
storageDirty(EE_GENERAL);
|
||||
#if defined(CROSSFIRE) && defined(USB_SERIAL)
|
||||
// If USB-VCP was off, set it to CLI to enable passthrough flashing
|
||||
if (isInternalModuleCrossfire() && serialGetMode(SP_VCP) == UART_MODE_NONE)
|
||||
serialSetMode(SP_VCP, UART_MODE_CLI);
|
||||
#endif
|
||||
}
|
||||
} break;
|
||||
#endif
|
||||
|
||||
@@ -382,6 +382,12 @@ int hasSerialMode(int mode)
|
||||
|
||||
bool isSerialModeAvailable(uint8_t port_nr, int mode)
|
||||
{
|
||||
#if defined(USB_SERIAL)
|
||||
// Do not list OFF on VCP if internal RF module is set to CROSSFIRE to allow pass-through flashing
|
||||
if (port_nr == SP_VCP && mode == UART_MODE_NONE && isInternalModuleCrossfire())
|
||||
return false;
|
||||
#endif
|
||||
|
||||
if (mode == UART_MODE_NONE)
|
||||
return true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user