mirror of
https://github.com/zsa/qmk_firmware.git
synced 2026-05-03 22:09:10 +00:00
Add explicit guards to all device mode tasks to ensure the device is connected and configured before running the task, to prevent any user tasks from locking up the main USB task if the device has not been properly configured.
This commit is contained in:
@@ -229,6 +229,10 @@ void CDC1_Task(void)
|
||||
uint8_t JoyStatus_LCL = Joystick_GetStatus();
|
||||
static bool ActionSent = false;
|
||||
|
||||
/* Device must be connected and configured for the task to run */
|
||||
if (!(USB_IsConnected) || !(USB_ConfigurationNumber))
|
||||
return;
|
||||
|
||||
char* JoystickStrings[] =
|
||||
{
|
||||
"Joystick Up\r\n",
|
||||
@@ -288,6 +292,10 @@ void CDC1_Task(void)
|
||||
*/
|
||||
void CDC2_Task(void)
|
||||
{
|
||||
/* Device must be connected and configured for the task to run */
|
||||
if (!(USB_IsConnected) || !(USB_ConfigurationNumber))
|
||||
return;
|
||||
|
||||
/* Select the Serial Rx Endpoint */
|
||||
Endpoint_SelectEndpoint(CDC2_RX_EPNUM);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user