1、代码备份

This commit is contained in:
2025-09-14 18:54:54 +08:00
parent a0f42649f4
commit 7dc8f7c6d7
9 changed files with 780 additions and 43 deletions
+21 -6
View File
@@ -5,6 +5,7 @@
#include "Encryption.h"
#include "Debug.h"
#include "Algorithm.h"
#include "dc_motor.h"
#include "CS1237_LEFTUP.h"
#include "CS1237_LEFTLOW.h"
#include "CS1237_RIGHTUP.h"
@@ -132,8 +133,8 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
{
uint32_t LeftSlopeSum = abs(App.LeftUpCS1237_SlopeArray[0]) + abs(App.LeftLowCS1237_SlopeArray[0]);
uint32_t RightSlopeSum = abs(App.RightUpCS1237_SlopeArray[0]) + abs(App.RightLowCS1237_SlopeArray[0]);
uint32_t LeftDiffSum = abs(lu_ad[0]) + abs(ll_ad[0]);
uint32_t RightDiffSum = abs(ru_ad[0]) + abs(rl_ad[0]);
uint32_t LeftDiffSum = abs(lu_diff[0]) + abs(ll_diff[0]);
uint32_t RightDiffSum = abs(ru_diff[0]) + abs(rl_diff[0]);
App.LeftRunFalg = false;
App.RightRunFalg = false;
@@ -154,6 +155,7 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
&& (Oll_diff3 <= -App.ADTrack.LeftLowVPT)))
{
//BDC_UP();
Motor_Control(MOTOR_CMD_FORWARD);
App.UpFlag = true;
App.StopFlag = false;
App.DownFlag = false;
@@ -172,6 +174,7 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
&& (Oll_diff1 >= App.ADTrack.LeftLowVPT)))
{
//BDC_DOWN();
Motor_Control(MOTOR_CMD_REVERSE);
App.DownFlag = true;
App.StopFlag = false;
App.UpFlag = false;
@@ -194,6 +197,7 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
&& (Orl_diff3 <= -App.ADTrack.RightLowVPT)))
{
//BDC_UP();
Motor_Control(MOTOR_CMD_FORWARD);
App.UpFlag = true;
App.StopFlag = false;
App.DownFlag = false;
@@ -212,6 +216,7 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
&& (Orl_diff3 >= App.ADTrack.RightLowVPT)))
{
//BDC_DOWN();
Motor_Control(MOTOR_CMD_REVERSE);
App.DownFlag = true;
App.StopFlag = false;
App.UpFlag = false;
@@ -227,6 +232,7 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
&& ll_slope > App.ADTrack.Slope_VPT)
{
//BDC_STOP();
Motor_Control(MOTOR_CMD_STOP);
App.StopFlag = true;
App.DownFlag = false;
App.UpFlag = false;
@@ -236,6 +242,7 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
&& Oll_diff1 < (App.ADTrack.LeftLowVPT / 2))
{
//BDC_STOP();
Motor_Control(MOTOR_CMD_STOP);
App.StopFlag = true;
App.DownFlag = false;
App.UpFlag = false;
@@ -248,6 +255,7 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
&& rl_slope > App.ADTrack.Slope_VPT)
{
//BDC_STOP();
Motor_Control(MOTOR_CMD_STOP);
App.StopFlag = true;
App.DownFlag = false;
App.UpFlag = false;
@@ -257,6 +265,7 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
&& Orl_diff1 < (App.ADTrack.RightLowVPT / 2))
{
//BDC_STOP();
Motor_Control(MOTOR_CMD_STOP);
App.StopFlag = true;
App.DownFlag = false;
App.UpFlag = false;
@@ -272,6 +281,7 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
&& ll_slope < -App.ADTrack.Slope_VPT)
{
//BDC_STOP();
Motor_Control(MOTOR_CMD_STOP);
App.StopFlag = true;
App.DownFlag = false;
App.UpFlag = false;
@@ -281,6 +291,7 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
&& Oll_diff1 > -(App.ADTrack.LeftLowVPT / 2))
{
//BDC_STOP();
Motor_Control(MOTOR_CMD_STOP);
App.StopFlag = true;
App.DownFlag = false;
App.UpFlag = false;
@@ -293,15 +304,17 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
&& rl_slope < -App.ADTrack.Slope_VPT)
{
//BDC_STOP();
App.StopFlag = true;
App.DownFlag = false;
App.UpFlag = false;
App.StopCollDelay1mSCnt = 1000;
Motor_Control(MOTOR_CMD_STOP);
App.StopFlag = true;
App.DownFlag = false;
App.UpFlag = false;
App.StopCollDelay1mSCnt = 1000;
}
else if(Oru_diff1 < (App.ADTrack.RightUpVPT / 2)
&& Orl_diff1 > -(App.ADTrack.RightLowVPT / 2))
{
//BDC_STOP();
Motor_Control(MOTOR_CMD_STOP);
App.StopFlag = true;
App.DownFlag = false;
App.UpFlag = false;
@@ -574,6 +587,7 @@ int main(void)
RIGHTUP_CS1237DataLoopCollect();
RIGHTLOW_CS1237DataLoopCollect();
ReadLoopHandler();
DcmotorLoopHandler();
AppLoopHandler();
}
}
@@ -593,6 +607,7 @@ void SysTick_IrqHandler(void)
LEFTLOW_CS12371mSRoutine();
RIGHTUP_CS12371mSRoutine();
RIGHTLOW_CS12371mSRoutine();
Dcmotor1msRoutine();
}
/*****************************************************************************************