|
|
@@ -4,6 +4,7 @@
|
|
|
#include "app_rs485_1.h"
|
|
|
#include "app.h"
|
|
|
#include "app_end_ctr.h"
|
|
|
+#include "shark_xl.h"
|
|
|
|
|
|
CHECK_CHARGER check_charger;
|
|
|
DELAY_COMMON side_stay_dec_delay;
|
|
|
@@ -31,10 +32,6 @@ static u16 shark_bms_acc2_error_times;
|
|
|
static u16 shark_bms_acc2_work_times;
|
|
|
|
|
|
u32 shark_bms_acc2_oc_times;
|
|
|
-u16 shark_bms_xl_times;
|
|
|
-u16 shark_bms_xl_max;
|
|
|
-u16 shark_bms_xl_count;
|
|
|
-u8 shark_bms_xl_skip;
|
|
|
|
|
|
void QD_Enable_From(uint8_t on,uint8_t from)
|
|
|
{
|
|
|
@@ -46,7 +43,7 @@ void QD_Enable_From(uint8_t on,uint8_t from)
|
|
|
println("qd: %d %d", on, from);
|
|
|
|
|
|
if (QD_Dect() == 0) {
|
|
|
- shark_bms_xl_skip = 5;
|
|
|
+ shark_xl_skip = 3;
|
|
|
}
|
|
|
|
|
|
// Check_S11(on,FROM_QD);
|
|
|
@@ -59,36 +56,6 @@ uint8_t ACC2_Is_On(void)
|
|
|
return shark_bms_acc2_enabled;
|
|
|
}
|
|
|
|
|
|
-void shark_bms_xl_tick(void)
|
|
|
-{
|
|
|
- static u8 ticks;
|
|
|
-
|
|
|
- if (ticks < XL_DEC_TIMEOUT) {
|
|
|
- ticks++;
|
|
|
-
|
|
|
- if (XL_Dect() == RESET) {
|
|
|
- shark_bms_xl_count++;
|
|
|
- }
|
|
|
- } else {
|
|
|
- ticks = 0;
|
|
|
-
|
|
|
- if (shark_bms_xl_skip > 0) {
|
|
|
- shark_bms_xl_skip--;
|
|
|
- end_ctr_self_ss_new.xl_sta = 0;
|
|
|
- shark_bms_xl_times = shark_bms_xl_max = 0;
|
|
|
- } else {
|
|
|
- if (shark_bms_xl_max < shark_bms_xl_times) {
|
|
|
- shark_bms_xl_max = shark_bms_xl_times;
|
|
|
- }
|
|
|
-
|
|
|
- shark_bms_xl_times = shark_bms_xl_count;
|
|
|
- end_ctr_self_ss_new.xl_sta = (shark_bms_xl_count > 0);
|
|
|
- }
|
|
|
-
|
|
|
- shark_bms_xl_count = 0;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
void ACC2_PWM(void)
|
|
|
{
|
|
|
#if 0
|
|
|
@@ -186,11 +153,6 @@ void E_CTR_Dec_IRQ_Initial(void)
|
|
|
exti_init(EXTI_0, EXTI_INTERRUPT, EXTI_TRIG_BOTH);
|
|
|
exti_interrupt_flag_clear(EXTI_0);
|
|
|
|
|
|
- //XL
|
|
|
- gpio_exti_source_select(GPIO_PORT_SOURCE_GPIOB, GPIO_PIN_SOURCE_7);
|
|
|
- exti_init(EXTI_7, EXTI_INTERRUPT, EXTI_TRIG_FALLING);
|
|
|
- exti_interrupt_flag_clear(EXTI_7);
|
|
|
-
|
|
|
#if CONFIG_BATT_DET_USE_IRQ
|
|
|
// BAT1 DET
|
|
|
gpio_exti_source_select(GPIO_PORT_SOURCE_GPIOC, GPIO_PIN_SOURCE_2);
|
|
|
@@ -473,10 +435,10 @@ void EXTI5_9_IRQHandler(void)
|
|
|
qd_dec_delay.count = 0;
|
|
|
}
|
|
|
|
|
|
- if (RESET != exti_interrupt_flag_get(EXTI_7))
|
|
|
+ if (RESET != exti_flag_get(EXTI_7))
|
|
|
{
|
|
|
- exti_interrupt_flag_clear(EXTI_7);
|
|
|
- shark_bms_xl_count++;
|
|
|
+ exti_flag_clear(EXTI_7);
|
|
|
+ shark_xl_isr();
|
|
|
}
|
|
|
|
|
|
if (RESET != exti_interrupt_flag_get(EXTI_8))
|