Add blaster fire message

This commit is contained in:
2023-05-23 10:15:34 -05:00
parent f2918b441d
commit 90552382db
9 changed files with 96 additions and 0 deletions
+19
View File
@@ -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;
}