更新阈值设置

This commit is contained in:
sunbeam 2024-05-25 13:58:01 +08:00
parent 6210e22544
commit dd1851d360
2 changed files with 19 additions and 7 deletions

File diff suppressed because one or more lines are too long

View File

@ -132,15 +132,28 @@ void MotorCtrl(void)//10ms
MOTOR2Ctrl(MotorStateReal[MOTOR2]);
}
uint16_t getOC_th(void)
{
if (MotorStateReal[MOTOR1] != ACT_NOACT)
{
return 70U;
}
else
{
return 60U;
}
//return 50U;
}
void CurrentDetecte(void)
{
static uint16_t OC_Count1=0;
uint16_t OC_th;
current1 = getAdval(ADCH_RLY1);
if (current1 > 100U && OC1flag == 0)
OC_th = getOC_th();
if (current1 > OC_th && OC1flag == 0)
{
OC_Count1++;
if (OC_Count1 >= 200)