From 4bd08f0355b6b2cf3c027202d5ad301b4e182953 Mon Sep 17 00:00:00 2001 From: yy1717 <fctom1215@outlook.com> Date: 星期五, 31 三月 2023 17:16:22 +0800 Subject: [PATCH] 科目二修改 --- lib/src/main/cpp/mcu/ahp.cpp | 23 ++++++++++------------- 1 files changed, 10 insertions(+), 13 deletions(-) diff --git a/lib/src/main/cpp/mcu/ahp.cpp b/lib/src/main/cpp/mcu/ahp.cpp index a14afb6..185f8df 100644 --- a/lib/src/main/cpp/mcu/ahp.cpp +++ b/lib/src/main/cpp/mcu/ahp.cpp @@ -36,7 +36,7 @@ } case ID_GNSS_DATA: { -// DEBUG("ID_GNSS_DATA %d", length); + DEBUG("ID_GNSS_DATA %d", length); memcpy(RxBuf + RxBufLen, data, length); RxBufLen += length; @@ -113,8 +113,9 @@ pCls = nullptr; } -static void AhpRun(void) +void InitAhp(void) { + // TODO static struct serial_config serialConfig; strcpy(serialConfig.name, "/dev/ttyCH341USB3"); @@ -124,17 +125,13 @@ serialConfig.stop_bit = 1; serialConfig.flow_ctrl = 0; - while (true) { - std::thread t(UartThread, &serialConfig); - t.join(); - std::this_thread::sleep_for(std::chrono::seconds(3)); - } -} - -void InitAhp(void) -{ - // TODO - std::thread(AhpRun).detach(); + std::thread([&] { + while (true) { + std::thread t(UartThread, &serialConfig); + t.join(); + std::this_thread::sleep_for(std::chrono::seconds(3)); + } + }).detach(); } static void SendDfuFile(int fileLen, int sentLen, int blockLen, const uint8_t *data) { -- Gitblit v1.8.0