[Horus] Tx battery and audio volume added in the topbar

This commit is contained in:
Bertrand Songis
2016-03-22 22:43:00 +01:00
parent 43c70780b1
commit bff45a4b2a
14 changed files with 68 additions and 9 deletions
+2 -1
View File
@@ -16,4 +16,5 @@ add_bitmaps_target(horus_slider_masks "${RADIO_SRC_DIRECTORY}/bitmaps/horus/slid
add_bitmaps_target(horus_layouts_masks "${RADIO_SRC_DIRECTORY}/gui/horus/layouts/*.png" 480 8bits)
add_bitmaps_target(horus_themes_bitmaps "${RADIO_SRC_DIRECTORY}/gui/horus/themes/*.png" 480 5/6/5)
add_bitmaps_target(horus_fonts ${RADIO_SRC_DIRECTORY}/fonts/horus/*.png 480 8bits)
add_dependencies(horus_bitmaps horus_calibration_bitmaps horus_alpha_bitmaps horus_alpha_calibration_bitmaps horus_masks horus_slider_masks horus_themes_bitmaps horus_layouts_masks horus_fonts)
add_bitmaps_target(horus_volume_masks ${RADIO_SRC_DIRECTORY}/bitmaps/horus/volume/*.png 480 8bits)
add_dependencies(horus_bitmaps horus_volume_masks horus_calibration_bitmaps horus_alpha_bitmaps horus_alpha_calibration_bitmaps horus_masks horus_slider_masks horus_themes_bitmaps horus_layouts_masks horus_fonts)
Binary file not shown.

After

Width:  |  Height:  |  Size: 601 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 866 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 833 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 922 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1012 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 604 B

+28
View File
@@ -52,6 +52,34 @@ const uint8_t LBM_TOPMENU_USB[] = {
#include "mask_topmenu_usb.lbm"
};
const uint8_t LBM_TOPMENU_VOLUME_0[] = {
#include "mask_volume_0.lbm"
};
const uint8_t LBM_TOPMENU_VOLUME_1[] = {
#include "mask_volume_1.lbm"
};
const uint8_t LBM_TOPMENU_VOLUME_2[] = {
#include "mask_volume_2.lbm"
};
const uint8_t LBM_TOPMENU_VOLUME_3[] = {
#include "mask_volume_3.lbm"
};
const uint8_t LBM_TOPMENU_VOLUME_4[] = {
#include "mask_volume_4.lbm"
};
const uint8_t LBM_TOPMENU_VOLUME_SCALE[] = {
#include "mask_volume_scale.lbm"
};
const uint8_t LBM_TOPMENU_TXBATT[] = {
#include "mask_txbat.lbm"
};
const uint8_t LBM_HTRIM_FRAME[] = {
#include "mask_htrim_frame.lbm"
};
+7
View File
@@ -30,6 +30,13 @@ extern const uint8_t LBM_CURRENT_DOT[];
// Main view icons
extern const uint8_t LBM_TOPMENU_USB[];
extern const uint8_t LBM_TOPMENU_VOLUME_0[];
extern const uint8_t LBM_TOPMENU_VOLUME_1[];
extern const uint8_t LBM_TOPMENU_VOLUME_2[];
extern const uint8_t LBM_TOPMENU_VOLUME_3[];
extern const uint8_t LBM_TOPMENU_VOLUME_4[];
extern const uint8_t LBM_TOPMENU_VOLUME_SCALE[];
extern const uint8_t LBM_TOPMENU_TXBATT[];
extern const uint8_t LBM_HTRIM_FRAME[];
extern const uint8_t LBM_VTRIM_FRAME[];
extern const uint8_t LBM_TRIM_SHADOW[];
+2 -2
View File
@@ -51,10 +51,10 @@
#define CURVE_COORD_WIDTH 36
#define CURVE_COORD_HEIGHT 17
#define DATETIME_SEPARATOR_X (LCD_W-55)
#define DATETIME_SEPARATOR_X (LCD_W-53)
#define DATETIME_LINE1 9
#define DATETIME_LINE2 23
#define DATETIME_MIDDLE (LCD_W+DATETIME_SEPARATOR_X+8)/2
#define DATETIME_MIDDLE (LCD_W+DATETIME_SEPARATOR_X+6)/2
#define MENU_TITLE_NEXT_POS (lcdNextPos + 10)
#define MENU_INIT_VPOS -1
+23 -3
View File
@@ -28,7 +28,7 @@ unsigned int Topbar::getZonesCount() const
Zone Topbar::getZone(unsigned int index) const
{
Zone zone;
zone.x = 50 + (TOPBAR_ZONE_WIDTH + 2*TOPBAR_ZONE_MARGIN) * index;
zone.x = 49 + (TOPBAR_ZONE_WIDTH + 2*TOPBAR_ZONE_MARGIN) * index;
zone.y = TOPBAR_ZONE_MARGIN;
zone.w = TOPBAR_ZONE_WIDTH;
zone.h = MENU_HEADER_HEIGHT - 2*TOPBAR_ZONE_MARGIN;
@@ -56,8 +56,8 @@ void drawTopBar()
theme->drawTopbarBackground(NULL);
// USB icon
if (usbPlugged()) {
lcdDrawBitmapPattern(LCD_W-102, 8, LBM_TOPMENU_USB, MENU_TITLE_COLOR);
if (1/*usbPlugged()*/) {
lcdDrawBitmapPattern(LCD_W-98, 8, LBM_TOPMENU_USB, MENU_TITLE_COLOR);
}
// RSSI
@@ -68,6 +68,26 @@ void drawTopBar()
lcdDrawSolidFilledRect(LCD_W-90 + i * 6, 38 - height, 4, height, TELEMETRY_RSSI() >= rssiBarsValue[i] ? MENU_TITLE_COLOR : MENU_TITLE_DISABLE_COLOR);
}
/* Audio volume */
lcdDrawBitmapPattern(LCD_W-130, 4, LBM_TOPMENU_VOLUME_SCALE, MENU_TITLE_DISABLE_COLOR);
if (requiredSpeakerVolume == 0 || g_eeGeneral.beepMode == e_mode_quiet)
lcdDrawBitmapPattern(LCD_W-130, 4, LBM_TOPMENU_VOLUME_0, MENU_TITLE_COLOR);
else if (requiredSpeakerVolume < 7)
lcdDrawBitmapPattern(LCD_W-130, 4, LBM_TOPMENU_VOLUME_1, MENU_TITLE_COLOR);
else if (requiredSpeakerVolume < 13)
lcdDrawBitmapPattern(LCD_W-130, 4, LBM_TOPMENU_VOLUME_2, MENU_TITLE_COLOR);
else if (requiredSpeakerVolume < 19)
lcdDrawBitmapPattern(LCD_W-130, 4, LBM_TOPMENU_VOLUME_3, MENU_TITLE_COLOR);
else
lcdDrawBitmapPattern(LCD_W-130, 4, LBM_TOPMENU_VOLUME_4, MENU_TITLE_COLOR);
/* Tx battery */
uint8_t bars = limit<int8_t>(0, 6 * (g_vbat100mV - g_eeGeneral.vBatMin - 90) / (30 + g_eeGeneral.vBatMax - g_eeGeneral.vBatMin), 5);
lcdDrawBitmapPattern(LCD_W-130, 24, LBM_TOPMENU_TXBATT, MENU_TITLE_COLOR);
for (unsigned int i = 0; i < 5; i++) {
lcdDrawSolidFilledRect(LCD_W-122+4*i, 30, 2, 8, i >= bars ? MENU_TITLE_DISABLE_COLOR : MENU_TITLE_COLOR);
}
topbar->refresh();
#if 0
+1 -1
View File
@@ -25,7 +25,7 @@
#define MAX_TOPBAR_ZONES 5
#define MAX_TOPBAR_OPTIONS 0
#define TOPBAR_ZONE_WIDTH 60
#define TOPBAR_ZONE_WIDTH 70
#define TOPBAR_ZONE_MARGIN 3
class Topbar: public WidgetsContainer<MAX_TOPBAR_ZONES, MAX_TOPBAR_OPTIONS>
+5 -2
View File
@@ -273,11 +273,14 @@ void displayTopBar()
}
/* Audio volume */
TRACE("%d", requiredSpeakerVolume);
if (requiredSpeakerVolume == 0 || g_eeGeneral.beepMode == e_mode_quiet)
LCD_ICON(BAR_VOLUME_X, BAR_Y, ICON_SPEAKER0);
else if (requiredSpeakerVolume < 10)
else if (requiredSpeakerVolume <= 6)
LCD_ICON(BAR_VOLUME_X, BAR_Y, ICON_SPEAKER1);
else if (requiredSpeakerVolume < 20)
else if (requiredSpeakerVolume <= 12)
LCD_ICON(BAR_VOLUME_X, BAR_Y, ICON_SPEAKER2);
else if (requiredSpeakerVolume <= 18)
LCD_ICON(BAR_VOLUME_X, BAR_Y, ICON_SPEAKER2);
else
LCD_ICON(BAR_VOLUME_X, BAR_Y, ICON_SPEAKER3);