|
@@ -411,6 +411,16 @@ static u32 _bms_main_task_handler(void){
|
|
|
extern void show_leds_for_charging(uint8_t charging);
|
|
extern void show_leds_for_charging(uint8_t charging);
|
|
|
static debounce_t _charging_detect = {.count = 0, .max_count = 10, .init_count = 0};
|
|
static debounce_t _charging_detect = {.count = 0, .max_count = 10, .init_count = 0};
|
|
|
static void check_charging(){
|
|
static void check_charging(){
|
|
|
|
|
+ /* 解决cs1180可能出错,导致误判充电,离仓后无法休眠 */
|
|
|
|
|
+ if (measure_value()->load_current >= MIN_START_CHARGER_CURRENT) {
|
|
|
|
|
+ if (measure_value()->load_current != measure_value()->current_5238) {
|
|
|
|
|
+ if (measure_value()->current_5238 < 0.0f) { //cs1180检测到充电电流,5238检测到负电流
|
|
|
|
|
+ if (!io_state()->hall_detect) {
|
|
|
|
|
+ measure_value()->load_current = measure_value()->current_5238;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
if ((measure_value()->load_current >= MIN_START_CHARGER_CURRENT)) {
|
|
if ((measure_value()->load_current >= MIN_START_CHARGER_CURRENT)) {
|
|
|
if (!_bms_state.charging) {
|
|
if (!_bms_state.charging) {
|
|
|
debounce_inc(_charging_detect);
|
|
debounce_inc(_charging_detect);
|