修复四个关键bug: dest_fps限速/底行越界/255应为-1/删除debug文件重载

This commit is contained in:
spdis
2026-06-13 14:00:34 +08:00
parent d1e2234a43
commit d251f08670
4 changed files with 78 additions and 13 deletions
+8 -11
View File
@@ -33,27 +33,24 @@ int main(void)
if (avoid_range_val > 0) g_cfg.cone_avoid_range = avoid_range_val;
if (hold_frames_val > 0) g_cfg.cone_hold_frames = hold_frames_val;
if (CameraInit(0, dest_fps, 320, 240) < 0) {
int frame_delay = CameraInit(0, dest_fps, 320, 240);
if (frame_delay < 0) {
std::cerr << "CameraInit failed" << std::endl;
return -1;
}
ControlInit();
std::cout << "All services started" << std::endl;
int tick = 0;
while (running.load())
{
auto t_start = std::chrono::steady_clock::now();
CameraHandler();
if (++tick % 7 == 0) {
g_cfg.debug = readFlag(debug_file);
}
if (g_cfg.debug) {
cfg_load_all();
}
target_speed = g_cfg.speed;
auto elapsed = std::chrono::steady_clock::now() - t_start;
auto remain = std::chrono::milliseconds(frame_delay) - elapsed;
if (remain > std::chrono::milliseconds(1))
std::this_thread::sleep_for(remain);
}
std::cout << "Stopping..." << std::endl;