[Horus] Model Selection menu started

This commit is contained in:
Bertrand Songis
2015-10-26 19:15:54 +01:00
parent 7e5374f31d
commit 03fabd95ac
7 changed files with 258 additions and 8 deletions
+16
View File
@@ -212,6 +212,22 @@ const uint8_t * const LBM_MODEL_ICONS[] = {
LBM_TELEMETRY_ICON
};
/*
* Model selection screen bitmaps
*/
const uint8_t LBM_LIBRARY_ICON[] = {
#include "../../bitmaps/Horus/mask_library.lbm"
};
const uint8_t LBM_LIBRARY_SLOT[] = {
#include "../../bitmaps/Horus/mask_library_slot.lbm"
};
/*
* Other
*/
const uint16_t LBM_ASTERISK[] = {
#include "../../bitmaps/Horus/asterisk.lbm"
};
+5
View File
@@ -98,5 +98,10 @@ extern const uint8_t LBM_RSCALE[];
extern const uint8_t * const LBM_RADIO_ICONS[];
extern const uint8_t * const LBM_MODEL_ICONS[];
// Model selection icons
extern const uint8_t LBM_LIBRARY_ICON[];
extern const uint8_t LBM_LIBRARY_SLOT[];
// Other icons
extern const uint16_t LBM_ASTERISK[];
+58 -1
View File
@@ -37,19 +37,76 @@
#define CATEGORIES_WIDTH 140
void drawModel(coord_t x, coord_t y, const char * name)
{
lcdDrawSolidRect(x, y, 153, 61, LINE_COLOR);
lcdDrawText(x+5, y+2, name, TEXT_COLOR);
lcdDrawSolidHorizontalLine(x+5, y+19, 143, LINE_COLOR);
lcdDrawBitmapPattern(x+5, y+23, LBM_LIBRARY_SLOT, TEXT_COLOR);
}
void menuModelSelect(evt_t event)
{
switch(event) {
case 0:
// no need to refresh the screen
return;
case EVT_KEY_FIRST(KEY_EXIT):
chainMenu(menuMainView);
return;
}
// Header
lcdDrawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
lcdDrawBitmapPattern(0, 0, LBM_TOPMENU_POLYGON, TITLE_BGCOLOR);
// lcdDrawBitmapPattern(4, 10, LBM_TOPMENU_OPENTX, MENU_TITLE_COLOR);
lcdDrawBitmapPattern(5, 7, LBM_LIBRARY_ICON, MENU_TITLE_COLOR);
drawTopmenuDatetime();
// Categories
lcdDrawSolidFilledRect(0, MENU_HEADER_HEIGHT, CATEGORIES_WIDTH, LCD_H-MENU_HEADER_HEIGHT-MENU_FOOTER_HEIGHT, TITLE_BGCOLOR);
StorageModelsList storage;
const char * error = storageOpenModelsList(&storage);
if (!error) {
bool result = true;
coord_t y = MENU_HEADER_HEIGHT+10;
while (y < LCD_H) {
char line[256];
result = storageReadNextCategory(&storage, line, sizeof(line)-1);
if (!result)
break;
lcdDrawText(MENUS_MARGIN_LEFT, y, line, MENU_TITLE_COLOR);
y += FH;
}
}
// Models
lcdDrawSolidFilledRect(CATEGORIES_WIDTH, MENU_HEADER_HEIGHT, LCD_W-CATEGORIES_WIDTH, LCD_H-MENU_HEADER_HEIGHT-MENU_FOOTER_HEIGHT, TEXT_BGCOLOR);
if (!error) {
bool result = storageSeekCategory(&storage, 0);
coord_t y = MENU_HEADER_HEIGHT+7;
unsigned int i = 0;
while (result) {
char line[256];
result = storageReadNextModel(&storage, line, sizeof(line)-1);
if (!result)
break;
if (y < LCD_H) {
coord_t x;
if (i & 1) {
drawModel(CATEGORIES_WIDTH+MENUS_MARGIN_LEFT+162, y, line);
y += 66;
}
else {
drawModel(CATEGORIES_WIDTH+MENUS_MARGIN_LEFT+1, y, line);
}
}
i++;
}
}
drawScrollbar(DEFAULT_SCROLLBAR_X, MENU_HEADER_HEIGHT+7, MENU_FOOTER_TOP-MENU_HEADER_HEIGHT-15, 0, 4, 2);
// Footer
lcdDrawSolidFilledRect(0, MENU_FOOTER_TOP, LCD_W, MENU_FOOTER_HEIGHT, HEADER_BGCOLOR);
+5 -6
View File
@@ -38,13 +38,10 @@
void menuStatisticsView(evt_t event)
{
drawMenuTemplate("Statistics", event);
switch(event)
{
switch(event) {
case EVT_KEY_FIRST(KEY_UP):
chainMenu(menuStatisticsDebug);
break;
return;
case EVT_KEY_LONG(KEY_MENU):
g_eeGeneral.globalTimer = 0;
@@ -54,9 +51,11 @@ void menuStatisticsView(evt_t event)
case EVT_KEY_FIRST(KEY_EXIT):
chainMenu(menuMainView);
break;
return;
}
drawMenuTemplate("Statistics", event);
lcdDrawText( 10, MENU_CONTENT_TOP + FH*0, "\037\145TOT:\037\317BATT:", HEADER_COLOR);
lcdDrawText( 10, MENU_CONTENT_TOP + FH*1, "TM1:\037\145TM2:", HEADER_COLOR);
lcdDrawText( 10, MENU_CONTENT_TOP + FH*2, "THR:\037\145TH%:", HEADER_COLOR);