Skip to content

Commit

Permalink
Show Battery Current when Charging by Tunas1337
Browse files Browse the repository at this point in the history
  • Loading branch information
spm81 committed Jan 5, 2024
1 parent 804a1c2 commit ebafb3a
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 3 deletions.
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ ENABLE_FMRADIO := 0
# Restore FM Radio in 1 second after RX
ENABLE_FMRADIO_FAST_RESTORE := 1

#Battery Percentage in Status Bar 296 bytes

#Battery
#Battery Percentage in Status Bar - 296 bytes
ENABLE_STATUS_BATTERY_PERC := 1
#Show Battery Current when Charging by Tunas1337 - 136 bytes
ENABLE_BATTERY_CHARGING := 1


#More LCD Settings
Expand All @@ -36,7 +40,7 @@ ENABLE_MIC_PLUS_GAIN_BAR_TX := 1


#SOS Flashlight 84 bytes
ENABLE_FLASHLIGHT_SOS := 1
ENABLE_FLASHLIGHT_SOS := 0


#UART
Expand All @@ -58,6 +62,8 @@ ENABLE_NOSCANTIMEOUT := 1
ENABLE_KEEPNAMEONSAVE := 1
ENABLE_FASTER_CHANNEL_SCAN := 1



#Roger - To Enable MDC, ROGERBEEP HAS TO BE ENABLED
ENABLE_ROGERBEEP := 0
ENABLE_MDC := 0
Expand Down Expand Up @@ -333,6 +339,10 @@ endif
ifeq ($(ENABLE_CW),1)
CFLAGS += -DENABLE_CW
endif
ifeq ($(ENABLE_BATTERY_CHARGING),1)
CFLAGS += -DENABLE_BATTERY_CHARGING
endif



ifeq ($(DEBUG),1)
Expand Down
6 changes: 6 additions & 0 deletions bitmaps.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ const uint8_t BITMAP_CurrentIndicator[8] = { 0xFF, 0xFF, 0x7E, 0x7E, 0x3C, 0
const uint8_t BITMAP_VFO_Default[8] = { 0x00, 0x7F, 0x7F, 0x3E, 0x3E, 0x1C, 0x1C, 0x08 };
const uint8_t BITMAP_VFO_NotDefault[8] = { 0x00, 0x41, 0x41, 0x22, 0x22, 0x14, 0x14, 0x08 };

#ifdef ENABLE_BATTERY_CHARGING
const uint8_t BITMAP_SettingsBattCharging [] = {
0x3f, 0x4f, 0x73, 0x7c, 0xfe, 0xfe, 0xde, 0xde, 0xce, 0x56, 0x9a, 0xfc, 0xfe, 0xfe, 0x0e, 0x72,
0xbc, 0xcf, 0xf7, 0xfb, 0xfb, 0xfd, 0xfe, 0xff, 0xff, 0xff
};
#endif
3 changes: 3 additions & 0 deletions bitmaps.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ extern const uint8_t BITMAP_CurrentIndicator[8];
extern const uint8_t BITMAP_VFO_Default[8];
extern const uint8_t BITMAP_VFO_NotDefault[8];

#ifdef ENABLE_BATTERY_CHARGING
extern const uint8_t BITMAP_SettingsBattCharging[];
#endif
#endif
17 changes: 16 additions & 1 deletion ui/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,15 @@ case MENU_S_LIST:
break;
#endif
case MENU_VOL:
#ifdef ENABLE_BATTERY_CHARGING
// Draw the charging indicator over the battery if we're charging
// The charging indicator is 13x16, so we need 2 lines of 8 pixels to draw it.
//By Tunas1337
if (gChargingWithTypeC) {
memcpy(gFrameBuffer[2]+113, BITMAP_SettingsBattCharging, 13);
memcpy(gFrameBuffer[3]+113, BITMAP_SettingsBattCharging+13, 13);
}
#endif
sprintf(String, "%d.%02dV", gBatteryVoltageAverage / 100,
gBatteryVoltageAverage % 100);
break;
Expand Down Expand Up @@ -617,7 +626,13 @@ case MENU_S_LIST:
UI_DisplaySmallDigits(Offset, String + (9 - Offset), 105, 0);
#endif
}

#ifdef ENABLE_BATTERY_CHARGING
// If we're in the voltage menu option, also print the current
if (gMenuCursor == MENU_VOL) {
sprintf(String, "%dmA", gBatteryCurrent);
UI_PrintString(String, 50, 127, 5, 8, true);
}
#endif
if (gMenuCursor == MENU_SLIST1 || gMenuCursor == MENU_SLIST2) {
i = gMenuCursor - MENU_SLIST1;

Expand Down

0 comments on commit ebafb3a

Please sign in to comment.