energy changed

This commit is contained in:
sun
2019-07-11 21:49:44 +08:00
parent 9e8ebe7a32
commit a2f08e9674
24 changed files with 689 additions and 575 deletions

View File

@@ -3,6 +3,8 @@
//
#include "energy/energy.h"
#include <iostream>
#include "log.h"
using namespace std;
@@ -10,7 +12,7 @@ using namespace std;
//----------------------------------------------------------------------------------------------------------------------
// 此函数用于发送数据给主控板
// ---------------------------------------------------------------------------------------------------------------------
void Energy::sendTarget(Serial& serial, float x, float y, char change, char shoot){
void Energy::sendTarget(Serial& serial, float x, float y, float z){
static short x_tmp, y_tmp, z_tmp;
uint8_t buff[8];
x_tmp = static_cast<short>(x * (32768 - 1) / 100);
@@ -20,9 +22,10 @@ void Energy::sendTarget(Serial& serial, float x, float y, char change, char shoo
buff[2] = static_cast<char>((x_tmp >> 0) & 0xFF);
buff[3] = static_cast<char>((y_tmp >> 8) & 0xFF);
buff[4] = static_cast<char>((y_tmp >> 0) & 0xFF);
buff[5] = change;
buff[6] = shoot;
buff[5] = static_cast<char>((z_tmp >> 8) & 0xFF);
buff[6] = static_cast<char>((z_tmp >> 0) & 0xFF);
buff[7] = 'e';
serial.WriteData(buff, sizeof(buff));
send_cnt+=1;
// LOGM(STR_CTR(WORD_LIGHT_PURPLE, "send"));
}