diff --git a/armor/src/show_images/show_images.cpp b/armor/src/show_images/show_images.cpp index 8392e15..c92d9b8 100644 --- a/armor/src/show_images/show_images.cpp +++ b/armor/src/show_images/show_images.cpp @@ -99,9 +99,9 @@ void showArmorBox(std::string windows_name, const cv::Mat &src, const ArmorBox & rectangle(image2show, box.rect, Scalar(0, 255, 0), 3); }else{ rectangle(image2show, box.rect, Scalar(0, 255, 0), 1); - }; + } - char dist[5]; + char dist[10]; sprintf(dist, "%.1f", box.getBoxDistance()); if (box.id == -1) putText(image2show, id2name[box.id]+" "+dist, Point(box.rect.x + 2, box.rect.y + 2), cv::FONT_HERSHEY_TRIPLEX, 1, diff --git a/energy/include/energy/energy.h b/energy/include/energy/energy.h index 561b433..8509d32 100644 --- a/energy/include/energy/energy.h +++ b/energy/include/energy/energy.h @@ -37,7 +37,7 @@ public: void setSmallEnergyInit();//设置小能量机关初始化 void sendEnergy();//发送能量机关数据 void sendTarget(Serial& serial, float x, float y, float z);//发送数据 - void sendTarget(Serial& serial, float x, float y, uint16_t z, uint16_t u);//发送数据 + void sendTarget(Serial& serial, float x, float y, float z, uint16_t u);//发送数据 private: diff --git a/energy/src/energy/send/send.cpp b/energy/src/energy/send/send.cpp index 9102eb8..281dcf1 100644 --- a/energy/src/energy/send/send.cpp +++ b/energy/src/energy/send/send.cpp @@ -77,7 +77,7 @@ void Energy::sendTarget(Serial &serial, float x, float y, float z) { //---------------------------------------------------------------------------------------------------------------------- // 此函数用于发送数据给主控板 // --------------------------------------------------------------------------------------------------------------------- -void Energy::sendTarget(Serial &serial, float x, float y, uint16_t z, uint16_t u) { +void Energy::sendTarget(Serial &serial, float x, float y, float z, uint16_t u) { short x_tmp, y_tmp, z_tmp; uint8_t buff[10]; @@ -95,15 +95,16 @@ void Energy::sendTarget(Serial &serial, float x, float y, uint16_t z, uint16_t u x_tmp = static_cast(x * (32768 - 1) / 100); y_tmp = static_cast(y * (32768 - 1) / 100); + z_tmp = static_cast(z * (32768 - 1) / 100); buff[0] = 's'; buff[1] = static_cast((x_tmp >> 8) & 0xFF); buff[2] = static_cast((x_tmp >> 0) & 0xFF); buff[3] = static_cast((y_tmp >> 8) & 0xFF); buff[4] = static_cast((y_tmp >> 0) & 0xFF); - buff[5] = static_cast((z >> 8) & 0xFF); - buff[6] = static_cast((z >> 0) & 0xFF); + buff[5] = static_cast((z_tmp >> 8) & 0xFF); + buff[6] = static_cast((z_tmp >> 0) & 0xFF); buff[7] = static_cast((u >> 8) & 0xFF); - buff[8] = static_cast((u >> 0) & 0xFF);; + buff[8] = static_cast((u >> 0) & 0xFF); buff[9] = 'e'; serial.WriteData(buff, sizeof(buff)); send_cnt += 1; diff --git a/main.cpp b/main.cpp index 79aba0b..a10e8ec 100644 --- a/main.cpp +++ b/main.cpp @@ -30,7 +30,7 @@ using namespace std; mcu_data mcuData = { // 单片机端回传结构体 0, // 当前云台yaw角 0, // 当前云台pitch角 - BIG_ENERGY_STATE, // 当前状态,自瞄-大符-小符 + ARMOR_STATE, // 当前状态,自瞄-大符-小符 0, // 云台角度标记位 1, // 是否启用数字识别 ENEMY_RED, // 敌方颜色 diff --git a/others/src/additions/additions.cpp b/others/src/additions/additions.cpp index 29946b2..647935c 100644 --- a/others/src/additions/additions.cpp +++ b/others/src/additions/additions.cpp @@ -30,7 +30,7 @@ extern ArmorFinder armorFinder; extern Energy energy; void uartReceive(Serial *pSerial) { - char buffer[30]; + char buffer[40]; LOGM(STR_CTR(WORD_LIGHT_WHITE, "data receive start!")); while (true) { memset(buffer, 0, sizeof(buffer));