energy send changed.

This commit is contained in:
wanpiqiu123
2019-07-22 09:28:57 +08:00
parent c8085fa161
commit 67f5c2197e

View File

@@ -14,7 +14,7 @@ using namespace std;
// --------------------------------------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------------------------------
void Energy::sendTarget(Serial& serial, float x, float y, float z){ void Energy::sendTarget(Serial& serial, float x, float y, float z){
static short x_tmp, y_tmp, z_tmp; static short x_tmp, y_tmp, z_tmp;
uint8_t buff[8]; uint8_t buff[10];
x_tmp = static_cast<short>(x * (32768 - 1) / 100); x_tmp = static_cast<short>(x * (32768 - 1) / 100);
y_tmp = static_cast<short>(y * (32768 - 1) / 100); y_tmp = static_cast<short>(y * (32768 - 1) / 100);
z_tmp = static_cast<short>(z * (32768 - 1) / 100); z_tmp = static_cast<short>(z * (32768 - 1) / 100);
@@ -25,7 +25,9 @@ void Energy::sendTarget(Serial& serial, float x, float y, float z){
buff[4] = static_cast<char>((y_tmp >> 0) & 0xFF); buff[4] = static_cast<char>((y_tmp >> 0) & 0xFF);
buff[5] = static_cast<char>((z_tmp >> 8) & 0xFF); buff[5] = static_cast<char>((z_tmp >> 8) & 0xFF);
buff[6] = static_cast<char>((z_tmp >> 0) & 0xFF); buff[6] = static_cast<char>((z_tmp >> 0) & 0xFF);
buff[7] = 'e'; buff[7] = 0;
buff[8] = 0;
buff[9] = 'e';
serial.WriteData(buff, sizeof(buff)); serial.WriteData(buff, sizeof(buff));
send_cnt+=1; send_cnt+=1;
// LOGM(STR_CTR(WORD_LIGHT_PURPLE, "send")); // LOGM(STR_CTR(WORD_LIGHT_PURPLE, "send"));