This commit is contained in:
TuxMonkey
2026-08-17 23:49:29 +08:00
parent 14a3ab4cd0
commit fc6ac7a0b4
3 changed files with 146 additions and 7 deletions

View File

@@ -331,7 +331,7 @@ static uint8_t DrivenMotorIsLost()
return 0;
}
/* Chassis-board local RC control. Right switch down is hard emergency stop. */
/* Chassis-board local RC control. Rightmost safety switch down is emergency stop. */
static void ControlSwitch()
{
memset(&chassis_cmd_recv, 0, sizeof(chassis_cmd_recv));
@@ -349,8 +349,13 @@ static void ControlSwitch()
}
uint8_t switch_right = rc_data[TEMP].rc.switch_right;
#ifdef REMOTE_FS_I6
if (!switch_is_up(switch_right))
return;
#else
if (!switch_is_up(switch_right) && !switch_is_mid(switch_right))
return;
#endif
float chassis_vol = referee_data->PowerHeatData.chassis_voltage * 0.001f;
if (chassis_vol > REFEREE_VOLTAGE_VALID_MIN &&
@@ -362,6 +367,9 @@ static void ControlSwitch()
chassis_cmd_recv.chassis_mode = CHASSIS_STOOL_MODE;
chassis_cmd_recv.vx = RCChannelToRatio(rc_data[TEMP].rc.rocker_r1) * STOOL_SPEED_REF;
#ifdef REMOTE_FS_I6
chassis_cmd_recv.offset_angle = -RCChannelToRatio(rc_data[TEMP].rc.rocker_r_) * STOOL_YAW_RATE_REF;
#else
if (switch_is_up(switch_right))
{
chassis_cmd_recv.offset_angle = -STOOL_SPIN_YAW_RATE_REF;
@@ -371,6 +379,7 @@ static void ControlSwitch()
{
chassis_cmd_recv.offset_angle = -RCChannelToRatio(rc_data[TEMP].rc.rocker_r_) * STOOL_YAW_RATE_REF;
}
#endif
}
/* Joint motors must remain disabled on this demo chassis. */