仓库提交练习
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

102 lines
1.9 KiB

/*
* paint_gun_action.c
*
* Created on: 2025年8月7日
* Author: xsq
*/
#include "paint_gun_action.h"
#include "Handset_Status_Setting.h"
#include "msp_strain_gauge.h"
#include "fsm_state.h"
#include "BHBF_ROBOT.h"
transition_t current_paintgun_state; /*transition_t 成员是 指针的 transition_state_t */
transition_state_t paintgun_on_state={PaintGun_ON_Enter,PaintGun_ON_Do,NULL}; /* State 成员,它会被默认初始化为 0 */
transition_state_t paintgun_off_state={PaintGun_OFF_Enter,PaintGun_OFF_Do,NULL};
char Paint_Gun_ButtonReset_Flag = 0; //喷枪开启 1yes
/* 喷枪控制 */
void PaintGun_ON_Do()
{
GF_BSP_GPIO_SetIO(PaintGun_IO_CTL, K_ON_PaintGun);//0开
}
void PaintGun_OFF_Do()
{
GF_BSP_GPIO_SetIO(PaintGun_IO_CTL, K_OFF_PaintGun);//1关
}
void PaintGun_ON_Enter()
{
}
void PaintGun_ON_Exit()
{
}
void PaintGun_OFF_Enter()
{
}
void PaintGun_OFF_Exit()
{
}
IO_State curr_io_state;
//无压力传感器数值下控制推杆函数
void PaintGun_Contronl()
{
GV.Now_press=strainGaugeValue->Pressure;
curr_io_state = GetIOState();
if(curr_io_state==IO_STATE_RISE)
{
strainGaugeValue->MotorControl=1;
}
else if(curr_io_state==IO_STATE_DESCEND)
{
strainGaugeValue->MotorControl=2;
}
else
{
strainGaugeValue->MotorControl=0;
}
}
//有压力传感器数值下控制推杆函数
void PaintGun_Contronl_Press()
{
GV.Now_press=strainGaugeValue->Pressure;
curr_io_state = GetIOState();
if(curr_io_state==IO_STATE_RISE)
{
// if(strainGaugeValue->Pressure>(-GV.PV.Robot_Press_Set))
// {
// strainGaugeValue->MotorControl=1;
// }
strainGaugeValue->MotorControl=1;
}
else if(curr_io_state==IO_STATE_DESCEND)
{
if(strainGaugeValue->Pressure<=(GV.PV.Robot_Press_Set*10))
{
strainGaugeValue->MotorControl=2;
}
else
{
strainGaugeValue->MotorControl=0;
}
}
else
{
strainGaugeValue->MotorControl=0;
}
}