|
|
@@ -31,6 +31,12 @@ void CC_CV_UpdateChargingState(uint8_t slot_id) {
|
|
|
uint8_t *previous_count= &battery->previous_cycle_number;
|
|
|
battery->battery_charging_state= charging_state;
|
|
|
|
|
|
+ //Validate if the battery state is empty or battery limit received is false then:
|
|
|
+ if(battery_data[slot_id].battery_state == STATE_EMPTY || battery_data[slot_id].batteryLimitReceived==0){
|
|
|
+ battery->battery_charging_state= STATE_IDLE;
|
|
|
+ cv_charging_started= false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
//Added condition to support the edge case when the voltage drops unexpectedly to 0 during the cycle making the relays to clear
|
|
|
if(batt_voltage== 0){
|
|
|
@@ -43,13 +49,6 @@ void CC_CV_UpdateChargingState(uint8_t slot_id) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- if(battery_data[slot_id].battery_state == STATE_EMPTY || battery_data[slot_id].batteryLimitReceived==0){
|
|
|
- battery->battery_charging_state= STATE_IDLE;
|
|
|
- cv_charging_started= false;
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
// Once the battery limits are received then start with the charging
|
|
|
if(battery_data[slot_id].batteryLimitReceived == 1){
|
|
|
printf("Battery Limit %d received for Slot ID %d\n", battery_data[slot_id].batteryLimitReceived, slot_id);
|