Skip to content

Commit

Permalink
Add battery balancing indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
7134956 committed Jan 13, 2016
1 parent 984aa0e commit 0d23e8a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
9 changes: 7 additions & 2 deletions main/src/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ void drawBat(void) {
uint16_t vMin = 9999;
uint8_t value;
//FIXME
BMS.ActiveShunt = 342131;
BMSinfo.batNum = 24;
BMSinfo.v[0] = 3252;
BMSinfo.v[1] = 3296;
Expand Down Expand Up @@ -666,8 +667,12 @@ void drawBat(void) {
u8g_DrawStr(&u8g, hStart + 140, vStart - 2, sTemp);
for (i = 0; i < BMSinfo.batNum; i++) {
value = vStep * (BMSinfo.v[i] - vMin) / (vMax - vMin);
u8g_DrawBox(&u8g, hStart + hStep * i, vStart + vStep - value, hStep - 1,
value + 1);
if (VB(BMS.ActiveShunt, i)) //Если элемент шунтирован
u8g_DrawFrame(&u8g, hStart + hStep * i, vStart + vStep - value,
hStep - 1, value + 1);
else
u8g_DrawBox(&u8g, hStart + hStep * i, vStart + vStep - value,
hStep - 1, value + 1);
if (i < 9) {
sprintf(sTemp, "%d", i + 1);
u8g_DrawStr(&u8g, hStart + hStep * i, vStart + vStep + 16, sTemp);
Expand Down
2 changes: 1 addition & 1 deletion main/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ mtk_select_t mtkLangList;
*В вечном цыкле проверяем были ли нажаты кнопки, вызываем обраболку нажатий,
*проверяем не изменился ли режим работы, обрабатываем состояние и спим.
******************************************************************************/
int main(void) {
int main() {
#ifdef SYSTEM_WIN
uint8_t i;
for (i = 0; i < 6; i++) {
Expand Down
1 change: 1 addition & 0 deletions main/src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ typedef struct BMS_t { //информация BMS
uint32_t voltage; //Напряжение батареи в милливольтах
uint32_t capacity; //Остаток заряда в миллиамер часах
int32_t current; //Ток батареи в миллиамерах
uint32_t ActiveShunt; //Активные шунты балансировки
} BMS_t;

#endif /* _MAIN_H_ */

0 comments on commit 0d23e8a

Please sign in to comment.