From 67f5c2197e8515e3657b11a930c06f3f349d1847 Mon Sep 17 00:00:00 2001 From: wanpiqiu123 <779893878@qq.com> Date: Mon, 22 Jul 2019 09:28:57 +0800 Subject: [PATCH] energy send changed. --- energy/src/energy/send/send.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/energy/src/energy/send/send.cpp b/energy/src/energy/send/send.cpp index aa5952e..8ecb479 100644 --- a/energy/src/energy/send/send.cpp +++ b/energy/src/energy/send/send.cpp @@ -14,7 +14,7 @@ using namespace std; // --------------------------------------------------------------------------------------------------------------------- void Energy::sendTarget(Serial& serial, float x, float y, float z){ static short x_tmp, y_tmp, z_tmp; - uint8_t buff[8]; + uint8_t buff[10]; x_tmp = static_cast(x * (32768 - 1) / 100); y_tmp = static_cast(y * (32768 - 1) / 100); z_tmp = static_cast(z * (32768 - 1) / 100); @@ -25,7 +25,9 @@ void Energy::sendTarget(Serial& serial, float x, float y, float z){ buff[4] = static_cast((y_tmp >> 0) & 0xFF); buff[5] = static_cast((z_tmp >> 8) & 0xFF); buff[6] = static_cast((z_tmp >> 0) & 0xFF); - buff[7] = 'e'; + buff[7] = 0; + buff[8] = 0; + buff[9] = 'e'; serial.WriteData(buff, sizeof(buff)); send_cnt+=1; // LOGM(STR_CTR(WORD_LIGHT_PURPLE, "send"));