Last active
November 14, 2018 21:09
-
-
Save celeron55/d0251197e0dd132027b4851a25b8c86b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define DISCHARGE_SOFT_LIMIT_LOWEST_A 10 | |
#define DISCHARGE_SOFT_LIMIT_UPPER_CELL_VOLTAGE 3.6 | |
#define DISCHARGE_SOFT_LIMIT_LOWEST_CELL_VOLTAGE 2.9 | |
if(min_cell_v < DISCHARGE_SOFT_LIMIT_UPPER_CELL_VOLTAGE){ | |
float factor = (min_cell_v - DISCHARGE_SOFT_LIMIT_LOWEST_CELL_VOLTAGE) / (DISCHARGE_SOFT_LIMIT_UPPER_CELL_VOLTAGE - DISCHARGE_SOFT_LIMIT_LOWEST_CELL_VOLTAGE); | |
if(factor < 0.0) | |
factor = 0.0; | |
if(factor > 1.0) | |
factor = 1.0; | |
float max_current = factor * (MAX_DISCHARGE_CURRENT_A - DISCHARGE_SOFT_LIMIT_LOWEST_A) + DISCHARGE_SOFT_LIMIT_LOWEST_A; | |
limit_uint16(max_discharge_current_Ax10, max_current * 10); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment