Skip to content

Commit dca3e94

Browse files
committed
Multiple battery voltage stats
1 parent 72aa1bd commit dca3e94

File tree

2 files changed

+96
-7
lines changed

2 files changed

+96
-7
lines changed

src/mainview.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ __myevic__ void ShowMainView()
672672
if ( dfMode != 6 )
673673
{
674674
DrawHLine( 0, 43, 63, 1 );
675-
DrawHLine( 0, 107, 63, 1 );
675+
DrawHLine( 0, 106, 63, 1 );
676676

677677
ShowBattery();
678678

src/screens.c

Lines changed: 95 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -528,9 +528,56 @@ __myevic__ void ShowBattery()
528528
{
529529
if ( dfStatus.battv )
530530
{
531-
uint16_t bv = gFlags.firing ? RTBattVolts : BatteryVoltage;
532-
DrawValueRight( 20, 118, bv, 2, 0x0B, 0 );
533-
DrawImage( 21, 118, 0x7D );
531+
switch (NumBatteries) {
532+
case 1: {
533+
uint16_t bv = gFlags.firing ? RTBattVolts : BatteryVoltage;
534+
DrawValueRight( 20, 118, bv, 2, 0x0B, 0 );
535+
DrawImage( 21, 118, 0x7D );
536+
break;
537+
}
538+
case 2: {
539+
if (!gFlags.battery_charging) {
540+
uint16_t bv = gFlags.firing ? RTBVolts[0] : BattVolts[0];
541+
DrawValueRight( 23, 111, bv, 2, 0x15, 0 );
542+
DrawImage( 24, 117, 0x7D );
543+
uint16_t bv2 = gFlags.firing ? RTBVolts[1] : BattVolts[1];
544+
DrawValueRight( 58, 111, bv2, 2, 0x15, 0 );
545+
DrawImage( 59, 117, 0x7D );
546+
}
547+
break;
548+
}
549+
case 3: {
550+
if (!gFlags.battery_charging) {
551+
uint16_t bv = gFlags.firing ? RTBVolts[0] : BattVolts[0];
552+
DrawValueRight( 20, 109, bv, 2, 0x0B, 0 );
553+
DrawImage( 21, 109, 0x7D );
554+
uint16_t bv2 = gFlags.firing ? RTBVolts[1] : BattVolts[1];
555+
DrawValueRight( 57, 109, bv2, 2, 0x0B, 0 );
556+
DrawImage( 58, 109, 0x7D );
557+
uint16_t bv3 = gFlags.firing ? RTBVolts[2] : BattVolts[2];
558+
DrawValueRight( 39, 120, bv3, 2, 0x0B, 0 );
559+
DrawImage( 40, 120, 0x7D );
560+
}
561+
break;
562+
}
563+
case 4: {
564+
if (!gFlags.battery_charging) {
565+
uint16_t bv = gFlags.firing ? RTBVolts[0] : BattVolts[0];
566+
DrawValueRight( 20, 109, bv, 2, 0x0B, 0 );
567+
DrawImage( 21, 109, 0x7D );
568+
uint16_t bv2 = gFlags.firing ? RTBVolts[1] : BattVolts[1];
569+
DrawValueRight( 57, 109, bv2, 2, 0x0B, 0 );
570+
DrawImage( 58, 109, 0x7D );
571+
uint16_t bv3 = gFlags.firing ? RTBVolts[2] : BattVolts[2];
572+
DrawValueRight( 39, 120, bv3, 2, 0x0B, 0 );
573+
DrawImage( 40, 120, 0x7D );
574+
uint16_t bv4 = gFlags.firing ? RTBVolts[4] : BattVolts[4];
575+
DrawValueRight( 57, 120, bv4, 2, 0x0B, 0 );
576+
DrawImage( 58, 120, 0x7D );
577+
}
578+
break;
579+
}
580+
}
534581
}
535582
else
536583
{
@@ -539,7 +586,7 @@ __myevic__ void ShowBattery()
539586
}
540587
}
541588

542-
if ( gFlags.battery_10pc && !gFlags.battery_charging )
589+
if ( gFlags.battery_10pc && !gFlags.battery_charging && NumBatteries == 1 ) // full battery bar
543590
{
544591
if ( gFlags.draw_battery )
545592
{
@@ -557,14 +604,56 @@ __myevic__ void ShowBattery()
557604
{
558605
if ( dfStatus.battpc )
559606
{
560-
DrawImage( 30, 114, 0xE3 );
607+
if (dfStatus.battv && NumBatteries >= 2) {
608+
switch (NumBatteries) {
609+
case 2: {
610+
uint16_t bv = gFlags.firing ? RTBVolts[0] : BattVolts[0];
611+
DrawValueRight( 23, 111, bv, 2, 0x15, 0 );
612+
DrawImage( 24, 117, 0x7D );
613+
uint16_t bv2 = gFlags.firing ? RTBVolts[1] : BattVolts[1];
614+
DrawValueRight( 58, 111, bv2, 2, 0x15, 0 );
615+
DrawImage( 59, 117, 0x7D );
616+
break;
617+
}
618+
case 3: {
619+
uint16_t bv = gFlags.firing ? RTBVolts[0] : BattVolts[0];
620+
DrawValueRight( 20, 109, bv, 2, 0x0B, 0 );
621+
DrawImage( 21, 109, 0x7D );
622+
uint16_t bv2 = gFlags.firing ? RTBVolts[1] : BattVolts[1];
623+
DrawValueRight( 57, 109, bv2, 2, 0x0B, 0 );
624+
DrawImage( 58, 109, 0x7D );
625+
uint16_t bv3 = gFlags.firing ? RTBVolts[2] : BattVolts[2];
626+
DrawValueRight( 39, 120, bv3, 2, 0x0B, 0 );
627+
DrawImage( 40, 120, 0x7D );
628+
break;
629+
}
630+
case 4: {
631+
uint16_t bv = gFlags.firing ? RTBVolts[0] : BattVolts[0];
632+
DrawValueRight( 20, 109, bv, 2, 0x0B, 0 );
633+
DrawImage( 21, 109, 0x7D );
634+
uint16_t bv2 = gFlags.firing ? RTBVolts[1] : BattVolts[1];
635+
DrawValueRight( 57, 109, bv2, 2, 0x0B, 0 );
636+
DrawImage( 58, 109, 0x7D );
637+
uint16_t bv3 = gFlags.firing ? RTBVolts[2] : BattVolts[2];
638+
DrawValueRight( 39, 120, bv3, 2, 0x0B, 0 );
639+
DrawImage( 40, 120, 0x7D );
640+
uint16_t bv4 = gFlags.firing ? RTBVolts[4] : BattVolts[4];
641+
DrawValueRight( 57, 120, bv4, 2, 0x0B, 0 );
642+
DrawImage( 58, 120, 0x7D );
643+
break;
644+
}
645+
}
646+
}
647+
else {
648+
DrawImage( 30, 114, 0xE3 );
649+
}
561650
}
562651
else
563652
{
564653
DrawImage( 8, 115, 0xC5 );
565654
}
566655
}
567-
else
656+
else if ( NumBatteries == 1 || !dfStatus.battv && NumBatteries > 1 ) // idle show battery bar
568657
{
569658
if ( dfStatus.battpc )
570659
{

0 commit comments

Comments
 (0)