Skip to content

Commit

Permalink
move safe start to global struct for better debug
Browse files Browse the repository at this point in the history
  • Loading branch information
jia-xie committed Apr 5, 2024
1 parent 4880c6b commit 7577340
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/app/inc/robot.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

typedef struct {
uint8_t enabled;
uint8_t safely_started;
uint8_t spintop_mode;
uint8_t autoaiming_enabled;
float chassis_x_speed;
Expand Down
6 changes: 4 additions & 2 deletions src/app/src/robot.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ void Robot_Ctrl_Loop()
*/
void Robot_Cmd_Loop()
{
if (g_start_safely)
// safely startly will be 1 after first time right switch is down
// this is to make sure the robot is disabled when it starts
if (g_robot_state.safely_started == 1)
{
if ((g_remote.online_flag == REMOTE_OFFLINE) || (g_remote.controller.right_switch == DOWN))
{
Expand Down Expand Up @@ -202,7 +204,7 @@ void Robot_Cmd_Loop()
{
if (g_remote.controller.right_switch == DOWN)
{
g_start_safely = 1;
g_robot_state.safely_started = 1;
}
}
}
Expand Down

0 comments on commit 7577340

Please sign in to comment.