1.优化代码,模块重启
This commit is contained in:
		
							parent
							
								
									862fa23840
								
							
						
					
					
						commit
						e33aefe84e
					
				| 
						 | 
				
			
			@ -90,7 +90,7 @@ SINT32 app_ttyusb_IsOpen(void) {
 | 
			
		|||
    MLOGD("ttyUSB has not been init, will init ttyUSB!\n");
 | 
			
		||||
 | 
			
		||||
    UINT8 i = 0;
 | 
			
		||||
 | 
			
		||||
    RETRY:
 | 
			
		||||
    for (i = 0; i < 150; i++) {
 | 
			
		||||
        if (access("/dev/ttyUSB2", F_OK) == SF_SUCCESS) {
 | 
			
		||||
            printf("tty usb ko exist!\r\n");
 | 
			
		||||
| 
						 | 
				
			
			@ -111,9 +111,12 @@ SINT32 app_ttyusb_IsOpen(void) {
 | 
			
		|||
        if ((0 == retryFlag) && (retryTime >= 100) &&
 | 
			
		||||
            (retryTime % 100 == 0)) // 200ms*100 = 20s
 | 
			
		||||
        {
 | 
			
		||||
            MLOGE("-------ttyUSB init fail, clos usb mux.\n");
 | 
			
		||||
            sf_ttyusb_restart();
 | 
			
		||||
            MLOGE("-------ttyUSB init fail, reset module.\n");
 | 
			
		||||
            sf_mcu_reg_set(SF_MCU_RESET_MODULE, 0);
 | 
			
		||||
            sleep(5);
 | 
			
		||||
            retryFlag = 1;
 | 
			
		||||
            retryTime = 0;
 | 
			
		||||
            goto RETRY;
 | 
			
		||||
        } else if ((1 == retryFlag) && (retryTime >= 50) &&
 | 
			
		||||
                    (retryTime % 50 == 0)) // 200ms*25 = 5s
 | 
			
		||||
        {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user