energy changed

This commit is contained in:
sun
2019-07-10 21:37:08 +08:00
parent 92295793d5
commit 2e1538902a
9 changed files with 156 additions and 94 deletions

View File

@@ -8,34 +8,9 @@ using namespace std;
//----------------------------------------------------------------------------------------------------------------------
// 此函数用于发送小符数据
// 此函数用于发送数据给主控板
// ---------------------------------------------------------------------------------------------------------------------
void Energy::sendBigTarget(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);
y_tmp = static_cast<short>(y * (32768 - 1) / 100);
z_tmp = static_cast<short>(z * (32768 - 1) / 1000);
buff[0] = 's';
buff[1] = static_cast<char>((x_tmp >> 8) & 0xFF);
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] = 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;
// cout<<"send cnt: "<<send_cnt<<endl;
}
//----------------------------------------------------------------------------------------------------------------------
// 此函数用于发送大符数据
// ---------------------------------------------------------------------------------------------------------------------
void Energy::sendSmallTarget(Serial& serial, float x, float y, char change, char shoot){
void Energy::sendTarget(Serial& serial, float x, float y, char change, char shoot){
static short x_tmp, y_tmp, z_tmp;
uint8_t buff[8];
x_tmp = static_cast<short>(x * (32768 - 1) / 100);