diff --git a/code/application/source/sf_app/code/include/sf_hal_ttyusb.h b/code/application/source/sf_app/code/include/sf_hal_ttyusb.h index ceca11920..c3744ac23 100755 --- a/code/application/source/sf_app/code/include/sf_hal_ttyusb.h +++ b/code/application/source/sf_app/code/include/sf_hal_ttyusb.h @@ -89,6 +89,8 @@ SINT32 sf_hal_uart_deinit(void); SINT32 sf_hal_ttyusb2_read_buf(SF_TTY_DATA_TYPE_S *recv); +SINT32 sf_get_ttyusb_flag(void); + #ifdef __cplusplus #if __cplusplus } diff --git a/code/application/source/sf_app/code/source/4gMng/sf_ftp.c b/code/application/source/sf_app/code/source/4gMng/sf_ftp.c index 798e9c204..3388604f3 100755 --- a/code/application/source/sf_app/code/source/4gMng/sf_ftp.c +++ b/code/application/source/sf_app/code/source/4gMng/sf_ftp.c @@ -1643,7 +1643,7 @@ SINT32 sf_camera_ota_ftp(void) if(SF_TRUE == sf_file_IsExsit(tmp)){ sf_file_remove(tmp); } - + sleep(2); ret = ftp_download_file(SF_CAM_UP_FILE,tmp,0); //if(SUCCESS == ret) { diff --git a/code/application/source/sf_app/code/source/4gMng/sf_sms.c b/code/application/source/sf_app/code/source/4gMng/sf_sms.c index 341111645..dc1dda73c 100755 --- a/code/application/source/sf_app/code/source/4gMng/sf_sms.c +++ b/code/application/source/sf_app/code/source/4gMng/sf_sms.c @@ -2491,24 +2491,27 @@ SINT32 sf_power_off_module_ota(void) /*instant, hybrid mode*/ if(CameraCmd.moduleUpdateOTA) { - if(app_ttyusb_IsOpen() != SUCCESS) - { - sf_cmd_camera_restart(1);//usb error,need restart - } - else - { - ret = sf_4g_module_ota_ftp();//need restart module - - //if(ret == OTA_UPDATED_ERROR || ret == OTA_SUCCESS || ret == OTA_VERTION_ERROR || ret == OTA_TIME_OUT) - { - if(CameraCmd.setPara) - pPara_sms_saved->NetWorkNeedSearch = 3; - else - puiPara->NetWorkNeedSearch = 3; - - sf_set_para_sava(); - } - } + if(0 == sf_check_sd()) + { + if(app_ttyusb_IsOpen() != SUCCESS) + { + sf_cmd_camera_restart(1);//usb error,need restart + } + else + { + ret = sf_4g_module_ota_ftp();//need restart module + + //if(ret == OTA_UPDATED_ERROR || ret == OTA_SUCCESS || ret == OTA_VERTION_ERROR || ret == OTA_TIME_OUT) + { + if(CameraCmd.setPara) + pPara_sms_saved->NetWorkNeedSearch = 3; + else + puiPara->NetWorkNeedSearch = 3; + + sf_set_para_sava(); + } + } + } } return ret; } @@ -2571,28 +2574,31 @@ SINT32 sf_power_off_module_sd_update(void) /*instant, hybrid mode*/ if(CameraCmd.moduleUpdateOTA) { - if(app_ttyusb_IsOpen() != SUCCESS) + if(0 == sf_check_sd()) { - sf_cmd_camera_restart(1);//usb error,need restart - } - else - { - ret = OTA_NOUPDATE; - if(sf_is_4g_module_usb_update_file_exist(updateFileName)) - { - ret = sf_4g_module_sd_usb_update(updateFileName); - } - - if(ret == OTA_UPDATED_ERROR || ret == OTA_SUCCESS || ret == OTA_VERTION_ERROR || ret == OTA_TIME_OUT) - { - if(CameraCmd.setPara) - pPara_sms_saved->NetWorkNeedSearch = 3; - else - puiPara->NetWorkNeedSearch = 3; - - sf_set_para_sava(); - } - } + if(app_ttyusb_IsOpen() != SUCCESS) + { + sf_cmd_camera_restart(1);//usb error,need restart + } + else + { + ret = OTA_NOUPDATE; + if(sf_is_4g_module_usb_update_file_exist(updateFileName)) + { + ret = sf_4g_module_sd_usb_update(updateFileName); + } + + if(ret == OTA_UPDATED_ERROR || ret == OTA_SUCCESS || ret == OTA_VERTION_ERROR || ret == OTA_TIME_OUT) + { + if(CameraCmd.setPara) + pPara_sms_saved->NetWorkNeedSearch = 3; + else + puiPara->NetWorkNeedSearch = 3; + + sf_set_para_sava(); + } + } + } } return 0; } @@ -2850,7 +2856,7 @@ SINT32 sf_power_off_check_fw_update(void) if(CameraCmd.firmwareUpdateOTA) { - if(sf_in_card_exist() && sf_is_card()) + if(0 == sf_check_sd()) { if(app_ttyusb_IsOpen() != SUCCESS) diff --git a/code/application/source/sf_app/code/source/app/sf_service.c b/code/application/source/sf_app/code/source/app/sf_service.c index 46284d271..7fd85af55 100755 --- a/code/application/source/sf_app/code/source/app/sf_service.c +++ b/code/application/source/sf_app/code/source/app/sf_service.c @@ -99,7 +99,7 @@ SINT32 app_ttyusb_IsOpen(void) { static SINT32 s32ret = SF_SUCCESS; static int flag = 0; - if(flag) + if((flag) && (sf_get_ttyusb_flag())) { return s32ret; } diff --git a/code/application/source/sf_app/code/source/app/sf_system.c b/code/application/source/sf_app/code/source/app/sf_system.c index 52d59432f..13f4ff0fb 100755 --- a/code/application/source/sf_app/code/source/app/sf_system.c +++ b/code/application/source/sf_app/code/source/app/sf_system.c @@ -1543,12 +1543,12 @@ void* sf_app_mcu_para_thread(void *arg) sf_mcu_flag_init(); sf_mcu_init(); if((SF_MCU_STARTUP_NORMAL != sf_poweron_type_get()) && (!isUsb)){ - sf_get_power_on_mode(); - sf_mcu_wdg_set(5); if(sf_get_camera_restart()) { sf_mcu_reg_set(SF_MCU_SOFT_UPDATE, 0); } + sf_get_power_on_mode(); + sf_mcu_wdg_set(5); } McuInitFlag = 1; McuParaTskCfg.IsRun = 0; diff --git a/code/application/source/sf_app/code/source/sf_blue/src/sf_blue_hal.c b/code/application/source/sf_app/code/source/sf_blue/src/sf_blue_hal.c index 213785baa..f7754c458 100644 --- a/code/application/source/sf_app/code/source/sf_blue/src/sf_blue_hal.c +++ b/code/application/source/sf_app/code/source/sf_blue/src/sf_blue_hal.c @@ -129,9 +129,10 @@ static void sf_bluetooth_power_enable(void) static void *sf_bluetooth_piscan_task(void *arg) { UINT8 i = 0; - sf_bluetooth_power_enable(); + // sf_bluetooth_power_enable(); sf_load_bt_ko(); - usleep(100 * 1000); + system("mdev -s"); + usleep(300 * 1000); //system("export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/misc:/customer/rocus/lib"); //system("adduser messagebus"); diff --git a/code/application/source/sf_app/code/source/systemMng/sf_commu_mcu_reg.c b/code/application/source/sf_app/code/source/systemMng/sf_commu_mcu_reg.c index 60210d0fd..bb01e71d9 100755 --- a/code/application/source/sf_app/code/source/systemMng/sf_commu_mcu_reg.c +++ b/code/application/source/sf_app/code/source/systemMng/sf_commu_mcu_reg.c @@ -167,7 +167,16 @@ unsigned char sf_mcu_power_on_para_get (MCUParam_t attrId) mcuReg[i++] = START_MODE; mcuReg[i++] = LUMINANCE_L; mcuReg[i++] = LUMINANCE_H; - sf_mcu_read_multi(mcuReg, mcuData, i); + if(FAIL == sf_mcu_read_multi(mcuReg, mcuData, i)) + { + if(startflag) + { + startflag = 0; + i = 0; + sf_sleep_ms(200); + goto SF_CHK_STARTMODE; + } + } i = 0; McuSubVersion = mcuData[i++]; @@ -182,12 +191,6 @@ unsigned char sf_mcu_power_on_para_get (MCUParam_t attrId) IRSHTTER = (dataTemp2 << 8) | dataTemp1; } - if((startMode != startModetmp) && (startflag)) - { - startflag = 0; - sf_sleep_ms(200); - goto SF_CHK_STARTMODE; - } printf(" start mode = %d IRSHTTER = %d McuVersion:%d.%d.%d\n", startMode, IRSHTTER, (McuVersion>>8)&0xFF, McuVersion & 0xFF, McuSubVersion); sf_mcu_rtc_get(&time); if(startMode == startModetmp) diff --git a/code/application/source/sf_app/code/source/ttyusb/sf_hal_ttyusb.c b/code/application/source/sf_app/code/source/ttyusb/sf_hal_ttyusb.c index 72f74ab2b..744a6dd10 100755 --- a/code/application/source/sf_app/code/source/ttyusb/sf_hal_ttyusb.c +++ b/code/application/source/sf_app/code/source/ttyusb/sf_hal_ttyusb.c @@ -457,6 +457,12 @@ SINT32 sf_hal_ttyusb2_read_buf(SF_TTY_DATA_TYPE_S *recv) return SF_SUCCESS; } + +SINT32 sf_get_ttyusb_flag(void) +{ + return TtyUSB2Fd; +} + #ifdef __cplusplus #if __cplusplus } diff --git a/rtos/code/application/source/cardv/SrcCode/UIApp/MovieFast/MovieFast.c b/rtos/code/application/source/cardv/SrcCode/UIApp/MovieFast/MovieFast.c index 9e5b7ca90..828ae78aa 100644 --- a/rtos/code/application/source/cardv/SrcCode/UIApp/MovieFast/MovieFast.c +++ b/rtos/code/application/source/cardv/SrcCode/UIApp/MovieFast/MovieFast.c @@ -2239,7 +2239,7 @@ DBG_WRN(">>>>>>>>>>>>>>> movie thread <<<<<<<<<<\r\n"); DBG_DUMP("Trigger speed = %lu\n", g_vprc_trigger_frm_time / 1000); } else{ - hd_videoproc_pull_out_buf(alg_path, &frame_capture, -1); + hd_videoproc_pull_out_buf(alg_path, &frame_capture, PHOTOFAST_HD_PUSH_PULL_TIMEOUT_MS); } DBG_DUMP("tmp_buf = %lx , frame.phy_addr[0] = %lx , copy size = %lx\n", @@ -2250,15 +2250,7 @@ DBG_WRN(">>>>>>>>>>>>>>> movie thread <<<<<<<<<<\r\n"); tmp_buf += yuv_size; */ hd_videoproc_release_out_buf(alg_path, &frame_capture); - #if HUNTING_CAMERA_MCU == ENABLE - sf_set_date_time_make_ymdhms(); - led_flag = FALSE; - ViewPullFlag = TRUE; - if((SF_MULTISHOT_INTEVEL_0S != puiPara->MultiShotIntevel) && (sf_is_night_mode(0) ==TRUE)){ - sf_ir_led_set(0, 0, 0, 0); - } - #endif //if(++cnt >= max_cnt) // break; vos_perf_mark(&t2); @@ -2269,8 +2261,50 @@ DBG_WRN(">>>>>>>>>>>>>>> movie thread <<<<<<<<<<\r\n"); goto EXIT; } -#if HUNTING_CAMERA_MCU == ENABLE - while(ViewPullFlag) { +#if 1 + if((tmp_buf + yuv_size) > (tmp_buf + tmp_buf_size)){ + DBG_ERR("tmp buffer overflow!!\n"); + goto EXIT; + } + + if(cnt == 0){ + g_vprc_trigger_frm_time = frame_capture.timestamp; + g_vprc_trigger_frm_count = frame_capture.count; + DBG_DUMP("Trigger speed = %lu\n", g_vprc_trigger_frm_time / 1000); + } + else{ + hd_videoproc_pull_out_buf(alg_path, &frame_capture, PHOTOFAST_HD_PUSH_PULL_TIMEOUT_MS); + } + + DBG_DUMP("tmp_buf = %lx , frame.phy_addr[0] = %lx , copy size = %lx\n", + tmp_buf, frame_capture.phy_addr[0], yuv_size); + if(cnt>0) + { + memcpy((void*)(tmp_buf), (void*)frame_capture.phy_addr[0], yuv_size); + + tmp_buf += yuv_size; + #if HUNTING_CAMERA_MCU == ENABLE + sf_set_date_time_make_ymdhms(); + #endif + } + hd_videoproc_release_out_buf(alg_path, &frame_capture); + + #if HUNTING_CAMERA_MCU == ENABLE + //sf_set_date_time_make_ymdhms(); + + led_flag = FALSE; + ViewPullFlag = TRUE; + if((cnt>0) && (SF_MULTISHOT_INTEVEL_0S != puiPara->MultiShotIntevel) && (sf_is_night_mode(0) ==TRUE)){ + sf_ir_led_set(0, 0, 0, 0); + } + #endif + + cnt++; + if(cnt > max_cnt) + break; + + #if HUNTING_CAMERA_MCU == ENABLE + while((cnt>1) && (ViewPullFlag)) { if(TRUE == flow_preview_get_stop_flag()){ DBG_WRN("detected stop signal, power off ...\n"); @@ -2305,33 +2339,6 @@ DBG_WRN(">>>>>>>>>>>>>>> movie thread <<<<<<<<<<\r\n"); } } #endif -#if 1 - if((tmp_buf + yuv_size) > (tmp_buf + tmp_buf_size)){ - DBG_ERR("tmp buffer overflow!!\n"); - goto EXIT; - } - - if(cnt == 0){ - g_vprc_trigger_frm_time = frame_capture.timestamp; - g_vprc_trigger_frm_count = frame_capture.count; - DBG_DUMP("Trigger speed = %lu\n", g_vprc_trigger_frm_time / 1000); - } - else{ - hd_videoproc_pull_out_buf(alg_path, &frame_capture, -1); - } - - DBG_DUMP("tmp_buf = %lx , frame.phy_addr[0] = %lx , copy size = %lx\n", - tmp_buf, frame_capture.phy_addr[0], yuv_size); - if(cnt>0) - { - memcpy((void*)(tmp_buf), (void*)frame_capture.phy_addr[0], yuv_size); - - tmp_buf += yuv_size; - } - hd_videoproc_release_out_buf(alg_path, &frame_capture); - cnt++; - if(cnt > max_cnt) - break; #endif } while(TRUE != flow_preview_get_stop_flag()); #endif @@ -2341,9 +2348,10 @@ DBG_WRN(">>>>>>>>>>>>>>> movie thread <<<<<<<<<<\r\n"); if(sf_is_night_mode(0) ==TRUE) { DBG_ERR(">>>>>>>>>>>>>>>>>>>>>night mode<<<<<<<<<<<<<\r\n"); - /*if((SF_MULTISHOT_INTEVEL_0S == puiPara->MultiShotIntevel)){ + if((SF_MULTISHOT_INTEVEL_0S == puiPara->MultiShotIntevel)){ sf_ir_led_set(0, 0, 0, 0); - }*/ + } + vos_util_delay_ms(10); sf_ir_led_set(((2 == puiPara->NightMode) ? 2 : 1),puiPara->FlashLed, puiPara->NightMode, 1); } #endif