energy changed
This commit is contained in:
2
main.cpp
2
main.cpp
@@ -29,7 +29,7 @@ using namespace std;
|
|||||||
mcu_data mcuData = { // 单片机端回传结构体
|
mcu_data mcuData = { // 单片机端回传结构体
|
||||||
0, // 当前云台yaw角
|
0, // 当前云台yaw角
|
||||||
0, // 当前云台pitch角
|
0, // 当前云台pitch角
|
||||||
BIG_ENERGY_STATE, // 当前状态,自瞄-大符-小符
|
ARMOR_STATE, // 当前状态,自瞄-大符-小符
|
||||||
0, // 云台角度标记位
|
0, // 云台角度标记位
|
||||||
1, // 是否启用数字识别
|
1, // 是否启用数字识别
|
||||||
ENEMY_RED, // 敌方颜色
|
ENEMY_RED, // 敌方颜色
|
||||||
|
|||||||
@@ -227,7 +227,12 @@ bool Serial::InitPort(int nSpeed, char nEvent, int nBits, int nStop) {
|
|||||||
|
|
||||||
bool Serial::WriteData(const unsigned char *pData, unsigned int length) {
|
bool Serial::WriteData(const unsigned char *pData, unsigned int length) {
|
||||||
int cnt = 0, curr = 0;
|
int cnt = 0, curr = 0;
|
||||||
if (fd <= 0)return false;
|
if (fd <= 0){
|
||||||
|
if(wait_uart){
|
||||||
|
InitPort(nSpeed, nEvent, nBits, nStop);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
while ((curr = write(fd, pData + cnt, length - cnt)) > 0 && (cnt += curr) < length);
|
while ((curr = write(fd, pData + cnt, length - cnt)) > 0 && (cnt += curr) < length);
|
||||||
if (cnt < 0) {
|
if (cnt < 0) {
|
||||||
LOGE("Serial offline!");
|
LOGE("Serial offline!");
|
||||||
|
|||||||
Reference in New Issue
Block a user