Redefine config menu colors to new gray theme

Remove not used code
Reverse leveler direction on on screen keyboard
This commit is contained in:
DiSlord 2020-07-14 21:30:27 +03:00
parent 3c0a23d92b
commit ea7836a273
2 changed files with 14 additions and 25 deletions

View file

@ -22,9 +22,9 @@
// Need enable HAL_USE_SPI in halconf.h // Need enable HAL_USE_SPI in halconf.h
#define __USE_DISPLAY_DMA__ #define __USE_DISPLAY_DMA__
// Add RTC clock support // Add RTC clock support
//#define __USE_RTC__ #define __USE_RTC__
// Add SD card support, req enable RTC (additional settings for file system see FatFS lib ffconf.h) // Add SD card support, req enable RTC (additional settings for file system see FatFS lib ffconf.h)
//#define __USE_SD_CARD__ #define __USE_SD_CARD__
/* /*
* main.c * main.c
@ -402,9 +402,9 @@ extern volatile uint8_t redraw_request;
#define DEFAULT_FG_COLOR RGB565(255,255,255) #define DEFAULT_FG_COLOR RGB565(255,255,255)
#define DEFAULT_BG_COLOR RGB565( 0, 0, 0) #define DEFAULT_BG_COLOR RGB565( 0, 0, 0)
#define DEFAULT_GRID_COLOR RGB565(128,128,128) #define DEFAULT_GRID_COLOR RGB565(128,128,128)
#define DEFAULT_MENU_COLOR RGB565(255,255,255) #define DEFAULT_MENU_COLOR RGB565(230,230,230)
#define DEFAULT_MENU_TEXT_COLOR RGB565( 0, 0, 0) #define DEFAULT_MENU_TEXT_COLOR RGB565( 0, 0, 0)
#define DEFAULT_MENU_ACTIVE_COLOR RGB565(180,255,180) #define DEFAULT_MENU_ACTIVE_COLOR RGB565(210,210,210)
#define DEFAULT_TRACE_1_COLOR RGB565(255,255, 0) #define DEFAULT_TRACE_1_COLOR RGB565(255,255, 0)
#define DEFAULT_TRACE_2_COLOR RGB565( 0,255,255) #define DEFAULT_TRACE_2_COLOR RGB565( 0,255,255)
#define DEFAULT_TRACE_3_COLOR RGB565( 0,255, 0) #define DEFAULT_TRACE_3_COLOR RGB565( 0,255, 0)

27
ui.c
View file

@ -117,6 +117,7 @@ static int8_t selection = 0;
#define MT_CLOSE 0x05 #define MT_CLOSE 0x05
#define MT_ADV_CALLBACK 0x06 #define MT_ADV_CALLBACK 0x06
// Button definition (used in MT_ADV_CALLBACK for custom)
#define BUTTON_ICON_NONE -1 #define BUTTON_ICON_NONE -1
#define BUTTON_ICON_NOCHECK 0 #define BUTTON_ICON_NOCHECK 0
#define BUTTON_ICON_CHECK 1 #define BUTTON_ICON_CHECK 1
@ -133,7 +134,6 @@ static int8_t selection = 0;
typedef struct Button{ typedef struct Button{
uint16_t bg; uint16_t bg;
uint16_t fg; uint16_t fg;
uint16_t border_color;
uint8_t border; uint8_t border;
int8_t icon; int8_t icon;
} button_t; } button_t;
@ -165,12 +165,6 @@ static int8_t last_touch_status = EVT_TOUCH_NONE;
static int16_t last_touch_x; static int16_t last_touch_x;
static int16_t last_touch_y; static int16_t last_touch_y;
//int16_t touch_cal[4] = { 1000, 1000, 10*16, 12*16 };
//int16_t touch_cal[4] = { 620, 600, 130, 180 };
//int awd_count;
//int touch_x, touch_y;
#define KP_CONTINUE 0 #define KP_CONTINUE 0
#define KP_DONE 1 #define KP_DONE 1
#define KP_CANCEL 2 #define KP_CANCEL 2
@ -1463,7 +1457,7 @@ draw_button(uint16_t x, uint16_t y, uint16_t w, uint16_t h, button_t *b)
case BUTTON_BORDER_FALLING: bcr = RGB565(196,196,196); bcd = RGB565(255,255,255); break; case BUTTON_BORDER_FALLING: bcr = RGB565(196,196,196); bcd = RGB565(255,255,255); break;
case BUTTON_BORDER_FLAT: case BUTTON_BORDER_FLAT:
default: default:
bcr = bcd = b->border_color; bcr = bcd = b->fg;
break; break;
} }
ili9341_fill(x, y, w, bw, bcr); // top ili9341_fill(x, y, w, bw, bcr); // top
@ -1478,13 +1472,10 @@ draw_keypad(void)
int i = 0; int i = 0;
button_t button; button_t button;
button.fg = DEFAULT_MENU_TEXT_COLOR; button.fg = DEFAULT_MENU_TEXT_COLOR;
button.border_color = DEFAULT_GRID_COLOR;
while (keypads[i].c != KP_NONE) { while (keypads[i].c != KP_NONE) {
button.bg = config.menu_normal_color;
button.bg = RGB565(230,230,230);//config.menu_normal_color;
button.border_color = DEFAULT_GRID_COLOR;
if (i == selection){ if (i == selection){
button.bg = RGB565(210,210,210);//config.menu_active_color; button.bg = config.menu_active_color;
button.border = KEYBOARD_BUTTON_BORDER|BUTTON_BORDER_FALLING; button.border = KEYBOARD_BUTTON_BORDER|BUTTON_BORDER_FALLING;
} }
else else
@ -1682,13 +1673,12 @@ draw_menu_buttons(const menuitem_t *menu)
continue; continue;
button_t button; button_t button;
button.bg = RGB565(230,230,230);//config.menu_normal_color; button.bg = config.menu_normal_color;
button.fg = DEFAULT_MENU_TEXT_COLOR; button.fg = DEFAULT_MENU_TEXT_COLOR;
button.border_color = DEFAULT_GRID_COLOR;
button.icon = BUTTON_ICON_NONE; button.icon = BUTTON_ICON_NONE;
// focus only in MENU mode but not in KEYPAD mode // focus only in MENU mode but not in KEYPAD mode
if (ui_mode == UI_MENU && i == selection){ if (ui_mode == UI_MENU && i == selection){
button.bg = RGB565(210,210,210);//config.menu_active_color; button.bg = config.menu_active_color;
button.border = MENU_BUTTON_BORDER|BUTTON_BORDER_FALLING; button.border = MENU_BUTTON_BORDER|BUTTON_BORDER_FALLING;
} }
else else
@ -2300,10 +2290,10 @@ ui_process_keypad(void)
status = btn_check(); status = btn_check();
if (status & (EVT_UP|EVT_DOWN)) { if (status & (EVT_UP|EVT_DOWN)) {
do { do {
if (status & EVT_UP) if (status & EVT_DOWN)
if (--selection < 0) if (--selection < 0)
selection = keypads_last_index; selection = keypads_last_index;
if (status & EVT_DOWN) if (status & EVT_UP)
if (++selection > keypads_last_index) if (++selection > keypads_last_index)
selection = 0; selection = 0;
draw_keypad(); draw_keypad();
@ -2510,7 +2500,6 @@ touch_lever_mode_select(int touch_x, int touch_y)
static static
void ui_process_touch(void) void ui_process_touch(void)
{ {
// awd_count++;
adc_stop(); adc_stop();
int touch_x, touch_y; int touch_x, touch_y;
int status = touch_check(); int status = touch_check();