fallback CMake + Armor PID

This commit is contained in:
2026-03-18 17:06:04 +08:00
parent c0ee469118
commit 3eb2d39942
7 changed files with 36 additions and 118 deletions

View File

@@ -19,9 +19,9 @@ class CameraWrapper: public WrapperHead {
friend void cameraCallback(CameraHandle hCamera, BYTE *pFrameBuffer, tSdkFrameHead* pFrameHead,PVOID pContext);
private:
const std::string name;
int mode;
//int mode;
bool init_done;
//bool init_done;
unsigned char* rgb_buffer;
int camera_cnts;
@@ -40,6 +40,9 @@ private:
public:
int gain;
int exposure;
int mode;
bool init_done;
CameraWrapper(int exposure, int gain, int camera_mode=1, const std::string &n="NULL");
~CameraWrapper() final;

View File

@@ -77,8 +77,12 @@ bool checkReconnect(bool is_camera_connect) {
if (!is_camera_connect) {
int curr_gain = ((CameraWrapper* )video)->gain;
int curr_exposure = ((CameraWrapper* )video)->exposure;
int curr_mode = ((CameraWrapper* )video)->mode; // 获取原始模式
delete video;
video = new CameraWrapper(curr_exposure, curr_gain, 0/*, "armor"*/);
std::this_thread::sleep_for(std::chrono::milliseconds(500)); // 等待硬件释放
video = new CameraWrapper(curr_exposure, curr_gain, curr_mode/*, "armor"*/);
//video = new CameraWrapper(curr_exposure, curr_gain, 0/*, "armor"*/);
is_camera_connect = video->init();
}
return is_camera_connect;

View File

@@ -38,6 +38,7 @@ bool CameraWrapper::init() {
int camera_enumerate_device_status = CameraEnumerateDevice(camera_enum_list, &camera_cnts);
if (camera_enumerate_device_status != CAMERA_STATUS_SUCCESS) {
LOGE("CameraEnumerateDevice fail with %d!", camera_enumerate_device_status);
return false;
}
if (camera_cnts == 0) {
LOGE("No camera device detected!");

View File

@@ -14,7 +14,7 @@ bool show_light_blobs = false;
bool show_origin = false;
bool run_with_camera = true;
bool save_video = false;
bool wait_uart = true;
bool wait_uart = false;
bool save_labelled_boxes = false;
bool show_process = false;
bool show_energy = false;