Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4efe6d2a50 | |||
| 24f8231308 | |||
| 130904e0a2 |
@@ -1,166 +0,0 @@
|
||||
$PACKAGES
|
||||
BUZ-TH_BD12.0-P7.60-D0.6-FD ! BUZ-TH_BD12.0-P7.60-D0.6-FD ! '2.7kHz' ; BUZZER
|
||||
C0603 ! C0603 ! 100nF ; C1 C5 C9 C11 C14 C16 C17 C20 C22 C24 C29 C30 C31 C35 ,
|
||||
C37 C38 C40 C43 C44 C45 C47 C48 C49 C52
|
||||
C0603 ! C0603 ! 100pF ; C27 C28 C33 C34 C41 C42 C50 C51
|
||||
C0603 ! C0603 ! 10uF ; C13 C15 C19 C21 C23 C25 C32 C36 C39 C46
|
||||
C0603 ! C0603 ! 47pF ; C2
|
||||
C0805 ! C0805 ! 100nF ; C8
|
||||
C0805 ! C0805 ! 22uF ; C4 C10 C12 C18
|
||||
C1206 ! C1206 ! '2.2uF' ; C7
|
||||
CAP-TH_BD8.0-P3.50-D0.6-FD ! CAP-TH_BD8.0-P3.50-D0.6-FD ! 470uF ; C3
|
||||
CAP-TH_BD8.0-P3.50-D0.6-FD ! CAP-TH_BD8.0-P3.50-D0.6-FD ! 47uF ; C6
|
||||
,
|
||||
CONN-TH_4P-P1.25_HCTL_HC-1.25-4A ! CONN-TH_4P-P1.25_HCTL_HC-1.25-4A ! '{Value}' ,
|
||||
; LED
|
||||
,
|
||||
CONN-TH_5P-P1.25_HCTL_HC-1.25-5A ! CONN-TH_5P-P1.25_HCTL_HC-1.25-5A ! '{Value}' ,
|
||||
; CN1 CN2
|
||||
,
|
||||
CONN-TH_5P-P1.25_HCTL_HC-1.25-5AW ! CONN-TH_5P-P1.25_HCTL_HC-1.25-5AW ! '{Value}' ,
|
||||
; CN4 CN5 CN6 CN7
|
||||
,
|
||||
CONN-TH_7P-P1.25_HCTL_HC-1.25-7A ! CONN-TH_7P-P1.25_HCTL_HC-1.25-7A ! '{Value}' ,
|
||||
; DEBUG
|
||||
HDR-TH_2P-P2.54-V-M ! HDR-TH_2P-P2.54-V-M ! '{Value}' ; H1 H4
|
||||
HDR-TH_6P-P2.54-V-M ! HDR-TH_6P-P2.54-V-M ! '{Value}' ; H2 H3
|
||||
IND-SMD_L7.1-W6.6 ! IND-SMD_L7.1-W6.6 ! 47uH ; L1
|
||||
LED0603-RD ! LED0603-RD ! '{Value}' ; GREEN RED
|
||||
,
|
||||
LQFP-48_L7.0-W7.0-P0.50-LS9.0-BL ! LQFP-48_L7.0-W7.0-P0.50-LS9.0-BL ! '{Value}' ,
|
||||
; U6
|
||||
M3 ! M3 ! '{Value}' ; U8 U9 U10 U11
|
||||
R0603 ! R0603 ! '1.5kΩ' ; R20 R22
|
||||
R0603 ! R0603 ! '100Ω' ; R12 R13 R16 R17 R18 R19 R27 R28
|
||||
R0603 ! R0603 ! '10kΩ' ; R10 R14 R29
|
||||
R0603 ! R0603 ! '1kΩ' ; R9 R23 R26
|
||||
R0603 ! R0603 ! '2.2kΩ' ; R3 R4 R21 R24
|
||||
R0603 ! R0603 ! '20kΩ' ; R6
|
||||
R0603 ! R0603 ! '22Ω' ; R1
|
||||
R0603 ! R0603 ! '300kΩ' ; R2
|
||||
R0603 ! R0603 ! '30mΩ' ; R5
|
||||
R0603 ! R0603 ! '4.7kΩ' ; R15
|
||||
R0603 ! R0603 ! '510Ω' ; R7 R8
|
||||
R0805 ! R0805 ! '0Ω' ; R11
|
||||
RJ45-TH_RJ48-56-10P10C_MZ ! RJ45-TH_RJ48-56-10P10C_MZ ! '{Value}' ; RJ1 RJ2
|
||||
SMA_L4.3-W2.6-LS5.0-FD ! SMA_L4.3-W2.6-LS5.0-FD ! '{Value}' ; D1
|
||||
SMA_L4.3-W2.6-LS5.2-RD ! SMA_L4.3-W2.6-LS5.2-RD ! '{Value}' ; D3 D5
|
||||
SMA_L4.4-W2.6-LS5.0-BI ! SMA_L4.4-W2.6-LS5.0-BI ! '{Value}' ; D4
|
||||
SOD-123FL_L2.7-W1.8-LS3.8-RD ! SOD-123FL_L2.7-W1.8-LS3.8-RD ! '{Value}' ; D2
|
||||
SOD-323_L1.8-W1.3-LS2.5-RD ! SOD-323_L1.8-W1.3-LS2.5-RD ! '{Value}' ; D6
|
||||
,
|
||||
SOIC-8_L4.9-W3.9-P1.27-LS6.0-BL-EP ! SOIC-8_L4.9-W3.9-P1.27-LS6.0-BL-EP ! '{Value}' ,
|
||||
; U1
|
||||
SOIC-8_L5.0-W4.0-P1.27-LS6.0-BL ! SOIC-8_L5.0-W4.0-P1.27-LS6.0-BL ! '{Value}' ,
|
||||
; U4 U7 U12 U13
|
||||
,
|
||||
SOT-23-3_L2.9-W1.3-P1.90-LS2.4-BR ! SOT-23-3_L2.9-W1.3-P1.90-LS2.4-BR ! '{Value}' ,
|
||||
; Q2 Q3 Q4
|
||||
SOT-89_L4.5-W2.5-P1.50-LS4.2-BR ! SOT-89_L4.5-W2.5-P1.50-LS4.2-BR ! '{Value}' ,
|
||||
; U2 U3
|
||||
,
|
||||
SOT-89-3_L4.5-W2.5-P1.50-LS4.2-BR ! SOT-89-3_L4.5-W2.5-P1.50-LS4.2-BR ! '{Value}' ,
|
||||
; Q1
|
||||
Test-Point-0.5mm ! Test-Point-0.5mm ! '{Value}' ; 12.8V
|
||||
,
|
||||
TSSOP-20_L6.5-W4.4-P0.65-LS6.4-BL ! TSSOP-20_L6.5-W4.4-P0.65-LS6.4-BL ! '{Value}' ,
|
||||
; U5
|
||||
$A_PROPERTIES
|
||||
$NETS
|
||||
'+5V' ; RJ1.P6 RJ2.P6
|
||||
'$1N110513' ; C1.2 R1.1
|
||||
'$1N110514' ; C1.1 D1.2 L1.1 U1.1
|
||||
'$1N110520' ; R1.2 U1.8
|
||||
'$1N110523' ; C2.1 R2.1 R6.2 U1.5
|
||||
'$1N116128' ; R15.1 U6.44
|
||||
'$1N116244' ; C43.2 U6.22
|
||||
'$1N125934' ; H3.6 U6.38
|
||||
'$1N125936' ; H3.5 U6.39
|
||||
'$1N125938' ; H3.4 U6.40
|
||||
'$1N125940' ; H3.3 U6.41
|
||||
'$1N125942' ; H3.2 U6.42
|
||||
'$1N125944' ; H3.1 U6.43
|
||||
'$1N126001' ; H2.2 U6.2
|
||||
'$1N126003' ; H2.3 U6.3
|
||||
'$1N126005' ; H2.4 U6.4
|
||||
'$1N126007' ; H2.5 U6.5
|
||||
'$1N126009' ; H2.6 U6.6
|
||||
'$1N140888' ; CN6.2 R18.1
|
||||
'$1N170439' ; BUZZER.2 D6.2 Q2.3
|
||||
'$1N170441' ; Q2.1 R9.2 R10.2
|
||||
'$1N170456' ; LED.4 R8.1 RED.2
|
||||
'$1N170459' ; GREEN.2 LED.1 R7.1
|
||||
'$1N170464' ; CN4.3 R16.1
|
||||
'$1N170465' ; CN4.2 R12.1
|
||||
'$1N170478' ; R14.1 U5.10
|
||||
'$1N96636' ; CN5.3 R17.1
|
||||
'$1N96637' ; CN5.2 R13.1
|
||||
'$1N96922' ; CN6.3 R27.1
|
||||
'$1N97208' ; CN7.3 R28.1
|
||||
'$1N97209' ; CN7.2 R19.1
|
||||
'AVCC_5V' ; C9.2 C10.2 C21.2 C22.1 C24.1 C25.1 C32.2 C35.1 C39.2 C40.1 C46.2 ,
|
||||
C47.1 CN4.1 CN5.1 CN6.1 CN7.1 U2.2 U4.1 U4.7 U5.19 U7.1 U7.7 U12.1 ,
|
||||
U12.7 U13.1 U13.7
|
||||
'I2C_INT1' ; CN1.4 U6.10
|
||||
'I2C_INT2' ; CN2.4 U6.11
|
||||
'I2C_SCL' ; CN1.2 CN2.2 R4.1 U6.12
|
||||
'I2C_SDA' ; CN1.3 CN2.3 R3.1 U6.13
|
||||
'IO_BIT0' ; Q3.2 R20.1 R23.2 U6.25
|
||||
'IO_BIT1' ; Q4.2 R22.1 R26.2 U6.26
|
||||
'IO_DOUT1' ; U5.1 U6.21
|
||||
'IO_DOUT2' ; U5.4 U6.19
|
||||
'IO_DOUT3' ; U5.9 U6.14
|
||||
'IO_DOUT4' ; U5.7 U6.16
|
||||
'IO_SCLK1' ; U5.3 U6.20
|
||||
'IO_SCLK2' ; U5.5 U6.18
|
||||
'IO_SCLK3' ; U5.8 U6.15
|
||||
'IO_SCLK4' ; U5.6 U6.17
|
||||
'RJ45-RX' ; H2.1 RJ1.P3 RJ2.P3 U6.1
|
||||
'RJ45-TX' ; RJ1.P5 RJ2.P5
|
||||
'UART1_RXD' ; DEBUG.6 U6.32
|
||||
'UART1_TXD' ; DEBUG.5 U6.33
|
||||
'VCC_12V8' ; 12.8V.1 C2.2 C3.1 C4.2 C5.2 C13.2 C14.2 C15.2 C16.2 C19.2 C20.2 ,
|
||||
D2.1 L1.2 Q1.3 R2.2 U2.3 U3.3
|
||||
'VCC_3V3' ; C17.2 C18.2 C23.1 C29.2 C36.1 C37.2 C38.2 C49.2 C52.2 CN1.1 CN2.1 ,
|
||||
DEBUG.7 Q1.2 Q3.1 Q4.1 R3.2 R4.2 R7.2 R8.2 R14.2 R15.2 R20.2 R22.2 ,
|
||||
R29.1 U5.2 U6.9 U6.24 U6.36 U6.48
|
||||
'VCC_5V' ; BUZZER.1 C11.2 C12.2 D6.1 R21.2 R24.2 U3.2
|
||||
AGND ; C9.1 C10.1 C21.1 C22.2 C24.2 C25.2 C27.1 C28.1 C32.1 C33.2 C34.2 C35.2 ,
|
||||
C39.1 C40.2 C41.1 C42.1 C46.1 C47.2 C50.2 C51.2 CN4.4 CN4.5 CN5.4 ,
|
||||
CN5.5 CN6.4 CN6.5 CN7.4 CN7.5 R11.2 U4.2 U7.2 U12.2 U13.2
|
||||
AINN1 ; C27.2 C30.1 R12.2 U4.3
|
||||
AINN2 ; C28.2 C31.1 R13.2 U7.3
|
||||
AINN3 ; C41.2 C44.1 R18.2 U12.3
|
||||
AINN4 ; C42.2 C45.1 R19.2 U13.3
|
||||
AINP1 ; C30.2 C33.1 R16.2 U4.4
|
||||
AINP2 ; C31.2 C34.1 R17.2 U7.4
|
||||
AINP3 ; C44.2 C50.1 R27.2 U12.4
|
||||
AINP4 ; C45.2 C51.1 R28.2 U13.4
|
||||
BIT0 ; H4.1 Q3.3 R21.1 RJ1.P8 RJ2.P8
|
||||
BIT1 ; H4.2 Q4.3 R24.1 RJ1.P9 RJ2.P9
|
||||
BIT2 ; RJ1.P7 RJ2.P7
|
||||
BIT3 ; RJ1.P2 RJ2.P2
|
||||
BUZZ ; R9.1 U6.28
|
||||
DOUT1 ; U4.6 U5.20
|
||||
DOUT2 ; U5.17 U7.6
|
||||
DOUT3 ; U5.12 U12.6
|
||||
DOUT4 ; U5.14 U13.6
|
||||
GND ; C3.2 C4.1 C5.1 C6.2 C7.1 C8.1 C11.1 C12.1 C13.1 C14.1 C15.1 C16.1 C17.1 ,
|
||||
C18.1 C19.1 C20.1 C23.2 C29.1 C36.2 C37.1 C38.1 C43.1 C48.1 C49.1 ,
|
||||
C52.1 CN1.5 CN2.5 D1.1 D2.2 D4.1 DEBUG.1 H1.2 Q1.1 Q2.2 R6.1 R10.1 ,
|
||||
R11.1 R23.1 R26.1 RJ1.P4 RJ1.P10 RJ2.P4 RJ2.P10 U1.4 U2.1 U3.1 U5.11 ,
|
||||
U6.8 U6.23 U6.35 U6.47 U8.1 U9.1 U10.1 U11.1
|
||||
GREEN ; GREEN.1 LED.2 U6.30
|
||||
ILIM ; R5.2 U1.2 U1.9
|
||||
NRST ; C48.2 DEBUG.2 H1.1 R29.2 U6.7
|
||||
POWER ; C6.1 C7.2 C8.2 D3.1 D5.1 R5.1 U1.3
|
||||
RED ; LED.3 RED.1 U6.29
|
||||
SCLK1 ; U4.5 U5.18
|
||||
SCLK2 ; U5.16 U7.5
|
||||
SCLK3 ; U5.13 U12.5
|
||||
SCLK4 ; U5.15 U13.5
|
||||
SWCLK ; DEBUG.3 U6.37
|
||||
SWDIO ; DEBUG.4 U6.34
|
||||
VIN ; D3.2 D4.2 D5.2 RJ1.P1 RJ2.P1
|
||||
$SCHEDULE
|
||||
$END
|
||||
@@ -145,7 +145,7 @@
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>CMSIS_AGDI</Key>
|
||||
<Name>-X"Any" -UAny -O206 -S0 -C0 -P00000000 -N00("") -D00(00000000) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD1FFF8000 -FC1000 -FN2 -FF0HC32F460_512K.FLM -FS00 -FL080000 -FP0($$Device:HC32F460JETA$FlashARM\HC32F460_512K.FLM) -FF1HC32F460_otp.FLM -FS13000C00 -FL13FC -FP1($$Device:HC32F460JETA$FlashARM\HC32F460_otp.FLM)</Name>
|
||||
<Name>-X"Any" -UAny -O206 -S9 -C0 -P00000000 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO31 -FD1FFF8000 -FC1000 -FN2 -FF0HC32F460_512K.FLM -FS00 -FL080000 -FP0($$Device:HC32F460JETA$FlashARM\HC32F460_512K.FLM) -FF1HC32F460_otp.FLM -FS13000C00 -FL13FC -FP1($$Device:HC32F460JETA$FlashARM\HC32F460_otp.FLM)</Name>
|
||||
</SetRegEntry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
@@ -263,52 +263,47 @@
|
||||
<Ww>
|
||||
<count>21</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>App.aaa,0x0A</ItemText>
|
||||
<ItemText>App.ADTrack.LeftUpVPT,0x0A</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>22</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>App.bbb,0x0A</ItemText>
|
||||
<ItemText>App.ADTrack.LeftLowVPT,0x0A</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>23</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>App.ccc,0x0A</ItemText>
|
||||
<ItemText>App.ADTrack.RightUpVPT,0x0A</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>24</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>App.ddd,0x0A</ItemText>
|
||||
<ItemText>App.ADTrack.RightLowVPT,0x0A</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>25</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>App.ADTrack.LeftUpVPT,0x0A</ItemText>
|
||||
<ItemText>App.ADTrack.Stop_VPT,0x0A</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>26</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>App.ADTrack.LeftLowVPT,0x0A</ItemText>
|
||||
<ItemText>App.MotorPara.Current_height,0x0A</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>27</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>App.ADTrack.RightUpVPT,0x0A</ItemText>
|
||||
<ItemText>App.RStatus</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>28</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>App.ADTrack.RightLowVPT,0x0A</ItemText>
|
||||
<ItemText>App.MotorPara.Current_height,0x0A</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>29</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>App.ADTrack.Stop_VPT,0x0A</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>30</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>App.MotorPara.Current_height,0x0A</ItemText>
|
||||
<ItemText>App.PwRstLastHeight,0x0A</ItemText>
|
||||
</Ww>
|
||||
</WatchWindow1>
|
||||
<WatchWindow2>
|
||||
@@ -389,7 +384,7 @@
|
||||
<DebugFlag>
|
||||
<trace>0</trace>
|
||||
<periodic>1</periodic>
|
||||
<aLwin>0</aLwin>
|
||||
<aLwin>1</aLwin>
|
||||
<aCover>0</aCover>
|
||||
<aSer1>0</aSer1>
|
||||
<aSer2>0</aSer2>
|
||||
@@ -430,7 +425,7 @@
|
||||
<EnableFlashSeq>1</EnableFlashSeq>
|
||||
<EnableLog>0</EnableLog>
|
||||
<Protocol>2</Protocol>
|
||||
<DbgClock>1000000</DbgClock>
|
||||
<DbgClock>5000000</DbgClock>
|
||||
</DebugDescription>
|
||||
</TargetOption>
|
||||
</Target>
|
||||
|
||||
@@ -338,7 +338,7 @@
|
||||
<v6WtE>0</v6WtE>
|
||||
<v6Rtti>0</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<MiscControls>--multibyte_chars</MiscControls>
|
||||
<Define>__DEBUG,HC32F460,USE_DEVICE_DRIVER_LIB,JEUA</Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>..\..\..\mcu\common;..\source\User\Inc;..\source\User\Src;..\..\..\driver\src;..\..\..\driver\inc;..\source\Module\CS1237;..\source\Module\dc_motor;..\source\Module\BeepAndLed</IncludePath>
|
||||
@@ -1026,7 +1026,7 @@
|
||||
<v6WtE>0</v6WtE>
|
||||
<v6Rtti>0</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls>--diag_suppress=186,66</MiscControls>
|
||||
<MiscControls>--diag_suppress=186,66 --multibyte_chars</MiscControls>
|
||||
<Define>HC32F460,USE_DEVICE_DRIVER_LIB</Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>..\..\..\..\..\mcu\common;..\source;..\..\..\..\..\driver\inc;..\..\..\..\..\bsp\ev_hc32f460_lqfp100_v2</IncludePath>
|
||||
|
||||
@@ -343,7 +343,7 @@ void AdcLoopHander(void)
|
||||
init_adc_val /= 2; /* 取平均值 */
|
||||
}
|
||||
}
|
||||
DCMOTOR_DBG_LOG("init_adc_val %d.\n", init_adc_val);
|
||||
//DCMOTOR_DBG_LOG("init_adc_val %d.\n", init_adc_val);
|
||||
AdcInitSta = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,11 @@ typedef struct{
|
||||
DebugExec DBGExec;
|
||||
}DBGFunType;
|
||||
|
||||
/* 控制盒信息帧→复位→恢复 观测打印: ISR推事件, 主循环打印完整时间线(未知帧全记录用于捕捉过热报错) */
|
||||
void Uart3ErrLog_Push(uint8_t type, const uint8_t *pFrame, uint16_t height); /* type:0首次信息帧 1复位中回应 2复位完成 3未知帧 */
|
||||
void Uart3ErrLog_PushBottom(uint8_t type, uint16_t height); /* 上电复位到底判定事件(type:4堵转/5反弹, 8高度采样, 1ms例程调用) */
|
||||
void Uart3ErrLogLoopHandler(void); /* 主循环调用: 打印报错/复位事件 */
|
||||
|
||||
void DebugUartIRQ(char Data);
|
||||
void DebugLoopHandler(void);
|
||||
void Dbg1msRoutine(void);
|
||||
@@ -41,5 +46,9 @@ void Dbg1msRoutine(void);
|
||||
#define DBG_LOG_F(fmt,arg...)
|
||||
#define DBG_ARRAY(ARRAY,SIZE)
|
||||
|
||||
#define Uart3ErrLog_Push(type, pFrame, height) (0)
|
||||
#define Uart3ErrLog_PushBottom(type, height) (0)
|
||||
#define Uart3ErrLogLoopHandler() (0)
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -30,8 +30,11 @@
|
||||
|
||||
#define TRAVEL_TIME_MS 50000
|
||||
|
||||
#define PEAK 1200 //1200mm
|
||||
#define VALLEY 720 //720mm
|
||||
#define PEAK 1430 //最高高度mm
|
||||
#define VALLEY 1000 //最低高度mm
|
||||
|
||||
/*高度转应力表索引: 补偿表431点覆盖1000~1430mm(430个步进), h<1000时钳位到0防止越界*/
|
||||
#define HEIGHT_TO_IDX(h) ((h) < 1000 ? 0 : ((h) - 1000))
|
||||
|
||||
#define BDC_STOP() (SET_TWIN_BIT0(),SET_TWIN_BIT1())
|
||||
#define BDC_DOWN() (SET_TWIN_BIT0(),CLR_TWIN_BIT1())
|
||||
@@ -73,14 +76,15 @@ typedef struct{
|
||||
typedef struct{//电机参数
|
||||
bool InitialFlag;//初始标志位
|
||||
bool RestFlag;
|
||||
bool OverheatFlag;//过热标志: 收到过热帧后置true, 持续下降触发控制盒复位
|
||||
bool CaliFlag;
|
||||
bool LoopOne;//循环一次标志位
|
||||
int16_t Current_height;//当前高度mm
|
||||
int16_t Current_height;//当前高度mm(控制盒上报1000~1430)
|
||||
int16_t CaliNum;//标校数量
|
||||
int32_t LU_HeightStress[488];//左上传感器对应高度应力
|
||||
int32_t LL_HeightStress[488];//左下传感器对应高度应力
|
||||
int32_t RU_HeightStress[488];//右上传感器对应高度应力
|
||||
int32_t RL_HeightStress[488];//右上传感器对应高度应力
|
||||
int32_t LU_HeightStress[431];//左上传感器对应高度应力
|
||||
int32_t LL_HeightStress[431];//左下传感器对应高度应力
|
||||
int32_t RU_HeightStress[431];//右上传感器对应高度应力
|
||||
int32_t RL_HeightStress[431];//右下传感器对应高度应力
|
||||
}MotorPara_t;
|
||||
/*数据读取状态机*/
|
||||
typedef enum {
|
||||
@@ -111,6 +115,7 @@ typedef enum {
|
||||
APP_STATUS_WAIT_STEADY,
|
||||
APP_STATUS_END_BEEP,
|
||||
APP_STATUS_HEIGHT_CONTROL,
|
||||
APP_STATUS_POWER_RESET,//上电复位流程: 下降触发控制盒复位, 复位完成后编码器基准一致再进入校准
|
||||
}AppStatus_m;
|
||||
|
||||
typedef struct{
|
||||
@@ -147,9 +152,30 @@ typedef struct {
|
||||
uint32_t SlopeCollDelay1mSCnt;
|
||||
uint32_t CailUp1mSCnt;
|
||||
uint32_t HeightContRolCnt;
|
||||
uint32_t RestStop1mSCnt;//复位停顿计时: 收到复位帧后先停止电机, 计时结束再下降触发复位
|
||||
uint32_t PwRstStop1mSCnt;//上电复位到底停顿计时: 下降到底后先停止电机, 计时结束再继续下降触发复位
|
||||
uint16_t PwRstNoChg1mSCnt;//上电复位下降中高度无变化计时: 持续1秒无变化判定到底
|
||||
int16_t PwRstLastHeight;//上电复位下降中上一次高度值, 用于比较高度是否变化
|
||||
int16_t PwRstRiseRef;//上电复位反弹判定参考高度: 只跟随下降/持平更新(只跟跌不跟涨), 高度较其反升>1cm判定碰撞
|
||||
int16_t PwRstMinHeight;//上电复位下降过程历史最低高度: 确认到底仅限接近最低点, 停在高处=被障碍物/碰撞保护托住
|
||||
bool PwRstHtSeen;//上电复位已收到首帧有效高度标志: 高度基准就绪后才启动到底检测(防止首帧误判反弹)
|
||||
uint8_t PwRstReboundCnt;//上电复位连续反弹计数: 首次反弹停1秒恢复下降观察, 再次反弹才转点动(到底确认时清零)
|
||||
uint16_t PwRstInch1mSCnt;//上电复位点动下降节奏计时: 反弹后改为脉冲式下降减小触底冲击
|
||||
uint16_t PwRstInchLastHeight;//上电复位点动周期起点高度: 周期结束时比较判断该周期是否移动
|
||||
uint8_t PwRstInchNoMvCnt;//上电复位点动无位移周期计数: 连续2个点动周期无位移判定到底
|
||||
bool PwRstErrValid;//上电复位报错帧已处理标志: 同一报错码连发只停顿一次, 防止连发广播把停顿无限续期
|
||||
uint16_t PwRstErrCode;//上电复位已处理的报错码(帧[2]<<8|帧[3]): 不同报错码视为新报错重新停顿
|
||||
uint16_t PwRstSamp1mSCnt;//上电复位高度采样计时: 每秒打印一次当前高度, 展示下降全程高度曲线
|
||||
uint16_t PwRstRiseCandCnt;//上电复位反弹候选持续计时: 反升>1cm持续300ms才确认反弹, 滤除瞬时抖动毛刺
|
||||
int16_t PwRstRiseCandMax;//上电复位反弹候选期间最高高度: 确认时高度须仍接近最高点(未回落)
|
||||
uint16_t PwRstStartDlyCnt;//上电复位开始前延时: 等电机控制盒自身初始化完成(整体断电再上电时控制盒未就绪, 立即下降会因状态切换抖动误触发碰撞保护)
|
||||
bool PwRstMovedFlag;//上电复位已发生位移标志: 高度变化过(电机已响应下降指令)后才允许堵转到底判定, 防止延时/控制盒软启动期间高度停滞误判到底
|
||||
uint8_t FeedDogDlyCnt;
|
||||
|
||||
bool CaliZeroFlag;//校零标志位
|
||||
bool PowerResetFlag;//上电复位流程标志: 上电复位中收到过复位帧, 收到高度帧(复位完成)后进入校准
|
||||
bool PwRstBottomFlag;//上电复位最终到底标志: 点动下降中高度1秒无变化才确认, 之后点动下降触发复位帧
|
||||
bool PwRstInchMode;//上电复位点动模式: 发生反弹后生效, 接近反弹高度时改脉冲式下降减小触底冲击
|
||||
bool SideFlag;//侧压标志位
|
||||
bool UpFlag;//上升标志位
|
||||
bool DownFlag;//下降标志位
|
||||
|
||||
@@ -400,6 +400,259 @@ const DBGFunType DebugFun[DEBUG_CMD_CNT] = {
|
||||
"wave", DBGWave_on_off,
|
||||
};
|
||||
|
||||
/*=========================================================================================
|
||||
* 函数名称: Uart3ErrLog_xxx
|
||||
* 功能描述: 控制盒报错(01 04)→复位→恢复 观测打印。接收中断中仅推事件入环形缓冲(不打印),
|
||||
* 由主循环Uart3ErrLogLoopHandler()统一打印, 完整呈现"触发报错→置复位标志→
|
||||
* 复位过程多包回应→复位完成恢复正常"的时间线。
|
||||
* 协议: 01 04 d2 d3 = 报错帧(d2/d3为错误码, 如过热); 01 01 h_hi h_lo = 高度帧(清除复位标志)
|
||||
*=========================================================================================*/
|
||||
#define U3ERR_EVT_MAX 16 /* 事件缓冲条数 */
|
||||
#define U3ERR_STATUS_NUM 13 /* 主状态机状态个数 */
|
||||
|
||||
/* 事件类型 */
|
||||
#define U3ERR_T_FIRST 0 /* 首次信息帧(复位标志 0→1) */
|
||||
#define U3ERR_T_REPLY 1 /* 复位中回应信息帧(复位标志已置位) */
|
||||
#define U3ERR_T_DONE 2 /* 复位完成(收到高度帧, 复位标志 1→0) */
|
||||
#define U3ERR_T_UNKNOWN 3 /* 未知帧(非高度/信息帧, 用于捕捉过热等其它报错) */
|
||||
#define U3ERR_T_BOTTOM 4 /* 上电复位到底判定-堵转(下降中高度1秒无变化) */
|
||||
#define U3ERR_T_REBOUND 5 /* 上电复位到底判定-反弹(下降中高度不降反升, 触底震荡/碰撞反向) */
|
||||
#define U3ERR_T_TOUCH 7 /* 上电复位首次反弹-到底接触小反弹(停1秒恢复下降观察, 不转点动) */
|
||||
#define U3ERR_T_HTSAMP 8 /* 上电复位高度采样(每秒一条, 展示下降全程高度曲线) */
|
||||
|
||||
typedef struct{
|
||||
uint8_t Type; /* 事件类型 */
|
||||
uint8_t Bits; /* BIT0/BIT1 输出电平(bit0/bit1) */
|
||||
uint8_t Status; /* 事件时刻主状态机状态 */
|
||||
uint8_t Frame[4]; /* 原始4字节帧 */
|
||||
uint16_t Height; /* type2: 高度帧数值(mm); type4/5: 判定时刻高度 */
|
||||
uint16_t Repeat; /* 连发合并的重复包数(不含首包) */
|
||||
uint32_t Tick; /* 事件时刻(ms, 上电起) */
|
||||
}U3ErrEvt_t;
|
||||
|
||||
/* 连发合并状态: 相同帧500ms内只计数不重复入队, 防止过热帧持续广播刷爆缓冲 */
|
||||
static uint8_t m_U3ErrLastType = 0xFF; /* 上一帧类型(0xFF=无) */
|
||||
static uint8_t m_U3ErrLastFrame[4]; /* 上一帧内容 */
|
||||
static uint16_t m_U3ErrLastHeight = 0; /* 上一帧高度(type2) */
|
||||
static uint32_t m_U3ErrLastTick = 0; /* 上一帧时刻 */
|
||||
static uint32_t m_U3ErrFirstTick = 0; /* 当前滞留帧的起始时刻(连发持续超5秒也强制落一条) */
|
||||
static uint16_t m_U3ErrRepeat = 0; /* 上一帧已合并的重复包数 */
|
||||
|
||||
static const char *m_U3ErrStatusName[U3ERR_STATUS_NUM] = {
|
||||
"IDLE", "ON", "OFF", "START_BEEP", "MOTOR_INIT", "ZERO_MARKING",
|
||||
"WAIT_MOTOR_INIT", "WAIT_MOTOR_CALI_UP", "WAIT_MOTOR_CALI_DOWN",
|
||||
"WAIT_STEADY", "END_BEEP", "HEIGHT_CONTROL", "POWER_RESET"
|
||||
};
|
||||
|
||||
static U3ErrEvt_t m_U3ErrEvt[U3ERR_EVT_MAX]; /* 事件环形缓冲 */
|
||||
static volatile uint16_t m_U3ErrWr = 0; /* 写指针(中断) */
|
||||
static volatile uint16_t m_U3ErrRd = 0; /* 读指针(主循环) */
|
||||
static volatile uint32_t m_U3ErrLostCnt = 0; /* 缓冲满时丢弃条数 */
|
||||
|
||||
/* 函数名称: Uart3ErrLog_Enqueue
|
||||
* 功能描述: 将事件落入队列(内部使用, 关中断保护) */
|
||||
static void Uart3ErrLog_Enqueue(uint8_t type, const uint8_t *pFrame, uint16_t height, uint32_t tick, uint16_t repeat)
|
||||
{
|
||||
U3ErrEvt_t evt;
|
||||
evt.Type = type;
|
||||
evt.Bits = (uint8_t)((GET_BIT0_DOUT() ? 0x01u : 0u) | (GET_BIT1_DOUT() ? 0x02u : 0u));
|
||||
evt.Status = (uint8_t)App.Status;
|
||||
evt.Frame[0] = pFrame[0];
|
||||
evt.Frame[1] = pFrame[1];
|
||||
evt.Frame[2] = pFrame[2];
|
||||
evt.Frame[3] = pFrame[3];
|
||||
evt.Height = height;
|
||||
evt.Repeat = repeat;
|
||||
evt.Tick = tick;
|
||||
|
||||
uint32_t primask = __get_PRIMASK();
|
||||
__disable_irq();
|
||||
uint16_t next = (uint16_t)((m_U3ErrWr + 1U) % U3ERR_EVT_MAX);
|
||||
if(next != m_U3ErrRd){ /* 未满则入队 */
|
||||
m_U3ErrEvt[m_U3ErrWr] = evt;
|
||||
m_U3ErrWr = next;
|
||||
}
|
||||
else{ /* 满则丢弃当前条并计数 */
|
||||
m_U3ErrLostCnt++;
|
||||
}
|
||||
if(primask == 0U){
|
||||
__enable_irq();
|
||||
}
|
||||
}
|
||||
|
||||
/* 函数名称: Uart3ErrLog_Push
|
||||
* 功能描述: 记录一条报错/复位事件(在USART3接收中断中调用)。相同帧500ms内连发只合并计数,
|
||||
* 由主循环在连发结束(超时)或出现新帧时落一条带"连发N包"的事件, 避免缓冲溢出 */
|
||||
void Uart3ErrLog_Push(uint8_t type, const uint8_t *pFrame, uint16_t height)
|
||||
{
|
||||
uint32_t tick = SysTick_GetTick();
|
||||
/* 连发合并: 与上一帧类型/内容相同且间隔<500ms(type2复位完成除外), 只计数 */
|
||||
if((m_U3ErrLastType != 0xFF) && (type == m_U3ErrLastType) && (type != U3ERR_T_DONE) &&
|
||||
(pFrame[0] == m_U3ErrLastFrame[0]) && (pFrame[1] == m_U3ErrLastFrame[1]) &&
|
||||
(pFrame[2] == m_U3ErrLastFrame[2]) && (pFrame[3] == m_U3ErrLastFrame[3]) &&
|
||||
((tick - m_U3ErrLastTick) < 500U))
|
||||
{
|
||||
m_U3ErrRepeat++;
|
||||
m_U3ErrLastTick = tick;
|
||||
return;
|
||||
}
|
||||
/* 与上一帧不同: 先把滞留的上一帧连同连发计数落队 */
|
||||
if(m_U3ErrLastType != 0xFF){
|
||||
Uart3ErrLog_Enqueue(m_U3ErrLastType, m_U3ErrLastFrame, m_U3ErrLastHeight, m_U3ErrLastTick, m_U3ErrRepeat);
|
||||
m_U3ErrRepeat = 0;
|
||||
}
|
||||
/* 本帧记为新的滞留帧, 待其连发结束或下一帧到来时落队 */
|
||||
m_U3ErrLastType = type;
|
||||
m_U3ErrLastFrame[0] = pFrame[0];
|
||||
m_U3ErrLastFrame[1] = pFrame[1];
|
||||
m_U3ErrLastFrame[2] = pFrame[2];
|
||||
m_U3ErrLastFrame[3] = pFrame[3];
|
||||
m_U3ErrLastHeight = height;
|
||||
m_U3ErrLastTick = tick;
|
||||
m_U3ErrFirstTick = tick;
|
||||
}
|
||||
|
||||
/* 函数名称: Uart3ErrLog_PushBottom
|
||||
* 功能描述: 记录上电复位"下降到底判定"事件(type:4堵转/5反弹, SysTick 1ms例程调用,
|
||||
* 立即落队不参与连发合并), 先落队滞留帧保证事件时间线顺序(临界区保护) */
|
||||
void Uart3ErrLog_PushBottom(uint8_t type, uint16_t height)
|
||||
{
|
||||
uint8_t zero[4] = {0};
|
||||
uint32_t primask = __get_PRIMASK();
|
||||
__disable_irq();
|
||||
if(m_U3ErrLastType != 0xFF){
|
||||
Uart3ErrLog_Enqueue(m_U3ErrLastType, m_U3ErrLastFrame, m_U3ErrLastHeight, m_U3ErrLastTick, m_U3ErrRepeat);
|
||||
m_U3ErrLastType = 0xFF;
|
||||
m_U3ErrRepeat = 0;
|
||||
}
|
||||
Uart3ErrLog_Enqueue(type, zero, height, SysTick_GetTick(), 0);
|
||||
if(primask == 0U){
|
||||
__enable_irq();
|
||||
}
|
||||
}
|
||||
|
||||
/* 函数名称: Uart3ErrLog_BitsName
|
||||
* 功能描述: BIT0/BIT1输出电平转"升/降/停"描述(ASCII, 避免AC5源码集问题) */
|
||||
static const char *Uart3ErrLog_BitsName(uint8_t bits)
|
||||
{
|
||||
if((bits & 0x01u) && (bits & 0x02u)) return "STOP";
|
||||
if(bits & 0x02u) return "UP";
|
||||
if(bits & 0x01u) return "DOWN";
|
||||
return "?";
|
||||
}
|
||||
|
||||
/* 函数名称: Uart3ErrLog_CodeName
|
||||
* 功能描述: 已知帧内容转义(发现新帧格式后在此扩充) */
|
||||
static const char *Uart3ErrLog_CodeName(const uint8_t *pFrame)
|
||||
{
|
||||
if(pFrame[0] == 0x01 && pFrame[1] == 0x02 && pFrame[2] == 0x00 && pFrame[3] == 0x10) return "(OVERHEAT)";
|
||||
if(pFrame[0] == 0x01 && pFrame[1] == 0x02 && pFrame[2] == 0x40 && pFrame[3] == 0x00) return "(E07)";
|
||||
if(pFrame[0] == 0x01 && pFrame[1] == 0x02 && pFrame[2] == 0x00 && pFrame[3] == 0x08) return "(E12)";
|
||||
if(pFrame[0] == 0x01 && pFrame[1] == 0x02 && pFrame[2] == 0x02 && pFrame[3] == 0x00) return "(E02)";
|
||||
if(pFrame[2] == 0x01 && pFrame[3] == 0xAA) return "(RESET)";
|
||||
return "";
|
||||
}
|
||||
|
||||
/* 函数名称: Uart3ErrLog_StatusName
|
||||
* 功能描述: 主状态机状态值转可读名 */
|
||||
static const char *Uart3ErrLog_StatusName(uint8_t status)
|
||||
{
|
||||
if(status < U3ERR_STATUS_NUM){
|
||||
return m_U3ErrStatusName[status];
|
||||
}
|
||||
return "?";
|
||||
}
|
||||
|
||||
/* 函数名称: Uart3ErrLogLoopHandler
|
||||
* 功能描述: 主循环中调用, 打印报错→复位→恢复的完整事件时间线(连发帧合并为一条并显示包数) */
|
||||
void Uart3ErrLogLoopHandler(void)
|
||||
{
|
||||
uint8_t cnt;
|
||||
/* 滞留帧落队时机: ①连发结束(500ms无同帧, 含单帧情况) ②连发持续超5秒强制落一条
|
||||
(控制盒报错状态会持续广播报错帧, 若只等连发结束则期间日志完全静默, 看起来像没收到) */
|
||||
if(m_U3ErrLastType != 0xFF){
|
||||
uint32_t now = SysTick_GetTick();
|
||||
if(((now - m_U3ErrLastTick) >= 500U) || ((now - m_U3ErrFirstTick) >= 5000U))
|
||||
{
|
||||
Uart3ErrLog_Enqueue(m_U3ErrLastType, m_U3ErrLastFrame, m_U3ErrLastHeight, m_U3ErrLastTick, m_U3ErrRepeat);
|
||||
m_U3ErrLastType = 0xFF;
|
||||
m_U3ErrRepeat = 0;
|
||||
}
|
||||
}
|
||||
for(cnt = 0; cnt < 8U; cnt++){
|
||||
char rep[20];
|
||||
if(m_U3ErrRd == m_U3ErrWr){
|
||||
break;
|
||||
}
|
||||
U3ErrEvt_t evt = m_U3ErrEvt[m_U3ErrRd];
|
||||
m_U3ErrRd = (uint16_t)((m_U3ErrRd + 1U) % U3ERR_EVT_MAX);
|
||||
uint32_t s = evt.Tick / 1000U;
|
||||
uint32_t ms = evt.Tick % 1000U;
|
||||
if(evt.Repeat > 0U){
|
||||
sprintf(rep, ",burst %u", evt.Repeat + 1U);
|
||||
}
|
||||
else{
|
||||
rep[0] = '\0';
|
||||
}
|
||||
switch(evt.Type){
|
||||
case U3ERR_T_FIRST: /* 首次信息帧: 置复位标志 */
|
||||
DBG_LOG("[T+%3u.%03us][%s|OUT:%s] INFO: code=0x%02X%02X%s -> SetRestFlag%s\r\n",
|
||||
s, ms, Uart3ErrLog_StatusName(evt.Status),
|
||||
Uart3ErrLog_BitsName(evt.Bits),
|
||||
evt.Frame[2], evt.Frame[3],
|
||||
Uart3ErrLog_CodeName(evt.Frame), rep);
|
||||
break;
|
||||
case U3ERR_T_REPLY: /* 复位中回应信息帧 */
|
||||
DBG_LOG("[T+%3u.%03us][%s|OUT:%s] INFO-REPLY: code=0x%02X%02X%s (RestFlag set%s)\r\n",
|
||||
s, ms, Uart3ErrLog_StatusName(evt.Status),
|
||||
Uart3ErrLog_BitsName(evt.Bits),
|
||||
evt.Frame[2], evt.Frame[3],
|
||||
Uart3ErrLog_CodeName(evt.Frame), rep);
|
||||
break;
|
||||
case U3ERR_T_DONE: /* 复位完成: 收到高度帧 */
|
||||
DBG_LOG("[T+%3u.%03us][%s|OUT:%s] Height=%dmm -> RestFlag cleared, normal\r\n",
|
||||
s, ms, Uart3ErrLog_StatusName(evt.Status),
|
||||
Uart3ErrLog_BitsName(evt.Bits), evt.Height);
|
||||
break;
|
||||
case U3ERR_T_UNKNOWN: /* 未知帧: 过热等其它报错可能在此 */
|
||||
DBG_LOG("[T+%3u.%03us][%s|OUT:%s] UNKNOWN: %02X %02X %02X %02X %s(ATTENTION)%s\r\n",
|
||||
s, ms, Uart3ErrLog_StatusName(evt.Status),
|
||||
Uart3ErrLog_BitsName(evt.Bits),
|
||||
evt.Frame[0], evt.Frame[1], evt.Frame[2], evt.Frame[3],
|
||||
Uart3ErrLog_CodeName(evt.Frame), rep);
|
||||
break;
|
||||
case U3ERR_T_BOTTOM: /* 上电复位: 高度2秒无变化判定到底(堵转), 停顿后持续下降触发复位 */
|
||||
DBG_LOG("[T+%3u.%03us][%s|OUT:%s] BOTTOM-STALL: Height=%dmm no-change 2s\r\n",
|
||||
s, ms, Uart3ErrLog_StatusName(evt.Status),
|
||||
Uart3ErrLog_BitsName(evt.Bits), evt.Height);
|
||||
break;
|
||||
case U3ERR_T_REBOUND: /* 上电复位: 再次反弹判定碰撞震荡(触底震荡/碰撞反向), 转点动下降 */
|
||||
DBG_LOG("[T+%3u.%03us][%s|OUT:%s] BOTTOM-REBOUND: Height=%dmm collision, switch to inching\r\n",
|
||||
s, ms, Uart3ErrLog_StatusName(evt.Status),
|
||||
Uart3ErrLog_BitsName(evt.Bits), evt.Height);
|
||||
break;
|
||||
case U3ERR_T_TOUCH: /* 上电复位: 首次反弹(到底接触小反弹), 停1秒恢复下降观察不转点动 */
|
||||
DBG_LOG("[T+%3u.%03us][%s|OUT:%s] BOTTOM-TOUCH: Height=%dmm rising, pause 1s then keep descending\r\n",
|
||||
s, ms, Uart3ErrLog_StatusName(evt.Status),
|
||||
Uart3ErrLog_BitsName(evt.Bits), evt.Height);
|
||||
break;
|
||||
case U3ERR_T_HTSAMP: /* 上电复位: 高度采样(每秒), 展示下降全程高度曲线 */
|
||||
DBG_LOG("[T+%3u.%03us][%s|OUT:%s] HEIGHT-SAMP: %dmm\r\n",
|
||||
s, ms, Uart3ErrLog_StatusName(evt.Status),
|
||||
Uart3ErrLog_BitsName(evt.Bits), evt.Height);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if((m_U3ErrRd == m_U3ErrWr) && (m_U3ErrLostCnt > 0U)){ /* 缓冲曾溢出 */
|
||||
uint32_t tick = SysTick_GetTick();
|
||||
DBG_LOG("[T+%3u.%03us] NOTE: ErrLog buf overflow, lost %u events\r\n",
|
||||
tick / 1000U, tick % 1000U, m_U3ErrLostCnt);
|
||||
m_U3ErrLostCnt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ void LEFTUP_CS1237AinADataProcessCallBack(int32_t AD)
|
||||
// }
|
||||
if(App.MotorPara.CaliFlag == true)
|
||||
{
|
||||
AD = AD + App.MotorPara.LU_HeightStress[(App.MotorPara.Current_height)-725];
|
||||
AD = AD + App.MotorPara.LU_HeightStress[HEIGHT_TO_IDX(App.MotorPara.Current_height)];
|
||||
for(int i = OSC_CNT-1; i > 0; i--)
|
||||
{
|
||||
App.LeftUpCS1237_TrendArray[i] = App.LeftUpCS1237_TrendArray[i - 1];
|
||||
@@ -68,7 +68,7 @@ void LEFTLOW_CS1237AinADataProcessCallBack(int32_t AD)
|
||||
// }
|
||||
if(App.MotorPara.CaliFlag == true)
|
||||
{
|
||||
AD = AD + App.MotorPara.LL_HeightStress[(App.MotorPara.Current_height)-725];
|
||||
AD = AD + App.MotorPara.LL_HeightStress[HEIGHT_TO_IDX(App.MotorPara.Current_height)];
|
||||
for(int i = OSC_CNT-1; i > 0; i--)
|
||||
{
|
||||
App.LeftLowCS1237_TrendArray[i] = App.LeftLowCS1237_TrendArray[i - 1];
|
||||
@@ -94,7 +94,7 @@ void RIGHTUP_CS1237AinADataProcessCallBack(int32_t AD)
|
||||
// }
|
||||
if(App.MotorPara.CaliFlag == true)
|
||||
{
|
||||
AD = AD + App.MotorPara.RU_HeightStress[(App.MotorPara.Current_height)-725];
|
||||
AD = AD + App.MotorPara.RU_HeightStress[HEIGHT_TO_IDX(App.MotorPara.Current_height)];
|
||||
for(int i = OSC_CNT-1; i > 0; i--)
|
||||
{
|
||||
App.RightUpCS1237_TrendArray[i] = App.RightUpCS1237_TrendArray[i - 1];
|
||||
@@ -120,7 +120,7 @@ void RIGHTLOW_CS1237AinADataProcessCallBack(int32_t AD)
|
||||
// }
|
||||
if(App.MotorPara.CaliFlag == true)
|
||||
{
|
||||
AD = AD + App.MotorPara.RL_HeightStress[(App.MotorPara.Current_height)-725];
|
||||
AD = AD + App.MotorPara.RL_HeightStress[HEIGHT_TO_IDX(App.MotorPara.Current_height)];
|
||||
for(int i = OSC_CNT-1; i > 0; i--)
|
||||
{
|
||||
App.RightLowCS1237_TrendArray[i] = App.RightLowCS1237_TrendArray[i - 1];
|
||||
@@ -331,7 +331,7 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
{
|
||||
// if(App.CaliZeroFlag == true)//判断是否校零
|
||||
{
|
||||
if(App.MotorPara.Current_height < 1195)
|
||||
if(App.MotorPara.Current_height < 1425)
|
||||
{
|
||||
BDC_UP();
|
||||
App.CaliZeroFlag = false;
|
||||
@@ -353,7 +353,7 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
{
|
||||
// if(App.CaliZeroFlag == true)//判断是否校零
|
||||
{
|
||||
if(App.MotorPara.Current_height > 725)
|
||||
if(App.MotorPara.Current_height > 1005)
|
||||
{
|
||||
BDC_DOWN();
|
||||
App.CaliZeroFlag = false;
|
||||
@@ -379,7 +379,7 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
{
|
||||
// if(App.CaliZeroFlag == true)//判断是否校零
|
||||
{
|
||||
if(App.MotorPara.Current_height < 1195)
|
||||
if(App.MotorPara.Current_height < 1425)
|
||||
{
|
||||
BDC_UP();
|
||||
App.CaliZeroFlag = false;
|
||||
@@ -401,7 +401,7 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
{
|
||||
// if(App.CaliZeroFlag == true)//判断是否校零
|
||||
{
|
||||
if(App.MotorPara.Current_height > 725)
|
||||
if(App.MotorPara.Current_height > 1005)
|
||||
{
|
||||
BDC_DOWN();
|
||||
App.CaliZeroFlag = false;
|
||||
@@ -443,7 +443,7 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
&& (abs(Oll_diff3) > abs(Orl_diff3) * SHIELD_VPT)
|
||||
)
|
||||
{
|
||||
if(App.MotorPara.Current_height < 1195)
|
||||
if(App.MotorPara.Current_height < 1425)
|
||||
{
|
||||
BDC_UP();
|
||||
App.CaliZeroFlag = false;
|
||||
@@ -483,7 +483,7 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
&& (abs(Oll_diff3) > abs(Orl_diff3) * SHIELD_VPT)
|
||||
)
|
||||
{
|
||||
if(App.MotorPara.Current_height > 725)
|
||||
if(App.MotorPara.Current_height > 1005)
|
||||
{
|
||||
BDC_DOWN();
|
||||
App.CaliZeroFlag = false;
|
||||
@@ -526,7 +526,7 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
&& (abs(Orl_diff3) > abs(Oll_diff3) * SHIELD_VPT)
|
||||
)
|
||||
{
|
||||
if(App.MotorPara.Current_height < 1195)
|
||||
if(App.MotorPara.Current_height < 1425)
|
||||
{
|
||||
BDC_UP();
|
||||
App.CaliZeroFlag = false;
|
||||
@@ -565,7 +565,7 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
&& (abs(Orl_diff3) > abs(Oll_diff3) * SHIELD_VPT)
|
||||
)
|
||||
{
|
||||
if(App.MotorPara.Current_height > 725)
|
||||
if(App.MotorPara.Current_height > 1005)
|
||||
{
|
||||
BDC_DOWN();
|
||||
App.CaliZeroFlag = false;
|
||||
@@ -602,8 +602,8 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
&& ((Olu_diff1 + Oru_diff1) > -(App.ADTrack.Stop_VPT*2/3))
|
||||
&& ((Olu_diff2 + Oru_diff2) > -(App.ADTrack.Stop_VPT*2/3))
|
||||
&& ((Olu_diff3 + Oru_diff3) > -(App.ADTrack.Stop_VPT*2/3)))
|
||||
|| App.MotorPara.Current_height >= 1195
|
||||
|| App.MotorPara.Current_height <= 725
|
||||
|| App.MotorPara.Current_height >= 1425
|
||||
|| App.MotorPara.Current_height <= 1005
|
||||
)
|
||||
{
|
||||
BDC_STOP();
|
||||
@@ -647,8 +647,8 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
&& ((Olu_diff1 + Oru_diff1) > -(App.ADTrack.Stop_VPT*2/3))
|
||||
&& ((Olu_diff2 + Oru_diff2) > -(App.ADTrack.Stop_VPT*2/3))
|
||||
&& ((Olu_diff3 + Oru_diff3) > -(App.ADTrack.Stop_VPT*2/3)))
|
||||
|| App.MotorPara.Current_height >= 1195
|
||||
|| App.MotorPara.Current_height <= 725
|
||||
|| App.MotorPara.Current_height >= 1425
|
||||
|| App.MotorPara.Current_height <= 1005
|
||||
)
|
||||
{
|
||||
BDC_STOP();
|
||||
@@ -695,8 +695,8 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
&& ((Olu_diff1 + Oru_diff1) < (App.ADTrack.Stop_VPT*2/3))
|
||||
&& ((Olu_diff2 + Oru_diff2) < (App.ADTrack.Stop_VPT*2/3))
|
||||
&& ((Olu_diff3 + Oru_diff3) < (App.ADTrack.Stop_VPT*2/3)))
|
||||
|| App.MotorPara.Current_height >= 1195
|
||||
|| App.MotorPara.Current_height <= 725
|
||||
|| App.MotorPara.Current_height >= 1425
|
||||
|| App.MotorPara.Current_height <= 1005
|
||||
)
|
||||
{
|
||||
BDC_STOP();
|
||||
@@ -740,8 +740,8 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
&& ((Olu_diff1 + Oru_diff1) < (App.ADTrack.Stop_VPT*2/3))
|
||||
&& ((Olu_diff2 + Oru_diff2) < (App.ADTrack.Stop_VPT*2/3))
|
||||
&& ((Olu_diff3 + Oru_diff3) < (App.ADTrack.Stop_VPT*2/3)))
|
||||
|| App.MotorPara.Current_height >= 1195
|
||||
|| App.MotorPara.Current_height <= 725
|
||||
|| App.MotorPara.Current_height >= 1425
|
||||
|| App.MotorPara.Current_height <= 1005
|
||||
)
|
||||
{
|
||||
BDC_STOP();
|
||||
@@ -804,8 +804,8 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
|
||||
{
|
||||
if(App.StopFlag == true
|
||||
&& App.StopCollDelay1mSCnt <= 0
|
||||
&& App.MotorPara.Current_height <= 1195
|
||||
&& App.MotorPara.Current_height >= 725){
|
||||
&& App.MotorPara.Current_height <= 1425
|
||||
&& App.MotorPara.Current_height >= 1005){
|
||||
App.ADTrack.LeftUp_Org_AdZero = lu_ad[0];
|
||||
App.ADTrack.LeftLow_Org_AdZero = ll_ad[0];
|
||||
App.ADTrack.RightUp_Org_AdZero = ru_ad[0];
|
||||
@@ -973,34 +973,59 @@ static void AppLoopHandler(void)
|
||||
LED_RED_ON();
|
||||
LED_GREEN_OFF();
|
||||
Beeper_Start(200,200,2);
|
||||
App.TD1mSDelayCnt = 1000;
|
||||
App.Status = APP_STATUS_MOTOR_INIT;
|
||||
App.TD1mSDelayCnt = 60000;//上电复位触发超时: 1分钟无复位帧返回则转异常状态
|
||||
App.PwRstNoChg1mSCnt = 0;//清到底检测计数
|
||||
App.PwRstLastHeight = App.MotorPara.Current_height;//记录初始高度用于到底检测
|
||||
App.PwRstRiseRef = App.MotorPara.Current_height;//反弹判定参考高度初始化(只跟跌不跟涨)
|
||||
App.PwRstHtSeen = false;//高度基准未就绪, 收到首帧有效高度后再初始化参考值并启动到底检测
|
||||
App.PwRstReboundCnt = 0;//清连续反弹计数
|
||||
App.PwRstMinHeight = 1430;//历史最低高度初始化为量程上限, 收到首帧有效高度时精确初始化
|
||||
App.PwRstBottomFlag = false;
|
||||
App.PwRstInchMode = false;
|
||||
App.PwRstInch1mSCnt = 0;
|
||||
App.PwRstInchNoMvCnt = 0;
|
||||
App.PwRstErrValid = false;//清报错码处理标志, 上电后首个报错码触发一次停顿
|
||||
App.PwRstErrCode = 0;
|
||||
App.PwRstSamp1mSCnt = 0;//清高度采样计时
|
||||
App.PwRstRiseCandCnt = 0;//清反弹候选计时
|
||||
App.PwRstRiseCandMax = 0;//清反弹候选最高点
|
||||
App.PwRstStartDlyCnt = 2000;//上电先延时2秒: 整体断电再上电时控制盒自身初始化未完成, 立即下降会因状态切换抖动误触发碰撞保护
|
||||
App.PwRstMovedFlag = false;//未发生位移: 延时/控制盒软启动期间高度停滞不判堵转到底
|
||||
App.Status = APP_STATUS_POWER_RESET;//上电先走复位流程, 保证换控制盒后高度基准一致, 再进入校准
|
||||
break;}
|
||||
|
||||
case APP_STATUS_MOTOR_INIT:{
|
||||
if(App.TD1mSDelayCnt <= 0)
|
||||
{
|
||||
BDC_UP();
|
||||
Ddl_Delay1ms(1000);
|
||||
BDC_DOWN();
|
||||
App.DownFlag = true;
|
||||
App.StopFlag = false;
|
||||
App.Status = APP_STATUS_WAIT_MOTOR_INIT;
|
||||
App.TD1mSDelayCnt = TRAVEL_TIME_MS;
|
||||
}
|
||||
break;}
|
||||
|
||||
case APP_STATUS_WAIT_MOTOR_INIT:{
|
||||
if(App.TD1mSDelayCnt <= 0)
|
||||
{
|
||||
case APP_STATUS_POWER_RESET:{
|
||||
/* 上电复位流程: 不判断高度一直下降(换控制盒后编码器可能错位, 高度信息不可信)。
|
||||
到底检测(1ms例程): 反弹(高度较参考点反升>1cm, 控制盒碰撞保护主动反向)首次只
|
||||
停1秒恢复下降观察(常规到底接触的小反弹会自行稳定), 再次反弹才判定碰撞转点动
|
||||
下降(模拟手按, 每1000ms降200ms停800ms)一点点挪, 连续2个点动周期无位移才最终
|
||||
确认到底且需接近历史最低点(停在高处=被障碍物/碰撞保护托住, 转点动试探; 全程
|
||||
未反弹则高度2秒无变化确认)→停1秒→持续下降触发控制盒发复位
|
||||
帧(01 04)→停2s→再下降→控制盒完成复位发高度帧(编码器基准重置, 高度一致)→直接
|
||||
记录零点开始校准(去掉起步动作)。到底确认时清反弹计数, 确认后的下压反弹只停
|
||||
1秒继续下压不转点动。
|
||||
1分钟无复位帧返回则转异常状态(下降/点动有位移时自动刷新超时, 恢复流程不被打断) */
|
||||
if(App.PwRstStartDlyCnt > 0)
|
||||
{ //上电延时2秒: 等电机控制盒自身初始化完成再开始下降(延时期间控制盒发出的
|
||||
//首帧高度帧同步把高度基准就绪), 避免控制盒未就绪时收到下降指令产生状态切换抖动
|
||||
BDC_STOP();
|
||||
App.StopFlag = true;
|
||||
App.DownFlag = false;
|
||||
App.UpFlag = false;
|
||||
App.Status = APP_STATUS_IDLE;
|
||||
}
|
||||
if(App.MotorPara.Current_height <= 722 && App.MotorPara.Current_height >= 720)
|
||||
break;}
|
||||
if(App.MotorPara.RestFlag == true)
|
||||
{ //收到复位帧: 复位流程进行中
|
||||
App.PowerResetFlag = true;
|
||||
if(App.RestStop1mSCnt > 0)
|
||||
{
|
||||
BDC_STOP();//复位停顿: 先停止电机, 让控制盒进入复位流程
|
||||
}
|
||||
else
|
||||
{
|
||||
BDC_DOWN();//停顿结束: 下降完成复位, 收到高度帧后RestFlag清除
|
||||
}
|
||||
App.TD1mSDelayCnt = 60000;//复位进行中, 刷新1分钟超时
|
||||
}
|
||||
else if(App.PowerResetFlag == true)
|
||||
{ //复位完成(收到高度帧, 复位标志清除): 车已在底部, 直接记录零点开始校准
|
||||
App.PowerResetFlag = false;
|
||||
BDC_STOP();
|
||||
App.StopFlag = true;
|
||||
App.DownFlag = false;
|
||||
@@ -1009,20 +1034,57 @@ static void AppLoopHandler(void)
|
||||
App.TD1mSDelayCnt = 1500;
|
||||
App.Status = APP_STATUS_ZERO_MARKING;
|
||||
}
|
||||
else if(App.TD1mSDelayCnt <= 0)
|
||||
{ //1分钟无复位帧返回: 转异常状态(停机待机)
|
||||
BDC_STOP();
|
||||
App.StopFlag = true;
|
||||
App.DownFlag = false;
|
||||
App.UpFlag = false;
|
||||
App.Status = APP_STATUS_IDLE;
|
||||
}
|
||||
else if(App.PwRstStop1mSCnt > 0)
|
||||
{ //停顿: 反弹后或最终确认到底后先停止电机片刻(让控制盒碰撞保护状态稳定)
|
||||
BDC_STOP();
|
||||
}
|
||||
else if(App.PwRstBottomFlag == true)
|
||||
{ //最终确认到底: 和正常到底复位流程一样, 持续下降触发控制盒复位帧
|
||||
//若再次触发碰撞保护(高度反升), 1ms例程会重新停1秒转点动
|
||||
BDC_DOWN();
|
||||
}
|
||||
else if(App.PwRstInchMode == true)
|
||||
{ //点动下降(发生反弹后, 确认到底前): 模拟手按节奏(每1000ms降200ms停800ms),
|
||||
//一点点往下挪, 冲击小不触发碰撞保护
|
||||
if(App.PwRstInch1mSCnt < 200)
|
||||
{
|
||||
BDC_DOWN();
|
||||
}
|
||||
else
|
||||
{
|
||||
BDC_STOP();
|
||||
if(App.PwRstInch1mSCnt >= 1000)
|
||||
{
|
||||
App.PwRstInch1mSCnt = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{ //下降中(未触发过反弹): 到底检测在App1mSRoutine(真实1ms)
|
||||
BDC_DOWN();//一直下降, 直到确认到底
|
||||
}
|
||||
break;}
|
||||
|
||||
case APP_STATUS_ZERO_MARKING:{
|
||||
case APP_STATUS_ZERO_MARKING:{//上电复位完成后直接进入此状态记录零点(起步动作已去掉)
|
||||
if(App.TD1mSDelayCnt <= 0)
|
||||
{
|
||||
App.ADTrack.LeftUp_Org_AdZero = App.LeftUpCS1237_TrendArray[0];
|
||||
App.ADTrack.LeftLow_Org_AdZero = App.LeftLowCS1237_TrendArray[0];
|
||||
App.ADTrack.RightUp_Org_AdZero = App.RightUpCS1237_TrendArray[0];
|
||||
App.ADTrack.RightLow_Org_AdZero = App.RightLowCS1237_TrendArray[0];
|
||||
DBG_LOG("Frist Pack Data LeftUp Zero AD: %08d\tLeftUp Zero AD: %08d\tRightUp Zero AD: %08d\tRightLow Zero AD: %08d\r\n",
|
||||
App.ADTrack.LeftUp_Org_AdZero,
|
||||
App.ADTrack.LeftLow_Org_AdZero,
|
||||
App.ADTrack.RightUp_Org_AdZero,
|
||||
App.ADTrack.RightLow_Org_AdZero);
|
||||
// DBG_LOG("Frist Pack Data LeftUp Zero AD: %08d\tLeftUp Zero AD: %08d\tRightUp Zero AD: %08d\tRightLow Zero AD: %08d\r\n",
|
||||
// App.ADTrack.LeftUp_Org_AdZero,
|
||||
// App.ADTrack.LeftLow_Org_AdZero,
|
||||
// App.ADTrack.RightUp_Org_AdZero,
|
||||
// App.ADTrack.RightLow_Org_AdZero);
|
||||
App.Status = APP_STATUS_WAIT_MOTOR_CALI_UP;
|
||||
App.MotorPara.InitialFlag = true;
|
||||
App.MotorPara.CaliNum = 0;
|
||||
@@ -1036,7 +1098,7 @@ static void AppLoopHandler(void)
|
||||
break;}
|
||||
|
||||
case APP_STATUS_WAIT_MOTOR_CALI_UP:{
|
||||
if(App.MotorPara.Current_height >= 1200 && App.CailUp1mSCnt >= 17000)
|
||||
if(App.MotorPara.Current_height >= 1430 && App.CailUp1mSCnt >= 17000)
|
||||
{
|
||||
App.CailUp1mSCnt = 0;
|
||||
BDC_STOP();
|
||||
@@ -1049,7 +1111,7 @@ static void AppLoopHandler(void)
|
||||
App.Status = APP_STATUS_WAIT_MOTOR_CALI_DOWN;
|
||||
BDC_DOWN();
|
||||
}
|
||||
else if(App.MotorPara.CaliNum >= 480 && App.MotorPara.LoopOne == true)
|
||||
else if(App.MotorPara.CaliNum >= 410 && App.MotorPara.LoopOne == true)
|
||||
{
|
||||
BDC_STOP();
|
||||
App.StopFlag = true;
|
||||
@@ -1058,14 +1120,14 @@ static void AppLoopHandler(void)
|
||||
App.MotorPara.LoopOne = false;
|
||||
App.MotorPara.InitialFlag = false;
|
||||
App.MotorPara.CaliFlag = true;
|
||||
DBG_LOG("===================LU Data monitoring====================\r\n");
|
||||
weightedMovingAverageWithEnhance(App.MotorPara.LU_HeightStress,480,7,380,480,4,0);
|
||||
DBG_LOG("===================LL Data monitoring====================\r\n");
|
||||
weightedMovingAverageWithEnhance(App.MotorPara.LL_HeightStress,480,7,380,480,4,0);
|
||||
DBG_LOG("===================RU Data monitoring====================\r\n");
|
||||
weightedMovingAverageWithEnhance(App.MotorPara.RU_HeightStress,480,7,380,480,4,0);
|
||||
DBG_LOG("===================RL Data monitoring====================\r\n");
|
||||
weightedMovingAverageWithEnhance(App.MotorPara.RL_HeightStress,480,7,380,480,4,0);
|
||||
// DBG_LOG("===================LU Data monitoring====================\r\n");
|
||||
weightedMovingAverageWithEnhance(App.MotorPara.LU_HeightStress,431,7,341,430,4,0);
|
||||
// DBG_LOG("===================LL Data monitoring====================\r\n");
|
||||
weightedMovingAverageWithEnhance(App.MotorPara.LL_HeightStress,431,7,341,430,4,0);
|
||||
// DBG_LOG("===================RU Data monitoring====================\r\n");
|
||||
weightedMovingAverageWithEnhance(App.MotorPara.RU_HeightStress,431,7,341,430,4,0);
|
||||
// DBG_LOG("===================RL Data monitoring====================\r\n");
|
||||
weightedMovingAverageWithEnhance(App.MotorPara.RL_HeightStress,431,7,341,430,4,0);
|
||||
DBG_LOG("Motor Cali Ok\r\n");
|
||||
App.TD1mSDelayCnt = 1000;
|
||||
App.Status = APP_STATUS_WAIT_STEADY;
|
||||
@@ -1073,7 +1135,7 @@ static void AppLoopHandler(void)
|
||||
break;}
|
||||
|
||||
case APP_STATUS_WAIT_MOTOR_CALI_DOWN:{
|
||||
if(App.MotorPara.Current_height <= 725)
|
||||
if(App.MotorPara.Current_height <= 1005)
|
||||
{
|
||||
BDC_STOP();
|
||||
App.StopFlag = true;
|
||||
@@ -1087,7 +1149,7 @@ static void AppLoopHandler(void)
|
||||
BDC_UP();
|
||||
App.CailUp1mSCnt = 0;
|
||||
}
|
||||
else if(App.MotorPara.CaliNum >= 480 && App.MotorPara.LoopOne == true)
|
||||
else if(App.MotorPara.CaliNum >= 410 && App.MotorPara.LoopOne == true)
|
||||
{
|
||||
BDC_STOP();
|
||||
App.StopFlag = true;
|
||||
@@ -1096,14 +1158,14 @@ static void AppLoopHandler(void)
|
||||
App.MotorPara.LoopOne = false;
|
||||
App.MotorPara.InitialFlag = false;
|
||||
App.MotorPara.CaliFlag = true;
|
||||
DBG_LOG("===================LU Data monitoring====================\r\n");
|
||||
weightedMovingAverageWithEnhance(App.MotorPara.LU_HeightStress,480,7,380,480,4,0);
|
||||
DBG_LOG("===================LL Data monitoring====================\r\n");
|
||||
weightedMovingAverageWithEnhance(App.MotorPara.LL_HeightStress,480,7,380,480,4,0);
|
||||
DBG_LOG("===================RU Data monitoring====================\r\n");
|
||||
weightedMovingAverageWithEnhance(App.MotorPara.RU_HeightStress,480,7,380,480,4,0);
|
||||
DBG_LOG("===================RL Data monitoring====================\r\n");
|
||||
weightedMovingAverageWithEnhance(App.MotorPara.RL_HeightStress,480,7,380,480,4,0);
|
||||
//DBG_LOG("===================LU Data monitoring====================\r\n");
|
||||
weightedMovingAverageWithEnhance(App.MotorPara.LU_HeightStress,431,7,341,430,4,0);
|
||||
// DBG_LOG("===================LL Data monitoring====================\r\n");
|
||||
weightedMovingAverageWithEnhance(App.MotorPara.LL_HeightStress,431,7,341,430,4,0);
|
||||
// DBG_LOG("===================RU Data monitoring====================\r\n");
|
||||
weightedMovingAverageWithEnhance(App.MotorPara.RU_HeightStress,431,7,341,430,4,0);
|
||||
// DBG_LOG("===================RL Data monitoring====================\r\n");
|
||||
weightedMovingAverageWithEnhance(App.MotorPara.RL_HeightStress,431,7,341,430,4,0);
|
||||
DBG_LOG("Motor Cali Ok\r\n");
|
||||
App.TD1mSDelayCnt = 1000;
|
||||
App.Status = APP_STATUS_WAIT_STEADY;
|
||||
@@ -1132,7 +1194,26 @@ static void AppLoopHandler(void)
|
||||
break;}
|
||||
|
||||
case APP_STATUS_HEIGHT_CONTROL:{
|
||||
if(App.MotorPara.Current_height <= 725
|
||||
if(App.MotorPara.OverheatFlag == true)
|
||||
{
|
||||
if(App.MotorPara.Current_height <= 1005)
|
||||
{
|
||||
BDC_DOWN();//过热+低位: 继续下降触发控制盒复位(SupportControlHandle在<=1005时不执行BDC_DOWN)
|
||||
}
|
||||
//过热+高位(>1005): 由SupportControlHandle根据传感器正常判断下降
|
||||
}
|
||||
else if(App.MotorPara.RestFlag == true)
|
||||
{
|
||||
if(App.RestStop1mSCnt > 0)
|
||||
{
|
||||
BDC_STOP();//复位停顿: 先停止电机, 让控制盒进入复位流程
|
||||
}
|
||||
else
|
||||
{
|
||||
BDC_DOWN();//停顿结束: 再次下降, 触发控制盒完成复位(收到高度帧后RestFlag清除)
|
||||
}
|
||||
}
|
||||
else if(App.MotorPara.Current_height <= 1005
|
||||
&& App.MotorPara.RestFlag == false
|
||||
&& App.HeightContRolCnt >= 500
|
||||
&& GET_BIT0_DOUT() == 1
|
||||
@@ -1143,7 +1224,7 @@ static void AppLoopHandler(void)
|
||||
Ddl_Delay1ms(500);
|
||||
BDC_STOP();
|
||||
}
|
||||
else if(App.MotorPara.Current_height >= 1195
|
||||
else if(App.MotorPara.Current_height >= 1425
|
||||
&& App.MotorPara.RestFlag == false
|
||||
&& App.HeightContRolCnt >= 500
|
||||
&& GET_BIT0_DOUT() == 1
|
||||
@@ -1167,6 +1248,20 @@ static void App1mSRoutine(void)
|
||||
App.Uart1Delay1mSCnt--;
|
||||
if(App.Uart3RxTimeOut1mSCnt > 0)
|
||||
App.Uart3RxTimeOut1mSCnt--;
|
||||
if(App.RestStop1mSCnt > 0)
|
||||
App.RestStop1mSCnt--;
|
||||
if(App.PwRstStartDlyCnt > 0)
|
||||
App.PwRstStartDlyCnt--;//上电复位开始前延时(等控制盒初始化)
|
||||
if(App.PwRstStop1mSCnt > 0)
|
||||
{
|
||||
App.PwRstStop1mSCnt--;
|
||||
if(App.PwRstStop1mSCnt == 0)
|
||||
{ //停顿结束: 反弹参考点重置为当前高度, 避免停顿中控制盒抬升高度导致恢复下降后立即误判反弹
|
||||
App.PwRstRiseRef = App.MotorPara.Current_height;
|
||||
App.PwRstRiseCandCnt = 0;//清反弹候选(停顿期间残留计时, 防止恢复后快速误确认)
|
||||
App.PwRstRiseCandMax = App.MotorPara.Current_height;
|
||||
}
|
||||
}
|
||||
if(App.StopCollDelay1mSCnt > 0)
|
||||
App.StopCollDelay1mSCnt--;
|
||||
if(App.RunCollDelay1mSCnt > 0)
|
||||
@@ -1179,7 +1274,7 @@ static void App1mSRoutine(void)
|
||||
App.CentCollDelay1mSCnt--;
|
||||
if(App.MotorPara.InitialFlag == true)
|
||||
App.CailUp1mSCnt++;
|
||||
if((App.MotorPara.Current_height < 725 || App.MotorPara.Current_height > 1195))
|
||||
if((App.MotorPara.Current_height < 1005 || App.MotorPara.Current_height > 1425))
|
||||
{
|
||||
App.HeightContRolCnt++;
|
||||
}
|
||||
@@ -1187,6 +1282,177 @@ static void App1mSRoutine(void)
|
||||
{
|
||||
App.HeightContRolCnt = 0;
|
||||
}
|
||||
if(App.Status == APP_STATUS_POWER_RESET && App.PwRstHtSeen == true)
|
||||
{ //上电复位高度采样: 每秒记录一次当前高度(覆盖停顿/点动/复位全程), 打印完整下降曲线,
|
||||
//直观展示控制盒上报高度的变化趋势, 用于排查反弹是物理现象还是逻辑误判
|
||||
if(++App.PwRstSamp1mSCnt >= 1000)
|
||||
{
|
||||
App.PwRstSamp1mSCnt = 0;
|
||||
Uart3ErrLog_PushBottom(8, (uint16_t)App.MotorPara.Current_height);
|
||||
}
|
||||
}
|
||||
if(App.Status == APP_STATUS_POWER_RESET
|
||||
&& App.MotorPara.RestFlag == false //复位进行中不检测
|
||||
&& App.PowerResetFlag == false //复位完成不检测
|
||||
&& App.PwRstStop1mSCnt == 0 //停顿中不检测
|
||||
&& App.PwRstStartDlyCnt == 0 //上电延时中不检测(车静止高度不变, 会误判堵转到底)
|
||||
&& App.PwRstHtSeen == true) //未收到首帧有效高度不检测(高度基准未就绪)
|
||||
{ //上电复位下降中: 到底检测(真实1ms计时, 主循环频率不定不能在此计数)
|
||||
//控制盒换新后缓存高度偏大(1000+), 到995本该减速仍全速下降, 硬触底产生震荡,
|
||||
//控制盒碰撞保护主动控制电机反向。策略: 首次反弹(高度较参考点反升>1cm)只停1秒
|
||||
//恢复下降观察(常规到底接触的小反弹会自行稳定, 接着2秒堵转确认走正常流程),
|
||||
//再次反弹才判定硬触底震荡碰撞转点动下降(模拟手按, 约1秒一次短脉冲), 连续2个
|
||||
//点动周期无位移判定到底, 之后和正常到底复位流程一样: 停1秒→下降触发复位帧
|
||||
//→停2s→下降→收到高度帧复位完成。到底确认时清反弹计数, 确认后下压的反弹同样
|
||||
//只停1秒继续下压, 不会转点动
|
||||
//未反弹时堵转判定为高度2秒无变化(碰撞悬停时高度会冻结1~2秒, 尽量避开误判)
|
||||
//下降/点动有位移时刷新上电复位1分钟超时, 恢复流程不因总时长过长被停机
|
||||
//历史最低高度参考: 确认到底必须接近最低点, 停在高处=被障碍物/碰撞保护托住, 转点动试探
|
||||
if(App.MotorPara.Current_height < App.PwRstMinHeight)
|
||||
{ //记录本次复位下降过程的历史最低高度(到底只可能是最低点)
|
||||
App.PwRstMinHeight = App.MotorPara.Current_height;
|
||||
}
|
||||
if(App.MotorPara.Current_height > App.PwRstRiseRef + 10)
|
||||
{ //高度较参考点反升>1cm: 碰撞反弹候选(300ms持续确认, 滤除瞬时抖动毛刺)
|
||||
//启动/急停时机械抖动造成的高度毛刺只持续1~2帧, 直接判定会把正常高度误判为反弹
|
||||
//参考点只跟跌不跟涨, 高度帧逐帧上升可跨帧累计检出, 不受帧率影响
|
||||
App.PwRstNoChg1mSCnt = 0;
|
||||
if(App.PwRstRiseCandCnt == 0)
|
||||
{
|
||||
App.PwRstRiseCandMax = App.MotorPara.Current_height;//新候选起点: 重置最高点
|
||||
}
|
||||
if(App.MotorPara.Current_height > App.PwRstRiseCandMax)
|
||||
{
|
||||
App.PwRstRiseCandMax = App.MotorPara.Current_height;//跟踪候选期间最高点
|
||||
}
|
||||
if(App.PwRstRiseCandCnt < 300)
|
||||
{
|
||||
App.PwRstRiseCandCnt++;//候选持续计时(封顶300ms)
|
||||
}
|
||||
if(App.PwRstRiseCandCnt >= 300
|
||||
&& App.MotorPara.Current_height >= App.PwRstRiseCandMax - 2)
|
||||
{ //反升持续300ms且高度未回落(仍接近候选期最高点): 确认真实反弹(控制盒碰撞保护反向)
|
||||
App.PwRstRiseCandCnt = 0;
|
||||
App.PwRstLastHeight = App.MotorPara.Current_height;
|
||||
App.PwRstRiseRef = App.MotorPara.Current_height;//参考点重置, 停顿结束恢复下降后重新判定
|
||||
App.PwRstStop1mSCnt = 1000;//先停1秒, 等控制盒碰撞保护状态稳定
|
||||
if(App.PwRstInchMode == true)
|
||||
{ //点动中再反弹: 重置点动周期, 停1秒后继续点动
|
||||
App.PwRstInchLastHeight = App.MotorPara.Current_height;//点动周期起点高度
|
||||
App.PwRstInchNoMvCnt = 0;
|
||||
Uart3ErrLog_PushBottom(5, (uint16_t)App.MotorPara.Current_height);//打印反弹判定事件
|
||||
}
|
||||
else if(App.PwRstReboundCnt == 0)
|
||||
{ //首次反弹: 常规到底接触的小反弹, 停1秒恢复下降观察, 不转点动
|
||||
App.PwRstReboundCnt = 1;
|
||||
Uart3ErrLog_PushBottom(7, (uint16_t)App.MotorPara.Current_height);//打印首次反弹观察事件
|
||||
}
|
||||
else
|
||||
{ //再次反弹: 确认硬触底震荡碰撞, 转点动模式(作废之前的到底确认重新确认)
|
||||
App.PwRstReboundCnt = 0;
|
||||
App.PwRstInchMode = true;//之后一律点动下降
|
||||
App.PwRstBottomFlag = false;//之前确认的到底作废, 重新点动确认
|
||||
App.PwRstInchLastHeight = App.MotorPara.Current_height;//点动周期起点高度
|
||||
App.PwRstInchNoMvCnt = 0;
|
||||
Uart3ErrLog_PushBottom(5, (uint16_t)App.MotorPara.Current_height);//打印反弹判定事件
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(App.PwRstRiseCandCnt > 0)
|
||||
{ //反升未持续300ms(瞬时毛刺/急停抖动回归): 取消候选, 参考点重置为当前高度
|
||||
//(低毛刺帧已把参考点拉低, 不重置的话回归后的正常高度会反复进入候选)
|
||||
App.PwRstRiseCandCnt = 0;
|
||||
App.PwRstRiseCandMax = App.MotorPara.Current_height;
|
||||
App.PwRstRiseRef = App.MotorPara.Current_height;
|
||||
}
|
||||
if(App.PwRstBottomFlag == true)
|
||||
{ //到底已确认: 不再做到底检测, 持续下降直到收到复位帧(否则会反复触发堵转停顿)
|
||||
App.PwRstNoChg1mSCnt = 0;
|
||||
App.PwRstLastHeight = App.MotorPara.Current_height;
|
||||
}
|
||||
else if(App.PwRstInchMode == true)
|
||||
{ //点动模式: 每个点动周期(1s)末尾比较该周期是否移动, 连续2周期无位移判定到底
|
||||
if(App.PwRstInch1mSCnt == 999)
|
||||
{
|
||||
if(App.MotorPara.Current_height == App.PwRstInchLastHeight)
|
||||
{
|
||||
if(++App.PwRstInchNoMvCnt >= 2)
|
||||
{
|
||||
if(App.MotorPara.Current_height > App.PwRstMinHeight + 5)
|
||||
{ //点动无位移但停在高于历史最低点: 被障碍物/碰撞保护托住, 不是到底, 继续点动试探
|
||||
App.PwRstInchNoMvCnt = 0;
|
||||
}
|
||||
else
|
||||
{ //连续2个点动周期无位移且接近历史最低点: 确认到底, 之后走正常到底复位流程
|
||||
App.PwRstBottomFlag = true;
|
||||
App.PwRstReboundCnt = 0;//到底已确认, 清反弹计数(后续下压反弹只停1秒继续压)
|
||||
App.PwRstInchNoMvCnt = 0;
|
||||
App.PwRstStop1mSCnt = 1000;//停1秒后下降触发复位
|
||||
Uart3ErrLog_PushBottom(4, (uint16_t)App.MotorPara.Current_height);//打印到底确认事件
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
App.PwRstInchNoMvCnt = 0;
|
||||
App.PwRstInchLastHeight = App.MotorPara.Current_height;
|
||||
App.TD1mSDelayCnt = 60000;//点动脉冲有位移: 刷新上电复位超时
|
||||
}
|
||||
}
|
||||
if(App.MotorPara.Current_height <= App.PwRstRiseRef)
|
||||
{
|
||||
App.PwRstRiseRef = App.MotorPara.Current_height;//点动脉冲下降时参考点跟随(只跟跌不跟涨)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(App.MotorPara.Current_height <= App.PwRstRiseRef)
|
||||
{
|
||||
App.PwRstRiseRef = App.MotorPara.Current_height;//下降/持平: 参考点跟随(只跟跌不跟涨)
|
||||
}
|
||||
if(App.MotorPara.Current_height != App.PwRstLastHeight)
|
||||
{ //高度变化: 电机已响应下降指令, 标记已位移(此后高度稳定才可能是堵转到底)
|
||||
App.PwRstMovedFlag = true;
|
||||
App.PwRstNoChg1mSCnt = 0;
|
||||
App.PwRstLastHeight = App.MotorPara.Current_height;
|
||||
App.TD1mSDelayCnt = 60000;//高度在变(下降/反弹中): 刷新上电复位超时
|
||||
}
|
||||
else if(App.PwRstMovedFlag == true)
|
||||
{ //高度稳定且已发生过位移: 才允许堵转到底判定
|
||||
if(++App.PwRstNoChg1mSCnt >= 2000)
|
||||
{
|
||||
if(App.MotorPara.Current_height > App.PwRstMinHeight + 5)
|
||||
{ //高度2秒无变化但停在高于历史最低点: 碰撞后控制盒把车托在障碍物上, 不是到底,
|
||||
//转点动模式一点点试探下行
|
||||
App.PwRstReboundCnt = 0;
|
||||
App.PwRstInchMode = true;
|
||||
App.PwRstInchLastHeight = App.MotorPara.Current_height;//点动周期起点高度
|
||||
App.PwRstInchNoMvCnt = 0;
|
||||
App.PwRstNoChg1mSCnt = 0;
|
||||
App.PwRstStop1mSCnt = 1000;//先停1秒再开始点动
|
||||
Uart3ErrLog_PushBottom(5, (uint16_t)App.MotorPara.Current_height);//打印碰撞托住转点动事件
|
||||
}
|
||||
else
|
||||
{ //2秒无高度变化且接近历史最低点: 确认到底(未触发过反弹时的堵转判定)
|
||||
App.PwRstBottomFlag = true;
|
||||
App.PwRstReboundCnt = 0;//到底已确认, 清反弹计数(后续下压反弹只停1秒继续压)
|
||||
App.PwRstNoChg1mSCnt = 0;
|
||||
App.PwRstStop1mSCnt = 1000;//停1秒后下降触发复位
|
||||
Uart3ErrLog_PushBottom(4, (uint16_t)App.MotorPara.Current_height);//打印到底确认事件
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{ //高度稳定但电机从未响应(上电延时后控制盒软启动中): 不累积堵转计时
|
||||
App.PwRstNoChg1mSCnt = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(App.PwRstInch1mSCnt < 1000)
|
||||
App.PwRstInch1mSCnt++;
|
||||
App.FeedDogDlyCnt++;
|
||||
}
|
||||
void FeedDogHandler(void)
|
||||
@@ -1206,6 +1472,7 @@ int main(void)
|
||||
FeedDogHandler();
|
||||
#endif
|
||||
DebugLoopHandler();
|
||||
Uart3ErrLogLoopHandler(); //打印控制盒报错→复位→恢复事件时间线
|
||||
#if(USE_CS1237_LEFTUP == 1)
|
||||
LEFTUP_CS1237DataLoopCollect();
|
||||
#endif
|
||||
@@ -1301,31 +1568,80 @@ void Usart3RxIrqCallback(void)
|
||||
{
|
||||
if(App.RxUart3Data.RxBuff[0] == 0x01 && App.RxUart3Data.RxBuff[1] == 0x04)
|
||||
{
|
||||
uint8_t firstErr = (App.MotorPara.RestFlag == false) ? 0 : 1; //0:首次信息帧 1:复位中回应
|
||||
App.MotorPara.RestFlag = true;
|
||||
App.MotorPara.OverheatFlag = false;//收到复位帧, 过热状态解除
|
||||
if(firstErr == 0)
|
||||
{
|
||||
App.RestStop1mSCnt = 2000;//首次收到复位帧: 启动停顿计时, 先停止电机让控制盒进入复位流程, 计时结束再下降触发复位
|
||||
}
|
||||
Uart3ErrLog_Push(firstErr, App.RxUart3Data.RxBuff, 0);//打印复位帧事件(0:首次触发 1:复位中回应)
|
||||
}
|
||||
else if(App.RxUart3Data.RxBuff[0] == 0x01 && App.RxUart3Data.RxBuff[1] == 0x01)
|
||||
{
|
||||
App.MotorPara.RestFlag = false;
|
||||
int16_t h = ((App.RxUart3Data.RxBuff[2]<<8) & 0xff00) + (App.RxUart3Data.RxBuff[3] & 0x00ff);
|
||||
if(h >=720 && h <= 1208)
|
||||
if(App.MotorPara.RestFlag == true)
|
||||
{
|
||||
Uart3ErrLog_Push(2, App.RxUart3Data.RxBuff, (uint16_t)h);//打印复位完成事件(收到高度帧)
|
||||
}
|
||||
App.MotorPara.RestFlag = false;
|
||||
App.MotorPara.OverheatFlag = false;//收到高度帧, 确认复位完成
|
||||
if(h >= 990 && h <= 1430)
|
||||
{
|
||||
App.MotorPara.Current_height = h;
|
||||
if(App.Status == APP_STATUS_POWER_RESET && App.PwRstHtSeen == false)
|
||||
{ //上电复位中首次收到有效高度帧: 高度基准就绪, 以首帧高度初始化到底检测参考值
|
||||
//(此前Current_height为0, 若用入口时的0做参考, 首帧会被误判为碰撞反弹)
|
||||
App.PwRstHtSeen = true;
|
||||
App.PwRstLastHeight = h;
|
||||
App.PwRstRiseRef = h;
|
||||
App.PwRstMinHeight = h;
|
||||
}
|
||||
if(App.MotorPara.InitialFlag == true && h >=720 && h <= 1200)
|
||||
}
|
||||
if(App.MotorPara.InitialFlag == true && h >= 1000 && h <= 1430)
|
||||
{//缓存每个高度点对于零点应力的差值,对不同高度点的应力进行补偿
|
||||
if(App.MotorPara.LU_HeightStress[(App.MotorPara.Current_height)-720] == 0
|
||||
|| App.MotorPara.LL_HeightStress[(App.MotorPara.Current_height)-720] == 0
|
||||
|| App.MotorPara.RU_HeightStress[(App.MotorPara.Current_height)-720] == 0
|
||||
|| App.MotorPara.RL_HeightStress[(App.MotorPara.Current_height)-720] == 0)
|
||||
if(App.MotorPara.LU_HeightStress[HEIGHT_TO_IDX(App.MotorPara.Current_height)] == 0
|
||||
|| App.MotorPara.LL_HeightStress[HEIGHT_TO_IDX(App.MotorPara.Current_height)] == 0
|
||||
|| App.MotorPara.RU_HeightStress[HEIGHT_TO_IDX(App.MotorPara.Current_height)] == 0
|
||||
|| App.MotorPara.RL_HeightStress[HEIGHT_TO_IDX(App.MotorPara.Current_height)] == 0)
|
||||
{
|
||||
App.MotorPara.CaliNum++;
|
||||
}
|
||||
App.MotorPara.LU_HeightStress[(App.MotorPara.Current_height)-720] = App.ADTrack.LeftUp_Org_AdZero - App.LeftUpCS1237_TrendArray[0];
|
||||
App.MotorPara.LL_HeightStress[(App.MotorPara.Current_height)-720] = App.ADTrack.LeftLow_Org_AdZero - App.LeftLowCS1237_TrendArray[0];
|
||||
App.MotorPara.RU_HeightStress[(App.MotorPara.Current_height)-720] = App.ADTrack.RightUp_Org_AdZero - App.RightUpCS1237_TrendArray[0];
|
||||
App.MotorPara.RL_HeightStress[(App.MotorPara.Current_height)-720] = App.ADTrack.RightLow_Org_AdZero - App.RightLowCS1237_TrendArray[0];
|
||||
App.MotorPara.LU_HeightStress[HEIGHT_TO_IDX(App.MotorPara.Current_height)] = App.ADTrack.LeftUp_Org_AdZero - App.LeftUpCS1237_TrendArray[0];
|
||||
App.MotorPara.LL_HeightStress[HEIGHT_TO_IDX(App.MotorPara.Current_height)] = App.ADTrack.LeftLow_Org_AdZero - App.LeftLowCS1237_TrendArray[0];
|
||||
App.MotorPara.RU_HeightStress[HEIGHT_TO_IDX(App.MotorPara.Current_height)] = App.ADTrack.RightUp_Org_AdZero - App.RightUpCS1237_TrendArray[0];
|
||||
App.MotorPara.RL_HeightStress[HEIGHT_TO_IDX(App.MotorPara.Current_height)] = App.ADTrack.RightLow_Org_AdZero - App.RightLowCS1237_TrendArray[0];
|
||||
}
|
||||
}
|
||||
else
|
||||
{ //未知帧(帧头非01 04/01 01): 过热等其它报错可能是任意组合, 全部记录供分析
|
||||
/* 报错帧(01 02 xx xx): 置OverheatFlag, HEIGHT_CONTROL跳过限位纠偏, 由SupportControlHandle判断下降触发控制盒复位
|
||||
已知报错帧: 01 02 00 10(过热) 01 02 40 00(E07) 01 02 00 08(E12) 01 02 02 00(E02) */
|
||||
if(App.RxUart3Data.RxBuff[0] == 0x01 && App.RxUart3Data.RxBuff[1] == 0x02)
|
||||
{
|
||||
uint16_t errCode = ((uint16_t)App.RxUart3Data.RxBuff[2] << 8) | App.RxUart3Data.RxBuff[3];
|
||||
App.MotorPara.OverheatFlag = true;
|
||||
if(App.Status == APP_STATUS_POWER_RESET && App.MotorPara.RestFlag == false
|
||||
&& (App.PwRstErrValid == false || App.PwRstErrCode != errCode))
|
||||
{ //上电复位中收到报错帧: 退出点动流程, 置到底标志关掉到底检测, 先停1秒再
|
||||
//长按下降(持续下降)等复位帧。同一报错码连发只处理一次(沿触发): 控制盒报错
|
||||
//状态会持续广播报错帧, 若每帧都重启1秒停顿则停顿被无限续期, 长按下降永远
|
||||
//无法执行, 复位帧永远等不到; 不同报错码视为新报错重新停顿一次
|
||||
App.PwRstErrValid = true;
|
||||
App.PwRstErrCode = errCode;
|
||||
App.PwRstInchMode = false;
|
||||
App.PwRstBottomFlag = true;
|
||||
App.PwRstInch1mSCnt = 0;
|
||||
App.PwRstInchNoMvCnt = 0;
|
||||
App.PwRstNoChg1mSCnt = 0;
|
||||
App.PwRstStop1mSCnt = 1000;//先停1秒再继续下降触发复位
|
||||
App.PwRstLastHeight = App.MotorPara.Current_height;
|
||||
App.PwRstRiseRef = App.MotorPara.Current_height;//参考点重置, 长按下降中再反弹仍可检出
|
||||
App.PwRstReboundCnt = 0;//清反弹计数, 长按下降中反弹只停1秒继续压不转点动
|
||||
}
|
||||
}
|
||||
Uart3ErrLog_Push(3, App.RxUart3Data.RxBuff, 0);//打印未知帧事件(过热帧01 02 00 10, E07帧01 02 40 00等)
|
||||
}
|
||||
memset(App.RxUart3Data.RxBuff, 0, sizeof(App.RxUart3Data.RxBuff));
|
||||
App.RxUart3Data.RxLen = 0;
|
||||
App.Uart3RxTimeOut1mSCnt = 0;
|
||||
|
||||
Reference in New Issue
Block a user