This commit is contained in:
JiatongSun
2019-04-15 00:07:10 +08:00
parent ecc3bdcd9e
commit 15c7894c51
5 changed files with 30 additions and 19 deletions

View File

@@ -13,6 +13,7 @@
#include "camera/wrapper_head.h"
#include "armor_finder/armor_finder.h"
#include <options/options.h>
//#define LOG_LEVEL LOG_WARRING
#include <log.h>
#include <thread>
@@ -23,7 +24,7 @@ using namespace std;
#define ENERGY_STATE 1
#define ARMOR_STATE 0
int state = ARMOR_STATE;
int state = ENERGY_STATE;
float curr_yaw=0, curr_pitch=0;
float mark_yaw=0, mark_pitch=0;
@@ -98,16 +99,16 @@ void uartReceive(Uart* uart){
while((data=uart->receive()) != '\n'){
buffer[cnt++] = data;
if(cnt >= 100){
LOGE("data receive over flow!");
// LOGE("data receive over flow!");
}
}
if(cnt == 10){
if(buffer[8] == 'e'){
state = ENERGY_STATE;
LOGM("Energy state");
// LOGM("Energy state");
}else if(buffer[8] == 'a'){
state = ARMOR_STATE;
LOGM("Armor state");
// LOGM("Armor state");
}
memcpy(&curr_yaw, buffer, 4);
memcpy(&curr_pitch, buffer+4, 4);
@@ -115,7 +116,7 @@ void uartReceive(Uart* uart){
if(buffer[9] == 1){
mark_yaw = curr_yaw;
mark_pitch = curr_pitch;
LOGM("Marked");
// LOGM("Marked");
}
}
cnt = 0;