|
|
@@ -1047,7 +1047,7 @@ static uint8_t rfConnTx(uint8_t ch, uint8_t s1, const uint8_t* payload, uint8_t
|
|
|
{ static uint8_t chWant=0xFF, chCnt=0;
|
|
|
const uint32_t BACK4=TB_R4|TB_L4|TB_R5|TB_L5; uint8_t want=0xFF;
|
|
|
if((g_swBtns&BACK4)==BACK4){ if(g_swBtns&TB_A)want=0; else if(g_swBtns&TB_X)want=1; else if(g_swBtns&TB_Y)want=2; } // back4 + A=Steam X=Xbox Y=Switch (lizard is automatic in Steam mode now)
|
|
|
- if(want!=0xFF && want==chWant){ if(++chCnt>=12 && want!=g_usbMode){ saveMode(want); delay(40); NVIC_SystemReset(); } }
|
|
|
+ if(want!=0xFF && want==chWant){ if(++chCnt>=12 && want!=g_usbMode && !USBDevice.suspended()){ saveMode(want); delay(40); NVIC_SystemReset(); } }
|
|
|
else { chWant=want; chCnt=(want!=0xFF)?1:0; }
|
|
|
}
|
|
|
// compact stream for rf_controller_ui.py — NON-BLOCKING: skip if CDC TX is backed up (a blocking
|
|
|
@@ -1272,7 +1272,7 @@ static void webusbPoll(){
|
|
|
if(persist) saveCfg();
|
|
|
webusbSendBlob();
|
|
|
} else if(op==0x03){
|
|
|
- uint8_t m=buf[1]; if(m<=2){ webusbSendBlob(); usb_web.flush(); saveMode(m); delay(40); NVIC_SystemReset(); }
|
|
|
+ uint8_t m=buf[1]; if(m<=2 && !USBDevice.suspended()){ webusbSendBlob(); usb_web.flush(); saveMode(m); delay(40); NVIC_SystemReset(); }
|
|
|
}
|
|
|
memmove(buf,buf+need,n-need); n-=need;
|
|
|
}
|
|
|
@@ -1298,7 +1298,7 @@ static void rfSerialPoll(){
|
|
|
g_slot[0].rec[4],g_slot[0].rec[5],g_slot[0].rec[6],g_slot[0].rec[7]); }
|
|
|
else if (line[0]=='C'){ g_rfBeacon=g_rfListen=g_rfRaw=g_rfSweep=g_rfHost=false; rfRespondStart(); }
|
|
|
else if (line[0]=='s'){ g_rfListen=false; g_rfBeacon=false; g_rfRaw=false; g_rfSweep=false; g_rfHost=false; g_rfRespond=false; NRF_RADIO->TASKS_DISABLE=1; Serial.println("# RF off"); }
|
|
|
- else if (line[0]=='x'){ uint8_t m=strtoul(line+1,0,10); if(m<=2){ Serial.printf("# switch mode %u (reboot)\n",m); delay(20); saveMode(m); delay(40); NVIC_SystemReset(); } } // switch USB mode 0=steam 1=xbox 2=switch (lizard is automatic in steam mode)
|
|
|
+ else if (line[0]=='x'){ uint8_t m=strtoul(line+1,0,10); if(m<=2){ if(USBDevice.suspended()){ Serial.println("# mode change blocked: host suspended"); } else { Serial.printf("# switch mode %u (reboot)\n",m); delay(20); saveMode(m); delay(40); NVIC_SystemReset(); } } } // switch USB mode 0=steam 1=xbox 2=switch (lizard is automatic in steam mode)
|
|
|
else if (line[0]=='c'){ g_rfCh=atoi(line+1); Serial.printf("# ch=%u\n",g_rfCh); if(g_rfListen) rfListenStart(); }
|
|
|
else if (line[0]=='p'){ g_rfPrefix=strtol(line+1,0,16); Serial.printf("# prefix=%02X\n",g_rfPrefix); if(g_rfListen) rfListenStart(); }
|
|
|
else if (line[0]=='i'){ g_crcinit=strtoul(line+1,0,16); Serial.printf("# crcinit=%06lX\n",(unsigned long)g_crcinit); }
|