diff --git a/app/src/main/cpp/GPIOControl.h b/app/src/main/cpp/GPIOControl.h index 70c12f9e..46098b0d 100644 --- a/app/src/main/cpp/GPIOControl.h +++ b/app/src/main/cpp/GPIOControl.h @@ -628,7 +628,7 @@ public: #else // USING_N938 #ifdef USING_PTZ // PowerControl(CMD_SET_3V3_PWR_EN, CMD_SET_OTG_STATE, CMD_SET_5V_PWR_ENABLE, CMD_SET_100M_ENABLE, CMD_SET_100M_SWITCH_PWR_ENABLE, closeDelayTime) - PowerControl(CMD_SET_3V3_PWR_EN, CMD_SET_OTG_STATE, CMD_SET_100M_SWITCH_PWR_ENABLE, closeDelayTime) + PowerControl(CMD_SET_3V3_PWR_EN, CMD_SET_OTG_STATE, CMD_SET_100M_ENABLE, closeDelayTime) #else // USING_PTZ // Micro Photo PowerControl(CMD_SET_OTG_STATE, CMD_SET_485_EN_STATE/* Only for wp6*/, closeDelayTime) diff --git a/app/src/main/cpp/PtzController.cpp b/app/src/main/cpp/PtzController.cpp index 17209471..93961f1e 100644 --- a/app/src/main/cpp/PtzController.cpp +++ b/app/src/main/cpp/PtzController.cpp @@ -306,9 +306,22 @@ void PtzController::PtzProc() if (cmd.preset != 0 && cmd.preset != 0xFF) { CameraPhotoCmd(0, cmd.channel, MOVE_PRESETNO, 0, cmd.preset, cmd.serfile, cmd.baud, cmd.addr); - +#if 0 + if(START_ONCE_SELF == cmd.preset) + { + selfTestingStartTime = time(NULL); + selfTestingWaitTime = CAMERA_SELF_TEST_TIME; + state = PTZS_SELF_TESTING; + m_sem.release(); + XYLOG(XYLOG_SEVERITY_INFO, "拍照调用200号预置点指令,摄像机启动一次性自检从拍照状态改为自检状态!取消拍照动作!设置的自检等待时间%u秒", (uint32_t)selfTestingWaitTime); + break; + } +#endif PTZ_preset_start_time = time(NULL); - PTZ_preset_wait_time = MOVE_PRESET_WAIT_TIME; + if(START_ONCE_SELF == cmd.preset) + PTZ_preset_wait_time = CAMERA_SELF_TEST_TIME; + else + PTZ_preset_wait_time = MOVE_PRESET_WAIT_TIME; XYLOG(XYLOG_SEVERITY_INFO, "摄像机拍照前开始调用预置点%u!state=%d", (uint32_t)cmd.preset, state); for(;;) { @@ -345,7 +358,7 @@ void PtzController::PtzProc() { powerCtrl = std::make_shared(0); selfTestingStartTime = time(NULL); - selfTestingWaitTime = 150; + selfTestingWaitTime = CAMERA_SELF_TEST_TIME; state = PTZS_PHOTO_SELF_TESTING; m_sem.release(); XYLOG(XYLOG_SEVERITY_INFO, "收到拍照指令开机,摄像机从关机状态改为自检状态!设置的自检等待时间%u秒", (uint32_t)selfTestingWaitTime); @@ -363,7 +376,7 @@ void PtzController::PtzProc() { powerCtrl = std::make_shared(0); selfTestingStartTime = time(NULL); - selfTestingWaitTime = 150; + selfTestingWaitTime = CAMERA_SELF_TEST_TIME; state = PTZS_SELF_TESTING; m_sem.release(); XYLOG(XYLOG_SEVERITY_INFO, "收到手动开机指令,摄像机从关机状态改为自检状态!设置的自检等待时间%u秒", (uint32_t)selfTestingWaitTime); @@ -409,6 +422,7 @@ void PtzController::PtzProc() if (state == PTZS_POWER_OFF) { XYLOG(XYLOG_SEVERITY_INFO, "收到手动控制摄像机指令,摄像机处于关机状态,无法执行!"); + CameraPhotoCmd(cmd.ts, cmd.channel, cmd.cmdidx, 0, cmd.preset, cmd.serfile, cmd.baud, cmd.addr); break; } start_delay_time = time(NULL); @@ -418,7 +432,17 @@ void PtzController::PtzProc() XYLOG(XYLOG_SEVERITY_INFO, "丢弃拍照调预置点期间收到的控制云台指令,指令时间" FMT_TIME_T ",拍照时间" FMT_TIME_T "!state=%d", cmd.ts, photo_move_preset_time, state); } else + { + if((MOVE_PRESETNO == cmd.cmdidx) && (START_ONCE_SELF == cmd.preset)) + { + selfTestingStartTime = time(NULL); + selfTestingWaitTime = CAMERA_SELF_TEST_TIME; + state = PTZS_SELF_TESTING; + m_sem.release(); + XYLOG(XYLOG_SEVERITY_INFO, "收到调用200号预置点指令,摄像机启动一次性自检从当前状态改为自检状态!设置的自检等待时间%u秒", (uint32_t)selfTestingWaitTime); + } CameraPhotoCmd(cmd.ts, cmd.channel, cmd.cmdidx, 0, cmd.preset, cmd.serfile, cmd.baud, cmd.addr); + } } break; } diff --git a/app/src/main/cpp/PtzController.h b/app/src/main/cpp/PtzController.h index 75c65053..6a221c90 100644 --- a/app/src/main/cpp/PtzController.h +++ b/app/src/main/cpp/PtzController.h @@ -24,9 +24,9 @@ enum PROC_PTZ_STATE PTZS_PHOTO_SELF_TESTING = 5, }; -#define CAMERA_SELF_TEST_TIME 60 /* Camera self-test time (excluding PTZ self-test)*/ +#define CAMERA_SELF_TEST_TIME 150 /* Camera self-test time (excluding PTZ self-test)*/ #define MOVE_PRESET_WAIT_TIME 20 /* Waiting for the maximum time for the PTZ to move to the preset position*/ -#define CAMERA_CLOSE_DELAYTIME 150 /* Auto Power-Off Timer Setting After Manual Power-On (for Camera)*/ +#define CAMERA_CLOSE_DELAYTIME 360 /* Auto Power-Off Timer Setting After Manual Power-On (for Camera)*/ #define PHOTO_OPEN_POWER 16000 #define WAIT_TIME_AUTO_CLOSE 2 /* In order to automatically capture multiple preset point images at the same time and prevent the camera from self checking every time it takes a picture.*/ diff --git a/app/src/main/cpp/SensorsProtocol.h b/app/src/main/cpp/SensorsProtocol.h index e2011891..464d4268 100644 --- a/app/src/main/cpp/SensorsProtocol.h +++ b/app/src/main/cpp/SensorsProtocol.h @@ -132,6 +132,8 @@ #define SPEED_DOME_CAMERA 0 /* 球机摄像机*/ #define SERIAL_CAMERA 2 /* 串口摄像机a*/ +#define START_ONCE_SELF 200 /* 一次性自检需要的调用的预置点200*/ + #define COLLECT_DATA 0 /* 调试使用*/ #define HexCharToInt( c ) (((c) >= '0') && ((c) <= '9') ? (c) - '0' : ((c) >= 'a') && ((c) <= 'f') ? (c) - 'a' + 10 :((c) >= 'A') && ((c) <= 'F') ? (c) - 'A' + 10 : 0 )