Add blaster fire message
This commit is contained in:
+19
@@ -5,6 +5,8 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
struct RobotImp {
|
||||
|
||||
struct Client* client;
|
||||
@@ -19,6 +21,8 @@ struct RobotImp {
|
||||
int16_t gimbal[2];
|
||||
bool dirty_gimbal;
|
||||
|
||||
bool dirty_blaster;
|
||||
|
||||
bool sdk_mode;
|
||||
|
||||
enum {
|
||||
@@ -37,6 +41,12 @@ struct RobotImp {
|
||||
|
||||
};
|
||||
|
||||
int
|
||||
robot_blast(Robot robot) {
|
||||
robot->dirty_blaster = true;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
robot_drive(Robot robot, float x, float y, float r) {
|
||||
// TODO: move individual wheel speed calculation to work function
|
||||
@@ -185,6 +195,15 @@ robot_work(Robot robot) {
|
||||
req_send(robot->client->dev_conn, &req);
|
||||
robot->dirty_colors = false;
|
||||
}
|
||||
if(robot->dirty_blaster) {
|
||||
blaster_fire (
|
||||
&req, robot->seq++, false,
|
||||
FIRETYPE_INFRARED,
|
||||
ONE
|
||||
);
|
||||
req_send(robot->client->dev_conn, &req);
|
||||
robot->dirty_blaster = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user