Using Kconfig-style #defines for display parameters' description.

This commit is contained in:
Silvano Seva 2023-12-26 10:40:34 +01:00
parent 0feb8f9075
commit 0f4290cdfe
36 changed files with 282 additions and 282 deletions

View File

@ -290,16 +290,16 @@ linux_def += openrtx_def
# Standard UI # Standard UI
# #
linux_default_src = linux_src + ui_src_default linux_default_src = linux_src + ui_src_default
linux_default_def = linux_def + {'SCREEN_WIDTH': '160', 'SCREEN_HEIGHT': '128', 'PIX_FMT_RGB565': '', linux_default_def = linux_def + {'CONFIG_SCREEN_WIDTH': '160', 'CONFIG_SCREEN_HEIGHT': '128', 'CONFIG_PIX_FMT_RGB565': '',
'GPS_PRESENT': '', 'RTC_PRESENT': ''} 'GPS_PRESENT': '', 'RTC_PRESENT': ''}
linux_small_def = linux_def + {'SCREEN_WIDTH': '128', 'SCREEN_HEIGHT': '64', 'PIX_FMT_BW': '', linux_small_def = linux_def + {'CONFIG_SCREEN_WIDTH': '128', 'CONFIG_SCREEN_HEIGHT': '64', 'CONFIG_PIX_FMT_BW': '',
'GPS_PRESENT': '', 'RTC_PRESENT': ''} 'GPS_PRESENT': '', 'RTC_PRESENT': ''}
# #
# Module17 UI # Module17 UI
# #
linux_mod17_src = linux_src + ui_src_module17 linux_mod17_src = linux_src + ui_src_module17
linux_mod17_def = linux_def + {'SCREEN_WIDTH': '128', 'SCREEN_HEIGHT': '64', 'PIX_FMT_BW': ''} linux_mod17_def = linux_def + {'CONFIG_SCREEN_WIDTH': '128', 'CONFIG_SCREEN_HEIGHT': '64', 'CONFIG_PIX_FMT_BW': ''}
linux_c_args = ['-ffunction-sections', '-fdata-sections'] linux_c_args = ['-ffunction-sections', '-fdata-sections']
linux_cpp_args = ['-ffunction-sections', '-fdata-sections', '-std=c++14'] linux_cpp_args = ['-ffunction-sections', '-fdata-sections', '-std=c++14']

View File

@ -41,7 +41,7 @@ extern "C" {
*********************** HOW TO MANAGE FRAMEBUFFER ***************************** *********************** HOW TO MANAGE FRAMEBUFFER *****************************
* *
* This driver allocates the framebuffer as a block of linearly addressed memory * This driver allocates the framebuffer as a block of linearly addressed memory
* equivalent to an array of SCREEN_HEIGHT*SCREEN_WIDTH elements. * equivalent to an array of CONFIG_SCREEN_HEIGHT*CONFIG_SCREEN_WIDTH elements.
* With respect to it, screen is indexed in this way: * With respect to it, screen is indexed in this way:
* *
* (0,0) * (0,0)
@ -53,7 +53,7 @@ extern "C" {
* y * y
* *
* then to set the value of the pixel having coordinates (X,Y), framebuffer has * then to set the value of the pixel having coordinates (X,Y), framebuffer has
* to be indexed in this way: buf[X + Y*SCREEN_WIDTH]. * to be indexed in this way: buf[X + Y*CONFIG_SCREEN_WIDTH].
* *
*/ */

View File

@ -68,25 +68,25 @@ __attribute__((packed)) settings_t;
static const settings_t default_settings = static const settings_t default_settings =
{ {
100, // Brightness 100, // Brightness
#ifdef SCREEN_CONTRAST #ifdef CONFIG_SCREEN_CONTRAST
DEFAULT_CONTRAST, // Contrast CONFIG_DEFAULT_CONTRAST, // Contrast
#else #else
255, // Contrast 255, // Contrast
#endif #endif
4, // Squelch level, 4 = S3 4, // Squelch level, 4 = S3
0, // Vox level 0, // Vox level
0, // UTC Timezone 0, // UTC Timezone
false, // GPS enabled false, // GPS enabled
"", // Empty callsign "", // Empty callsign
TIMER_30S, // 30 seconds TIMER_30S, // 30 seconds
0, // M17 CAN 0, // M17 CAN
0, // Voice prompts off 0, // Voice prompts off
0, // Phonetic spell off 0, // Phonetic spell off
1, // Automatic latch of macro menu enabled 1, // Automatic latch of macro menu enabled
0, // not used 0, // not used
false, // Check M17 CAN on RX false, // Check M17 CAN on RX
"" // Empty M17 destination "" // Empty M17 destination
}; };
#endif /* SETTINGS_H */ #endif /* SETTINGS_H */

View File

@ -32,7 +32,7 @@ extern "C" {
*********************** HOW TO MANAGE FRAMEBUFFER ***************************** *********************** HOW TO MANAGE FRAMEBUFFER *****************************
* *
* This driver allocates the framebuffer as a block of linearly addressed memory * This driver allocates the framebuffer as a block of linearly addressed memory
* equivalent to an array of SCREEN_HEIGHT*SCREEN_WIDTH elements. * equivalent to an array of CONFIG_SCREEN_HEIGHT*CONFIG_SCREEN_WIDTH elements.
* With respect to it, screen is indexed in this way: * With respect to it, screen is indexed in this way:
* *
* (0,0) * (0,0)
@ -44,7 +44,7 @@ extern "C" {
* y * y
* *
* then to set the value of the pixel having coordinates (X,Y), framebuffer has * then to set the value of the pixel having coordinates (X,Y), framebuffer has
* to be indexed in this way: buf[X + Y*SCREEN_WIDTH]. * to be indexed in this way: buf[X + Y*CONFIG_SCREEN_WIDTH].
* *
*/ */

View File

@ -111,10 +111,10 @@ enum backupRestoreItems
enum displayItems enum displayItems
{ {
#ifdef SCREEN_BRIGHTNESS #ifdef CONFIG_SCREEN_BRIGHTNESS
D_BRIGHTNESS = 0, D_BRIGHTNESS = 0,
#endif #endif
#ifdef SCREEN_CONTRAST #ifdef CONFIG_SCREEN_CONTRAST
D_CONTRAST, D_CONTRAST,
#endif #endif
D_TIMER, D_TIMER,

View File

@ -108,11 +108,11 @@ enum backupRestoreItems
enum displayItems enum displayItems
{ {
#ifdef SCREEN_CONTRAST #ifdef CONFIG_SCREEN_CONTRAST
D_CONTRAST = 0 D_CONTRAST = 0
,D_TIMER ,D_TIMER
#endif #endif
#ifndef SCREEN_CONTRAST #ifndef CONFIG_SCREEN_CONTRAST
D_TIMER = 0 D_TIMER = 0
#endif #endif
}; };

View File

@ -90,7 +90,7 @@ static const GFXfont fonts[] = { TomThumb, // 5pt
Symbols8pt7b // 8pt Symbols8pt7b // 8pt
}; };
#ifdef PIX_FMT_RGB565 #ifdef CONFIG_PIX_FMT_RGB565
/* This specialization is meant for an RGB565 little endian pixel format. /* This specialization is meant for an RGB565 little endian pixel format.
* Thus, to accomodate for the endianness, the fields in struct rgb565_t have to * Thus, to accomodate for the endianness, the fields in struct rgb565_t have to
@ -120,7 +120,7 @@ static rgb565_t _true2highColor(color_t true_color)
return high_color; return high_color;
} }
#elif defined PIX_FMT_BW #elif defined CONFIG_PIX_FMT_BW
/** /**
* This specialization is meant for black and white pixel format. * This specialization is meant for black and white pixel format.
@ -163,12 +163,12 @@ void gfx_init()
initialized = 1; initialized = 1;
// Calculate framebuffer size // Calculate framebuffer size
#ifdef PIX_FMT_RGB565 #ifdef CONFIG_PIX_FMT_RGB565
fbSize = SCREEN_HEIGHT * SCREEN_WIDTH * sizeof(PIXEL_T); fbSize = CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH * sizeof(PIXEL_T);
#elif defined PIX_FMT_BW #elif defined CONFIG_PIX_FMT_BW
fbSize = (SCREEN_HEIGHT * SCREEN_WIDTH) / 8; fbSize = (CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH) / 8;
/* Compensate for eventual truncation error in division */ /* Compensate for eventual truncation error in division */
if((fbSize * 8) < (SCREEN_HEIGHT * SCREEN_WIDTH)) fbSize += 1; if((fbSize * 8) < (CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH)) fbSize += 1;
fbSize *= sizeof(uint8_t); fbSize *= sizeof(uint8_t);
#endif #endif
// Clear text buffer // Clear text buffer
@ -200,8 +200,8 @@ void gfx_clearRows(uint8_t startRow, uint8_t endRow)
{ {
if(!initialized) return; if(!initialized) return;
if(endRow < startRow) return; if(endRow < startRow) return;
uint16_t start = startRow * SCREEN_WIDTH * sizeof(PIXEL_T); uint16_t start = startRow * CONFIG_SCREEN_WIDTH * sizeof(PIXEL_T);
uint16_t height = endRow - startRow * SCREEN_WIDTH * sizeof(PIXEL_T); uint16_t height = endRow - startRow * CONFIG_SCREEN_WIDTH * sizeof(PIXEL_T);
// Set the specified rows to 0x00 = make the screen black // Set the specified rows to 0x00 = make the screen black
memset(buf + start, 0x00, height); memset(buf + start, 0x00, height);
} }
@ -216,9 +216,9 @@ void gfx_clearScreen()
void gfx_fillScreen(color_t color) void gfx_fillScreen(color_t color)
{ {
if(!initialized) return; if(!initialized) return;
for(int16_t y = 0; y < SCREEN_HEIGHT; y++) for(int16_t y = 0; y < CONFIG_SCREEN_HEIGHT; y++)
{ {
for(int16_t x = 0; x < SCREEN_WIDTH; x++) for(int16_t x = 0; x < CONFIG_SCREEN_WIDTH; x++)
{ {
point_t pos = {x, y}; point_t pos = {x, y};
gfx_setPixel(pos, color); gfx_setPixel(pos, color);
@ -228,33 +228,33 @@ void gfx_fillScreen(color_t color)
inline void gfx_setPixel(point_t pos, color_t color) inline void gfx_setPixel(point_t pos, color_t color)
{ {
if (pos.x >= SCREEN_WIDTH || pos.y >= SCREEN_HEIGHT if (pos.x >= CONFIG_SCREEN_WIDTH || pos.y >= CONFIG_SCREEN_HEIGHT ||
|| pos.x < 0 || pos.y < 0) pos.x < 0 || pos.y < 0)
return; // off the screen return; // off the screen
#ifdef PIX_FMT_RGB565 #ifdef CONFIG_PIX_FMT_RGB565
// Blend old pixel value and new one // Blend old pixel value and new one
if (color.alpha < 255) if (color.alpha < 255)
{ {
uint8_t alpha = color.alpha; uint8_t alpha = color.alpha;
rgb565_t new_pixel = _true2highColor(color); rgb565_t new_pixel = _true2highColor(color);
rgb565_t old_pixel = buf[pos.x + pos.y*SCREEN_WIDTH]; rgb565_t old_pixel = buf[pos.x + pos.y*CONFIG_SCREEN_WIDTH];
rgb565_t pixel; rgb565_t pixel;
pixel.r = ((255-alpha)*old_pixel.r+alpha*new_pixel.r)/255; pixel.r = ((255-alpha)*old_pixel.r+alpha*new_pixel.r)/255;
pixel.g = ((255-alpha)*old_pixel.g+alpha*new_pixel.g)/255; pixel.g = ((255-alpha)*old_pixel.g+alpha*new_pixel.g)/255;
pixel.b = ((255-alpha)*old_pixel.b+alpha*new_pixel.b)/255; pixel.b = ((255-alpha)*old_pixel.b+alpha*new_pixel.b)/255;
buf[pos.x + pos.y*SCREEN_WIDTH] = pixel; buf[pos.x + pos.y*CONFIG_SCREEN_WIDTH] = pixel;
} }
else else
{ {
buf[pos.x + pos.y*SCREEN_WIDTH] = _true2highColor(color); buf[pos.x + pos.y*CONFIG_SCREEN_WIDTH] = _true2highColor(color);
} }
#elif defined PIX_FMT_BW #elif defined CONFIG_PIX_FMT_BW
// Ignore more than half transparent pixels // Ignore more than half transparent pixels
if (color.alpha >= 128) if (color.alpha >= 128)
{ {
uint16_t cell = (pos.x + pos.y*SCREEN_WIDTH) / 8; uint16_t cell = (pos.x + pos.y*CONFIG_SCREEN_WIDTH) / 8;
uint16_t elem = (pos.x + pos.y*SCREEN_WIDTH) % 8; uint16_t elem = (pos.x + pos.y*CONFIG_SCREEN_WIDTH) % 8;
buf[cell] &= ~(1 << elem); buf[cell] &= ~(1 << elem);
buf[cell] |= (_color2bw(color) << elem); buf[cell] |= (_color2bw(color) << elem);
} }
@ -329,8 +329,8 @@ void gfx_drawRect(point_t start, uint16_t width, uint16_t height, color_t color,
uint16_t x_max = start.x + width - 1; uint16_t x_max = start.x + width - 1;
uint16_t y_max = start.y + height - 1; uint16_t y_max = start.y + height - 1;
bool perimeter = 0; bool perimeter = 0;
if(x_max > (SCREEN_WIDTH - 1)) x_max = SCREEN_WIDTH - 1; if(x_max > (CONFIG_SCREEN_WIDTH - 1)) x_max = CONFIG_SCREEN_WIDTH - 1;
if(y_max > (SCREEN_HEIGHT - 1)) y_max = SCREEN_HEIGHT - 1; if(y_max > (CONFIG_SCREEN_HEIGHT - 1)) y_max = CONFIG_SCREEN_HEIGHT - 1;
for(int16_t y = start.y; y <= y_max; y++) for(int16_t y = start.y; y <= y_max; y++)
{ {
for(int16_t x = start.x; x <= x_max; x++) for(int16_t x = start.x; x <= x_max; x++)
@ -409,13 +409,13 @@ void gfx_drawCircle(point_t start, uint16_t r, color_t color)
void gfx_drawHLine(int16_t y, uint16_t height, color_t color) void gfx_drawHLine(int16_t y, uint16_t height, color_t color)
{ {
point_t start = {0, y}; point_t start = {0, y};
gfx_drawRect(start, SCREEN_WIDTH, height, color, 1); gfx_drawRect(start, CONFIG_SCREEN_WIDTH, height, color, 1);
} }
void gfx_drawVLine(int16_t x, uint16_t width, color_t color) void gfx_drawVLine(int16_t x, uint16_t width, color_t color)
{ {
point_t start = {x, 0}; point_t start = {x, 0};
gfx_drawRect(start, width, SCREEN_HEIGHT, color, 1); gfx_drawRect(start, width, CONFIG_SCREEN_HEIGHT, color, 1);
} }
/** /**
@ -430,7 +430,7 @@ static inline uint16_t get_line_size(GFXfont f, const char *text, uint16_t lengt
for(unsigned i = 0; i < length && text[i] != '\n' && text[i] != '\r'; i++) for(unsigned i = 0; i < length && text[i] != '\n' && text[i] != '\r'; i++)
{ {
GFXglyph glyph = f.glyph[text[i] - f.first]; GFXglyph glyph = f.glyph[text[i] - f.first];
if (line_size + glyph.xAdvance < SCREEN_WIDTH) if (line_size + glyph.xAdvance < CONFIG_SCREEN_WIDTH)
line_size += glyph.xAdvance; line_size += glyph.xAdvance;
else else
break; break;
@ -452,9 +452,9 @@ static inline uint16_t get_reset_x(textAlign_t alignment, uint16_t line_size,
case TEXT_ALIGN_LEFT: case TEXT_ALIGN_LEFT:
return startx; return startx;
case TEXT_ALIGN_CENTER: case TEXT_ALIGN_CENTER:
return (SCREEN_WIDTH - line_size)/2; return (CONFIG_SCREEN_WIDTH - line_size)/2;
case TEXT_ALIGN_RIGHT: case TEXT_ALIGN_RIGHT:
return SCREEN_WIDTH - line_size - startx; return CONFIG_SCREEN_WIDTH - line_size - startx;
} }
return 0; return 0;
@ -518,7 +518,7 @@ point_t gfx_printBuffer(point_t start, fontSize_t size, textAlign_t alignment,
} }
// Handle wrap around // Handle wrap around
if (start.x + glyph.xAdvance > SCREEN_WIDTH) if (start.x + glyph.xAdvance > CONFIG_SCREEN_WIDTH)
{ {
// Compute size of the first row in pixels // Compute size of the first row in pixels
line_size = get_line_size(f, buf, len); line_size = get_line_size(f, buf, len);
@ -538,8 +538,8 @@ point_t gfx_printBuffer(point_t start, fontSize_t size, textAlign_t alignment,
if (bits & 0x80) if (bits & 0x80)
{ {
if (start.y + yo + yy < SCREEN_HEIGHT && if (start.y + yo + yy < CONFIG_SCREEN_HEIGHT &&
start.x + xo + xx < SCREEN_WIDTH && start.x + xo + xx < CONFIG_SCREEN_WIDTH &&
start.y + yo + yy > 0 && start.y + yo + yy > 0 &&
start.x + xo + xx > 0) start.x + xo + xx > 0)
{ {
@ -589,8 +589,8 @@ point_t gfx_printLine(uint8_t cur, uint8_t tot, int16_t startY, int16_t endY,
// Estimate font height by reading the gliph | height // Estimate font height by reading the gliph | height
uint8_t fontH = gfx_getFontHeight(size); uint8_t fontH = gfx_getFontHeight(size);
// If endY is 0 set it to default value = SCREEN_HEIGHT // If endY is 0 set it to default value = CONFIG_SCREEN_HEIGHT
if(endY == 0) endY = SCREEN_HEIGHT; if(endY == 0) endY = CONFIG_SCREEN_HEIGHT;
// Calculate print coordinates // Calculate print coordinates
int16_t height = endY - startY; int16_t height = endY - startY;
@ -610,15 +610,15 @@ void gfx_printError(const char *text, fontSize_t size)
uint16_t box_padding = 16; uint16_t box_padding = 16;
color_t white = {255, 255, 255, 255}; color_t white = {255, 255, 255, 255};
color_t red = {255, 0, 0, 255}; color_t red = {255, 0, 0, 255};
point_t start = {0, SCREEN_HEIGHT/2 + 5}; point_t start = {0, CONFIG_SCREEN_HEIGHT/2 + 5};
// Print the error message // Print the error message
point_t text_size = gfx_print(start, size, TEXT_ALIGN_CENTER, white, text); point_t text_size = gfx_print(start, size, TEXT_ALIGN_CENTER, white, text);
text_size.x += box_padding; text_size.x += box_padding;
text_size.y += box_padding; text_size.y += box_padding;
point_t box_start = {0, 0}; point_t box_start = {0, 0};
box_start.x = (SCREEN_WIDTH / 2) - (text_size.x / 2); box_start.x = (CONFIG_SCREEN_WIDTH / 2) - (text_size.x / 2);
box_start.y = (SCREEN_HEIGHT / 2) - (text_size.y / 2); box_start.y = (CONFIG_SCREEN_HEIGHT / 2) - (text_size.y / 2);
// Draw the error box // Draw the error box
gfx_drawRect(box_start, text_size.x, text_size.y, red, false); gfx_drawRect(box_start, text_size.x, text_size.y, red, false);
} }
@ -671,7 +671,7 @@ void gfx_drawBattery(point_t start, uint16_t width, uint16_t height,
// Cap percentage to 1 // Cap percentage to 1
percentage = (percentage > 100) ? 100 : percentage; percentage = (percentage > 100) ? 100 : percentage;
#ifdef PIX_FMT_RGB565 #ifdef CONFIG_PIX_FMT_RGB565
color_t green = {0, 255, 0 , 255}; color_t green = {0, 255, 0 , 255};
color_t yellow = {250, 180, 19 , 255}; color_t yellow = {250, 180, 19 , 255};
color_t red = {255, 0, 0 , 255}; color_t red = {255, 0, 0 , 255};
@ -682,7 +682,7 @@ void gfx_drawBattery(point_t start, uint16_t width, uint16_t height,
bat_color = red; bat_color = red;
else if (percentage > 60) else if (percentage > 60)
bat_color = green; bat_color = green;
#elif defined PIX_FMT_BW #elif defined CONFIG_PIX_FMT_BW
color_t bat_color = white; color_t bat_color = white;
#endif #endif
@ -1012,8 +1012,8 @@ void gfx_plotData(point_t start, uint16_t width, uint16_t height,
pos.x = horizontal_pos; pos.x = horizontal_pos;
pos.y = start.y + (height / 2) pos.y = start.y + (height / 2)
+ ((data[i] * 4) / (2 * SHRT_MAX) * height); + ((data[i] * 4) / (2 * SHRT_MAX) * height);
if (pos.y > SCREEN_HEIGHT) if (pos.y > CONFIG_SCREEN_HEIGHT)
pos.y = SCREEN_HEIGHT; pos.y = CONFIG_SCREEN_HEIGHT;
if (!first_iteration) if (!first_iteration)
gfx_drawLine(prev_pos, pos, white); gfx_drawLine(prev_pos, pos, white);
prev_pos = pos; prev_pos = pos;

View File

@ -47,7 +47,7 @@ void openrtx_init()
kbd_init(); // Initialize keyboard driver kbd_init(); // Initialize keyboard driver
ui_init(); // Initialize user interface ui_init(); // Initialize user interface
vp_init(); // Initialize voice prompts vp_init(); // Initialize voice prompts
#ifdef SCREEN_CONTRAST #ifdef CONFIG_SCREEN_CONTRAST
display_setContrast(state.settings.contrast); display_setContrast(state.settings.contrast);
#endif #endif

View File

@ -147,10 +147,10 @@ const char *settings_items[] =
const char *display_items[] = const char *display_items[] =
{ {
#ifdef SCREEN_BRIGHTNESS #ifdef CONFIG_SCREEN_BRIGHTNESS
"Brightness", "Brightness",
#endif #endif
#ifdef SCREEN_CONTRAST #ifdef CONFIG_SCREEN_CONTRAST
"Contrast", "Contrast",
#endif #endif
"Timer" "Timer"
@ -294,7 +294,7 @@ static layout_t _ui_calculateLayout()
// Calculate UI layout depending on vertical resolution // Calculate UI layout depending on vertical resolution
// Tytera MD380, MD-UV380 // Tytera MD380, MD-UV380
#if SCREEN_HEIGHT > 127 #if CONFIG_SCREEN_HEIGHT > 127
// Height and padding shown in diagram at beginning of file // Height and padding shown in diagram at beginning of file
const uint16_t top_h = 16; const uint16_t top_h = 16;
@ -338,7 +338,7 @@ static layout_t _ui_calculateLayout()
const fontSize_t mode_font_small = FONT_SIZE_9PT; const fontSize_t mode_font_small = FONT_SIZE_9PT;
// Radioddity GD-77 // Radioddity GD-77
#elif SCREEN_HEIGHT > 63 #elif CONFIG_SCREEN_HEIGHT > 63
// Height and padding shown in diagram at beginning of file // Height and padding shown in diagram at beginning of file
const uint16_t top_h = 11; const uint16_t top_h = 11;
@ -381,7 +381,7 @@ static layout_t _ui_calculateLayout()
const fontSize_t mode_font_small = FONT_SIZE_6PT; const fontSize_t mode_font_small = FONT_SIZE_6PT;
// Radioddity RD-5R // Radioddity RD-5R
#elif SCREEN_HEIGHT > 47 #elif CONFIG_SCREEN_HEIGHT > 47
// Height and padding shown in diagram at beginning of file // Height and padding shown in diagram at beginning of file
const uint16_t top_h = 11; const uint16_t top_h = 11;
@ -430,7 +430,7 @@ static layout_t _ui_calculateLayout()
point_t line3_pos = {horizontal_pad, top_h + top_pad + line1_h + line2_h + line3_h - small_line_v_pad - text_v_offset}; point_t line3_pos = {horizontal_pad, top_h + top_pad + line1_h + line2_h + line3_h - small_line_v_pad - text_v_offset};
point_t line4_pos = {horizontal_pad, top_h + top_pad + line1_h + line2_h + line3_h + line4_h - small_line_v_pad - text_v_offset}; point_t line4_pos = {horizontal_pad, top_h + top_pad + line1_h + line2_h + line3_h + line4_h - small_line_v_pad - text_v_offset};
point_t line3_large_pos = {horizontal_pad, top_h + top_pad + line1_h + line2_h + line3_large_h - big_line_v_pad - text_v_offset}; point_t line3_large_pos = {horizontal_pad, top_h + top_pad + line1_h + line2_h + line3_large_h - big_line_v_pad - text_v_offset};
point_t bottom_pos = {horizontal_pad, SCREEN_HEIGHT - bottom_pad - status_v_pad - text_v_offset}; point_t bottom_pos = {horizontal_pad, CONFIG_SCREEN_HEIGHT - bottom_pad - status_v_pad - text_v_offset};
layout_t new_layout = layout_t new_layout =
{ {
@ -477,12 +477,12 @@ static layout_t _ui_calculateLayout()
static void _ui_drawLowBatteryScreen() static void _ui_drawLowBatteryScreen()
{ {
gfx_clearScreen(); gfx_clearScreen();
uint16_t bat_width = SCREEN_WIDTH / 2; uint16_t bat_width = CONFIG_SCREEN_WIDTH / 2;
uint16_t bat_height = SCREEN_HEIGHT / 3; uint16_t bat_height = CONFIG_SCREEN_HEIGHT / 3;
point_t bat_pos = {SCREEN_WIDTH / 4, SCREEN_HEIGHT / 8}; point_t bat_pos = {CONFIG_SCREEN_WIDTH / 4, CONFIG_SCREEN_HEIGHT / 8};
gfx_drawBattery(bat_pos, bat_width, bat_height, 10); gfx_drawBattery(bat_pos, bat_width, bat_height, 10);
point_t text_pos_1 = {0, SCREEN_HEIGHT * 2 / 3}; point_t text_pos_1 = {0, CONFIG_SCREEN_HEIGHT * 2 / 3};
point_t text_pos_2 = {0, SCREEN_HEIGHT * 2 / 3 + 16}; point_t text_pos_2 = {0, CONFIG_SCREEN_HEIGHT * 2 / 3 + 16};
gfx_print(text_pos_1, gfx_print(text_pos_1,
FONT_SIZE_6PT, FONT_SIZE_6PT,
@ -516,11 +516,11 @@ static void _ui_timedate_add_digit(datetime_t *timedate, uint8_t pos,
vp_queuePrompt(PROMPT_SLASH); vp_queuePrompt(PROMPT_SLASH);
// just indicates separation of date and time. // just indicates separation of date and time.
if (pos==6) // start of time. if (pos==6) // start of time.
vp_queueString("hh:mm", vpAnnounceCommonSymbols|vpAnnounceLessCommonSymbols); vp_queueString("hh:mm", vpAnnounceCommonSymbols|vpAnnounceLessCommonSymbols);
if (pos == 8) if (pos == 8)
vp_queuePrompt(PROMPT_COLON); vp_queuePrompt(PROMPT_COLON);
vp_play(); vp_play();
switch(pos) switch(pos)
{ {
// Set date // Set date
@ -593,7 +593,7 @@ static bool _ui_drawDarkOverlay()
{ {
color_t alpha_grey = {0, 0, 0, 255}; color_t alpha_grey = {0, 0, 0, 255};
point_t origin = {0, 0}; point_t origin = {0, 0};
gfx_drawRect(origin, SCREEN_WIDTH, SCREEN_HEIGHT, alpha_grey, true); gfx_drawRect(origin, CONFIG_SCREEN_WIDTH, CONFIG_SCREEN_HEIGHT, alpha_grey, true);
return true; return true;
} }
@ -736,7 +736,7 @@ static void _ui_fsm_insertVFONumber(kbd_msg_t msg, bool *sync_rtx)
vp_play(); vp_play();
} }
#ifdef SCREEN_BRIGHTNESS #ifdef CONFIG_SCREEN_BRIGHTNESS
static void _ui_changeBrightness(int variation) static void _ui_changeBrightness(int variation)
{ {
state.settings.brightness += variation; state.settings.brightness += variation;
@ -750,7 +750,7 @@ static void _ui_changeBrightness(int variation)
} }
#endif #endif
#ifdef SCREEN_CONTRAST #ifdef CONFIG_SCREEN_CONTRAST
static void _ui_changeContrast(int variation) static void _ui_changeContrast(int variation)
{ {
if(variation >= 0) if(variation >= 0)
@ -996,7 +996,7 @@ static void _ui_fsm_menuMacro(kbd_msg_t msg, bool *sync_rtx)
float power = dBmToWatt(state.channel.power); float power = dBmToWatt(state.channel.power);
vp_anouncePower(power, queueFlags); vp_anouncePower(power, queueFlags);
break; break;
#ifdef SCREEN_BRIGHTNESS #ifdef CONFIG_SCREEN_BRIGHTNESS
case 7: case 7:
_ui_changeBrightness(-5); _ui_changeBrightness(-5);
vp_announceSettingsInt(&currentLanguage->brightness, queueFlags, vp_announceSettingsInt(&currentLanguage->brightness, queueFlags,
@ -1011,7 +1011,7 @@ static void _ui_fsm_menuMacro(kbd_msg_t msg, bool *sync_rtx)
case 9: case 9:
if (!ui_state.input_locked) if (!ui_state.input_locked)
ui_state.input_locked = true; ui_state.input_locked = true;
else else
ui_state.input_locked = false; ui_state.input_locked = false;
break; break;
} }
@ -1148,8 +1148,8 @@ static void _ui_textInputDel(char *buf)
{ {
// announce the char about to be backspaced. // announce the char about to be backspaced.
// Note this assumes editing callsign. // Note this assumes editing callsign.
// If we edit a different buffer which allows the underline char, we may // If we edit a different buffer which allows the underline char, we may
// not want to exclude it, but when editing callsign, we do not want to say // not want to exclude it, but when editing callsign, we do not want to say
// underline since it means the field is empty. // underline since it means the field is empty.
if(buf[ui_state.input_position] if(buf[ui_state.input_position]
&& buf[ui_state.input_position]!='_') && buf[ui_state.input_position]!='_')
@ -1225,7 +1225,7 @@ static void _ui_numberInputDel(uint32_t *num)
{ {
// announce the digit about to be backspaced. // announce the digit about to be backspaced.
vp_announceInputChar('0' + *num % 10); vp_announceInputChar('0' + *num % 10);
// Move back input cursor // Move back input cursor
if(ui_state.input_position > 0) if(ui_state.input_position > 0)
ui_state.input_position--; ui_state.input_position--;
@ -1251,14 +1251,14 @@ void ui_drawSplashScreen()
{ {
gfx_clearScreen(); gfx_clearScreen();
#if SCREEN_HEIGHT > 64 #if CONFIG_SCREEN_HEIGHT > 64
static const point_t logo_orig = {0, (SCREEN_HEIGHT / 2) - 6}; static const point_t logo_orig = {0, (CONFIG_SCREEN_HEIGHT / 2) - 6};
static const point_t call_orig = {0, SCREEN_HEIGHT - 8}; static const point_t call_orig = {0, CONFIG_SCREEN_HEIGHT - 8};
static const fontSize_t logo_font = FONT_SIZE_12PT; static const fontSize_t logo_font = FONT_SIZE_12PT;
static const fontSize_t call_font = FONT_SIZE_8PT; static const fontSize_t call_font = FONT_SIZE_8PT;
#else #else
static const point_t logo_orig = {0, 19}; static const point_t logo_orig = {0, 19};
static const point_t call_orig = {0, SCREEN_HEIGHT - 8}; static const point_t call_orig = {0, CONFIG_SCREEN_HEIGHT - 8};
static const fontSize_t logo_font = FONT_SIZE_8PT; static const fontSize_t logo_font = FONT_SIZE_8PT;
static const fontSize_t call_font = FONT_SIZE_6PT; static const fontSize_t call_font = FONT_SIZE_6PT;
#endif #endif
@ -1285,57 +1285,57 @@ static uint32_t vpGPSLastUpdate = 0;
static vpGPSInfoFlags_t GetGPSDirectionOrSpeedChanged() static vpGPSInfoFlags_t GetGPSDirectionOrSpeedChanged()
{ {
if (!state.settings.gps_enabled) if (!state.settings.gps_enabled)
return vpGPSNone; return vpGPSNone;
uint32_t now = getTick(); uint32_t now = getTick();
if (now - vpGPSLastUpdate < 8000) if (now - vpGPSLastUpdate < 8000)
return vpGPSNone; return vpGPSNone;
vpGPSInfoFlags_t whatChanged= vpGPSNone; vpGPSInfoFlags_t whatChanged= vpGPSNone;
if (state.gps_data.fix_quality != priorGPSFixQuality) if (state.gps_data.fix_quality != priorGPSFixQuality)
{ {
whatChanged |= vpGPSFixQuality; whatChanged |= vpGPSFixQuality;
priorGPSFixQuality= state.gps_data.fix_quality; priorGPSFixQuality= state.gps_data.fix_quality;
} }
if (state.gps_data.fix_type != priorGPSFixType) if (state.gps_data.fix_type != priorGPSFixType)
{ {
whatChanged |= vpGPSFixType; whatChanged |= vpGPSFixType;
priorGPSFixType = state.gps_data.fix_type; priorGPSFixType = state.gps_data.fix_type;
} }
float speedDiff=fabs(state.gps_data.speed - priorGPSSpeed); float speedDiff=fabs(state.gps_data.speed - priorGPSSpeed);
if (speedDiff >= 1) if (speedDiff >= 1)
{ {
whatChanged |= vpGPSSpeed; whatChanged |= vpGPSSpeed;
priorGPSSpeed = state.gps_data.speed; priorGPSSpeed = state.gps_data.speed;
} }
float altitudeDiff = fabs(state.gps_data.altitude - priorGPSAltitude); float altitudeDiff = fabs(state.gps_data.altitude - priorGPSAltitude);
if (altitudeDiff >= 5) if (altitudeDiff >= 5)
{ {
whatChanged |= vpGPSAltitude; whatChanged |= vpGPSAltitude;
priorGPSAltitude = state.gps_data.altitude; priorGPSAltitude = state.gps_data.altitude;
} }
float degreeDiff = fabs(state.gps_data.tmg_true - priorGPSDirection); float degreeDiff = fabs(state.gps_data.tmg_true - priorGPSDirection);
if (degreeDiff >= 1) if (degreeDiff >= 1)
{ {
whatChanged |= vpGPSDirection; whatChanged |= vpGPSDirection;
priorGPSDirection = state.gps_data.tmg_true; priorGPSDirection = state.gps_data.tmg_true;
} }
if (state.gps_data.satellites_in_view != priorSatellitesInView) if (state.gps_data.satellites_in_view != priorSatellitesInView)
{ {
whatChanged |= vpGPSSatCount; whatChanged |= vpGPSSatCount;
priorSatellitesInView = state.gps_data.satellites_in_view; priorSatellitesInView = state.gps_data.satellites_in_view;
} }
if (whatChanged) if (whatChanged)
vpGPSLastUpdate=now; vpGPSLastUpdate=now;
return whatChanged; return whatChanged;
} }
#endif // GPS_PRESENT #endif // GPS_PRESENT
@ -1460,7 +1460,7 @@ void ui_updateFSM(bool *sync_rtx)
strncpy(state.settings.m17_dest, ui_state.new_callsign, 10); strncpy(state.settings.m17_dest, ui_state.new_callsign, 10);
ui_state.edit_mode = false; ui_state.edit_mode = false;
*sync_rtx = true; *sync_rtx = true;
vp_announceM17Info(NULL, ui_state.edit_mode, vp_announceM17Info(NULL, ui_state.edit_mode,
queueFlags); queueFlags);
} }
else if(msg.keys & KEY_HASH) else if(msg.keys & KEY_HASH)
@ -1469,7 +1469,7 @@ void ui_updateFSM(bool *sync_rtx)
strncpy(state.settings.m17_dest, "", 1); strncpy(state.settings.m17_dest, "", 1);
ui_state.edit_mode = false; ui_state.edit_mode = false;
*sync_rtx = true; *sync_rtx = true;
vp_announceM17Info(NULL, ui_state.edit_mode, vp_announceM17Info(NULL, ui_state.edit_mode,
queueFlags); queueFlags);
} }
else if(msg.keys & KEY_ESC) else if(msg.keys & KEY_ESC)
@ -1581,7 +1581,7 @@ void ui_updateFSM(bool *sync_rtx)
vp_announceInputReceiveOrTransmit(false, vpqInit); vp_announceInputReceiveOrTransmit(false, vpqInit);
vp_queueInteger(input_getPressedNumber(msg)); vp_queueInteger(input_getPressedNumber(msg));
vp_play(); vp_play();
ui_state.new_rx_frequency = 0; ui_state.new_rx_frequency = 0;
ui_state.new_tx_frequency = 0; ui_state.new_tx_frequency = 0;
// Save pressed number to calculare frequency and show in GUI // Save pressed number to calculare frequency and show in GUI
@ -1984,7 +1984,7 @@ void ui_updateFSM(bool *sync_rtx)
// Reset input position and selection // Reset input position and selection
ui_state.input_position = 0; ui_state.input_position = 0;
memset(&ui_state.new_timedate, 0, sizeof(datetime_t)); memset(&ui_state.new_timedate, 0, sizeof(datetime_t));
vp_announceBuffer(&currentLanguage->timeAndDate, vp_announceBuffer(&currentLanguage->timeAndDate,
true, false, "dd/mm/yy"); true, false, "dd/mm/yy");
} }
else if(msg.keys & KEY_ESC) else if(msg.keys & KEY_ESC)
@ -2026,17 +2026,17 @@ void ui_updateFSM(bool *sync_rtx)
{ {
switch(ui_state.menu_selected) switch(ui_state.menu_selected)
{ {
#ifdef SCREEN_BRIGHTNESS #ifdef CONFIG_SCREEN_BRIGHTNESS
case D_BRIGHTNESS: case D_BRIGHTNESS:
_ui_changeBrightness(-5); _ui_changeBrightness(-5);
vp_announceSettingsInt(&currentLanguage->brightness, queueFlags, vp_announceSettingsInt(&currentLanguage->brightness, queueFlags,
state.settings.brightness); state.settings.brightness);
break; break;
#endif #endif
#ifdef SCREEN_CONTRAST #ifdef CONFIG_SCREEN_CONTRAST
case D_CONTRAST: case D_CONTRAST:
_ui_changeContrast(-4); _ui_changeContrast(-4);
vp_announceSettingsInt(&currentLanguage->brightness, queueFlags, vp_announceSettingsInt(&currentLanguage->brightness, queueFlags,
state.settings.contrast); state.settings.contrast);
break; break;
#endif #endif
@ -2053,17 +2053,17 @@ void ui_updateFSM(bool *sync_rtx)
{ {
switch(ui_state.menu_selected) switch(ui_state.menu_selected)
{ {
#ifdef SCREEN_BRIGHTNESS #ifdef CONFIG_SCREEN_BRIGHTNESS
case D_BRIGHTNESS: case D_BRIGHTNESS:
_ui_changeBrightness(+5); _ui_changeBrightness(+5);
vp_announceSettingsInt(&currentLanguage->brightness, queueFlags, vp_announceSettingsInt(&currentLanguage->brightness, queueFlags,
state.settings.brightness); state.settings.brightness);
break; break;
#endif #endif
#ifdef SCREEN_CONTRAST #ifdef CONFIG_SCREEN_CONTRAST
case D_CONTRAST: case D_CONTRAST:
_ui_changeContrast(+4); _ui_changeContrast(+4);
vp_announceSettingsInt(&currentLanguage->brightness, queueFlags, vp_announceSettingsInt(&currentLanguage->brightness, queueFlags,
state.settings.contrast); state.settings.contrast);
break; break;
#endif #endif
@ -2098,13 +2098,13 @@ void ui_updateFSM(bool *sync_rtx)
state.settings.gps_enabled = 0; state.settings.gps_enabled = 0;
else else
state.settings.gps_enabled = 1; state.settings.gps_enabled = 1;
vp_announceSettingsOnOffToggle(&currentLanguage->gpsEnabled, vp_announceSettingsOnOffToggle(&currentLanguage->gpsEnabled,
queueFlags, queueFlags,
state.settings.gps_enabled); state.settings.gps_enabled);
break; break;
case G_SET_TIME: case G_SET_TIME:
state.gps_set_time = !state.gps_set_time; state.gps_set_time = !state.gps_set_time;
vp_announceSettingsOnOffToggle(&currentLanguage->gpsSetTime, vp_announceSettingsOnOffToggle(&currentLanguage->gpsSetTime,
queueFlags, queueFlags,
state.gps_set_time); state.gps_set_time);
break; break;
@ -2418,7 +2418,7 @@ void ui_updateFSM(bool *sync_rtx)
vp_announceScreen(state.ui_screen); vp_announceScreen(state.ui_screen);
} }
// generic beep for any keydown if beep is enabled. // generic beep for any keydown if beep is enabled.
// At vp levels higher than beep, keys will generate voice so no need // At vp levels higher than beep, keys will generate voice so no need
// to beep or you'll get an unwanted click. // to beep or you'll get an unwanted click.
if ((msg.keys &0xffff) && (state.settings.vpLevel == vpBeep)) if ((msg.keys &0xffff) && (state.settings.vpLevel == vpBeep))
vp_beep(BEEP_KEY_GENERIC, SHORT_BEEP); vp_beep(BEEP_KEY_GENERIC, SHORT_BEEP);
@ -2429,7 +2429,7 @@ void ui_updateFSM(bool *sync_rtx)
else if(event.type == EVENT_STATUS) else if(event.type == EVENT_STATUS)
{ {
#ifdef GPS_PRESENT #ifdef GPS_PRESENT
if ((state.ui_screen == MENU_GPS) && if ((state.ui_screen == MENU_GPS) &&
(!vp_isPlaying()) && (!vp_isPlaying()) &&
(state.settings.vpLevel > vpLow) && (state.settings.vpLevel > vpLow) &&
(!txOngoing && !rtx_rxSquelchOpen())) (!txOngoing && !rtx_rxSquelchOpen()))

View File

@ -31,7 +31,7 @@ void _ui_drawMainBackground()
// Print top bar line of hline_h pixel height // Print top bar line of hline_h pixel height
gfx_drawHLine(layout.top_h, layout.hline_h, color_grey); gfx_drawHLine(layout.top_h, layout.hline_h, color_grey);
// Print bottom bar line of 1 pixel height // Print bottom bar line of 1 pixel height
gfx_drawHLine(SCREEN_HEIGHT - layout.bottom_h - 1, layout.hline_h, color_grey); gfx_drawHLine(CONFIG_SCREEN_HEIGHT - layout.bottom_h - 1, layout.hline_h, color_grey);
} }
void _ui_drawMainTop(ui_state_t * ui_state) void _ui_drawMainTop(ui_state_t * ui_state)
@ -50,9 +50,9 @@ void _ui_drawMainTop(ui_state_t * ui_state)
color_white,"%.1fV", last_state.v_bat); color_white,"%.1fV", last_state.v_bat);
#else #else
// Otherwise print battery icon on top bar, use 4 px padding // Otherwise print battery icon on top bar, use 4 px padding
uint16_t bat_width = SCREEN_WIDTH / 9; uint16_t bat_width = CONFIG_SCREEN_WIDTH / 9;
uint16_t bat_height = layout.top_h - (layout.status_v_pad * 2); uint16_t bat_height = layout.top_h - (layout.status_v_pad * 2);
point_t bat_pos = {SCREEN_WIDTH - bat_width - layout.horizontal_pad, point_t bat_pos = {CONFIG_SCREEN_WIDTH - bat_width - layout.horizontal_pad,
layout.status_v_pad}; layout.status_v_pad};
gfx_drawBattery(bat_pos, bat_width, bat_height, last_state.charge); gfx_drawBattery(bat_pos, bat_width, bat_height, last_state.charge);
#endif #endif
@ -250,10 +250,10 @@ void _ui_drawMainBottom()
float rssi = last_state.rssi; float rssi = last_state.rssi;
float squelch = last_state.settings.sqlLevel / 16.0f; float squelch = last_state.settings.sqlLevel / 16.0f;
float volume = platform_getVolumeLevel() / 255.0f; float volume = platform_getVolumeLevel() / 255.0f;
uint16_t meter_width = SCREEN_WIDTH - 2 * layout.horizontal_pad; uint16_t meter_width = CONFIG_SCREEN_WIDTH - 2 * layout.horizontal_pad;
uint16_t meter_height = layout.bottom_h; uint16_t meter_height = layout.bottom_h;
point_t meter_pos = { layout.horizontal_pad, point_t meter_pos = { layout.horizontal_pad,
SCREEN_HEIGHT - meter_height - layout.bottom_pad}; CONFIG_SCREEN_HEIGHT - meter_height - layout.bottom_pad};
uint8_t mic_level = platform_getMicLevel(); uint8_t mic_level = platform_getMicLevel();
switch(last_state.channel.mode) switch(last_state.channel.mode)
{ {

View File

@ -159,11 +159,11 @@ void _ui_drawMenuList(uint8_t selected, int (*getCurrentEntry)(char *buf, uint8_
{ {
point_t pos = layout.line1_pos; point_t pos = layout.line1_pos;
// Number of menu entries that fit in the screen height // Number of menu entries that fit in the screen height
uint8_t entries_in_screen = (SCREEN_HEIGHT - 1 - pos.y) / layout.menu_h + 1; uint8_t entries_in_screen = (CONFIG_SCREEN_HEIGHT - 1 - pos.y) / layout.menu_h + 1;
uint8_t scroll = 0; uint8_t scroll = 0;
char entry_buf[MAX_ENTRY_LEN] = ""; char entry_buf[MAX_ENTRY_LEN] = "";
color_t text_color = color_white; color_t text_color = color_white;
for(int item=0, result=0; (result == 0) && (pos.y < SCREEN_HEIGHT); item++) for(int item=0, result=0; (result == 0) && (pos.y < CONFIG_SCREEN_HEIGHT); item++)
{ {
// If selection is off the screen, scroll screen // If selection is off the screen, scroll screen
if(selected >= entries_in_screen) if(selected >= entries_in_screen)
@ -178,7 +178,7 @@ void _ui_drawMenuList(uint8_t selected, int (*getCurrentEntry)(char *buf, uint8_
text_color = color_black; text_color = color_black;
// Draw rectangle under selected item, compensating for text height // Draw rectangle under selected item, compensating for text height
point_t rect_pos = {0, pos.y - layout.menu_h + 3}; point_t rect_pos = {0, pos.y - layout.menu_h + 3};
gfx_drawRect(rect_pos, SCREEN_WIDTH, layout.menu_h, color_white, true); gfx_drawRect(rect_pos, CONFIG_SCREEN_WIDTH, layout.menu_h, color_white, true);
announceMenuItemIfNeeded(entry_buf, NULL, false); announceMenuItemIfNeeded(entry_buf, NULL, false);
} }
gfx_print(pos, layout.menu_font, TEXT_ALIGN_LEFT, text_color, entry_buf); gfx_print(pos, layout.menu_font, TEXT_ALIGN_LEFT, text_color, entry_buf);
@ -193,12 +193,12 @@ void _ui_drawMenuListValue(ui_state_t* ui_state, uint8_t selected,
{ {
point_t pos = layout.line1_pos; point_t pos = layout.line1_pos;
// Number of menu entries that fit in the screen height // Number of menu entries that fit in the screen height
uint8_t entries_in_screen = (SCREEN_HEIGHT - 1 - pos.y) / layout.menu_h + 1; uint8_t entries_in_screen = (CONFIG_SCREEN_HEIGHT - 1 - pos.y) / layout.menu_h + 1;
uint8_t scroll = 0; uint8_t scroll = 0;
char entry_buf[MAX_ENTRY_LEN] = ""; char entry_buf[MAX_ENTRY_LEN] = "";
char value_buf[MAX_ENTRY_LEN] = ""; char value_buf[MAX_ENTRY_LEN] = "";
color_t text_color = color_white; color_t text_color = color_white;
for(int item=0, result=0; (result == 0) && (pos.y < SCREEN_HEIGHT); item++) for(int item=0, result=0; (result == 0) && (pos.y < CONFIG_SCREEN_HEIGHT); item++)
{ {
// If selection is off the screen, scroll screen // If selection is off the screen, scroll screen
if(selected >= entries_in_screen) if(selected >= entries_in_screen)
@ -222,7 +222,7 @@ void _ui_drawMenuListValue(ui_state_t* ui_state, uint8_t selected,
full_rect = false; full_rect = false;
} }
point_t rect_pos = {0, pos.y - layout.menu_h + 3}; point_t rect_pos = {0, pos.y - layout.menu_h + 3};
gfx_drawRect(rect_pos, SCREEN_WIDTH, layout.menu_h, color_white, full_rect); gfx_drawRect(rect_pos, CONFIG_SCREEN_WIDTH, layout.menu_h, color_white, full_rect);
bool editModeChanged = priorEditMode != ui_state->edit_mode; bool editModeChanged = priorEditMode != ui_state->edit_mode;
priorEditMode = ui_state->edit_mode; priorEditMode = ui_state->edit_mode;
// force the menu item to be spoken when the edit mode changes. // force the menu item to be spoken when the edit mode changes.
@ -270,12 +270,12 @@ int _ui_getDisplayValueName(char *buf, uint8_t max_len, uint8_t index)
uint8_t value = 0; uint8_t value = 0;
switch(index) switch(index)
{ {
#ifdef SCREEN_BRIGHTNESS #ifdef CONFIG_SCREEN_BRIGHTNESS
case D_BRIGHTNESS: case D_BRIGHTNESS:
value = last_state.settings.brightness; value = last_state.settings.brightness;
break; break;
#endif #endif
#ifdef SCREEN_CONTRAST #ifdef CONFIG_SCREEN_CONTRAST
case D_CONTRAST: case D_CONTRAST:
value = last_state.settings.contrast; value = last_state.settings.contrast;
break; break;
@ -602,7 +602,7 @@ void _ui_drawMenuGPS()
// Print "GPS" on top bar // Print "GPS" on top bar
gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_CENTER, gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_CENTER,
color_white, currentLanguage->gps); color_white, currentLanguage->gps);
point_t fix_pos = {layout.line2_pos.x, SCREEN_HEIGHT * 2 / 5}; point_t fix_pos = {layout.line2_pos.x, CONFIG_SCREEN_HEIGHT * 2 / 5};
// Print GPS status, if no fix, hide details // Print GPS status, if no fix, hide details
if(!last_state.settings.gps_enabled) if(!last_state.settings.gps_enabled)
gfx_print(fix_pos, layout.line3_large_font, TEXT_ALIGN_CENTER, gfx_print(fix_pos, layout.line3_large_font, TEXT_ALIGN_CENTER,
@ -668,17 +668,17 @@ void _ui_drawMenuGPS()
last_state.gps_data.altitude); last_state.gps_data.altitude);
} }
// Draw compass // Draw compass
point_t compass_pos = {layout.horizontal_pad * 2, SCREEN_HEIGHT / 2}; point_t compass_pos = {layout.horizontal_pad * 2, CONFIG_SCREEN_HEIGHT / 2};
gfx_drawGPScompass(compass_pos, gfx_drawGPScompass(compass_pos,
SCREEN_WIDTH / 9 + 2, CONFIG_SCREEN_WIDTH / 9 + 2,
last_state.gps_data.tmg_true, last_state.gps_data.tmg_true,
last_state.gps_data.fix_quality != 0 && last_state.gps_data.fix_quality != 0 &&
last_state.gps_data.fix_quality != 6); last_state.gps_data.fix_quality != 6);
// Draw satellites bar graph // Draw satellites bar graph
point_t bar_pos = {layout.line3_large_pos.x + SCREEN_WIDTH * 1 / 3, SCREEN_HEIGHT / 2}; point_t bar_pos = {layout.line3_large_pos.x + CONFIG_SCREEN_WIDTH * 1 / 3, CONFIG_SCREEN_HEIGHT / 2};
gfx_drawGPSgraph(bar_pos, gfx_drawGPSgraph(bar_pos,
(SCREEN_WIDTH * 2 / 3) - layout.horizontal_pad, (CONFIG_SCREEN_WIDTH * 2 / 3) - layout.horizontal_pad,
SCREEN_HEIGHT / 3, CONFIG_SCREEN_HEIGHT / 3,
last_state.gps_data.satellites, last_state.gps_data.satellites,
last_state.gps_data.active_sats); last_state.gps_data.active_sats);
} }
@ -772,10 +772,10 @@ void _ui_drawMenuAbout()
gfx_clearScreen(); gfx_clearScreen();
point_t logo_pos; point_t logo_pos;
if(SCREEN_HEIGHT >= 100) if(CONFIG_SCREEN_HEIGHT >= 100)
{ {
logo_pos.x = 0; logo_pos.x = 0;
logo_pos.y = SCREEN_HEIGHT / 5; logo_pos.y = CONFIG_SCREEN_HEIGHT / 5;
gfx_print(logo_pos, FONT_SIZE_12PT, TEXT_ALIGN_CENTER, yellow_fab413, gfx_print(logo_pos, FONT_SIZE_12PT, TEXT_ALIGN_CENTER, yellow_fab413,
"O P N\nR T X"); "O P N\nR T X");
} }
@ -788,7 +788,7 @@ void _ui_drawMenuAbout()
} }
uint8_t line_h = layout.menu_h; uint8_t line_h = layout.menu_h;
point_t pos = {SCREEN_WIDTH / 7, SCREEN_HEIGHT - (line_h * (author_num - 1)) - 5}; point_t pos = {CONFIG_SCREEN_WIDTH / 7, CONFIG_SCREEN_HEIGHT - (line_h * (author_num - 1)) - 5};
for(int author = 0; author < author_num; author++) for(int author = 0; author < author_num; author++)
{ {
gfx_print(pos, layout.top_font, TEXT_ALIGN_LEFT, gfx_print(pos, layout.top_font, TEXT_ALIGN_LEFT,
@ -887,18 +887,18 @@ void _ui_drawSettingsM17(ui_state_t* ui_state)
// Print "M17 Settings" on top bar // Print "M17 Settings" on top bar
gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_CENTER, gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_CENTER,
color_white, currentLanguage->m17settings); color_white, currentLanguage->m17settings);
gfx_printLine(1, 4, layout.top_h, SCREEN_HEIGHT - layout.bottom_h, gfx_printLine(1, 4, layout.top_h, CONFIG_SCREEN_HEIGHT - layout.bottom_h,
layout.horizontal_pad, layout.menu_font, layout.horizontal_pad, layout.menu_font,
TEXT_ALIGN_LEFT, color_white, currentLanguage->callsign); TEXT_ALIGN_LEFT, color_white, currentLanguage->callsign);
if((ui_state->edit_mode) && (ui_state->menu_selected == M17_CALLSIGN)) if((ui_state->edit_mode) && (ui_state->menu_selected == M17_CALLSIGN))
{ {
uint16_t rect_width = SCREEN_WIDTH - (layout.horizontal_pad * 2); uint16_t rect_width = CONFIG_SCREEN_WIDTH - (layout.horizontal_pad * 2);
uint16_t rect_height = (SCREEN_HEIGHT - (layout.top_h + layout.bottom_h))/2; uint16_t rect_height = (CONFIG_SCREEN_HEIGHT - (layout.top_h + layout.bottom_h))/2;
point_t rect_origin = {(SCREEN_WIDTH - rect_width) / 2, point_t rect_origin = {(CONFIG_SCREEN_WIDTH - rect_width) / 2,
(SCREEN_HEIGHT - rect_height) / 2}; (CONFIG_SCREEN_HEIGHT - rect_height) / 2};
gfx_drawRect(rect_origin, rect_width, rect_height, color_white, false); gfx_drawRect(rect_origin, rect_width, rect_height, color_white, false);
// Print M17 callsign being typed // Print M17 callsign being typed
gfx_printLine(1, 1, layout.top_h, SCREEN_HEIGHT - layout.bottom_h, gfx_printLine(1, 1, layout.top_h, CONFIG_SCREEN_HEIGHT - layout.bottom_h,
layout.horizontal_pad, layout.input_font, layout.horizontal_pad, layout.input_font,
TEXT_ALIGN_CENTER, color_white, ui_state->new_callsign); TEXT_ALIGN_CENTER, color_white, ui_state->new_callsign);
} }
@ -933,10 +933,10 @@ void _ui_drawSettingsReset2Defaults(ui_state_t* ui_state)
// Make text flash yellow once every 1s // Make text flash yellow once every 1s
color_t textcolor = drawcnt % 2 == 0 ? color_white : yellow_fab413; color_t textcolor = drawcnt % 2 == 0 ? color_white : yellow_fab413;
gfx_printLine(1, 4, layout.top_h, SCREEN_HEIGHT - layout.bottom_h, gfx_printLine(1, 4, layout.top_h, CONFIG_SCREEN_HEIGHT - layout.bottom_h,
layout.horizontal_pad, layout.top_font, layout.horizontal_pad, layout.top_font,
TEXT_ALIGN_CENTER, textcolor, currentLanguage->toReset); TEXT_ALIGN_CENTER, textcolor, currentLanguage->toReset);
gfx_printLine(2, 4, layout.top_h, SCREEN_HEIGHT - layout.bottom_h, gfx_printLine(2, 4, layout.top_h, CONFIG_SCREEN_HEIGHT - layout.bottom_h,
layout.horizontal_pad, layout.top_font, layout.horizontal_pad, layout.top_font,
TEXT_ALIGN_CENTER, textcolor, currentLanguage->pressEnterTwice); TEXT_ALIGN_CENTER, textcolor, currentLanguage->pressEnterTwice);
@ -961,10 +961,10 @@ void _ui_drawSettingsRadio(ui_state_t* ui_state)
if ((ui_state->menu_selected == R_OFFSET) && (ui_state->edit_mode)) if ((ui_state->menu_selected == R_OFFSET) && (ui_state->edit_mode))
{ {
char buf[17] = { 0 }; char buf[17] = { 0 };
uint16_t rect_width = SCREEN_WIDTH - (layout.horizontal_pad * 2); uint16_t rect_width = CONFIG_SCREEN_WIDTH - (layout.horizontal_pad * 2);
uint16_t rect_height = (SCREEN_HEIGHT - (layout.top_h + layout.bottom_h))/2; uint16_t rect_height = (CONFIG_SCREEN_HEIGHT - (layout.top_h + layout.bottom_h))/2;
point_t rect_origin = {(SCREEN_WIDTH - rect_width) / 2, point_t rect_origin = {(CONFIG_SCREEN_WIDTH - rect_width) / 2,
(SCREEN_HEIGHT - rect_height) / 2}; (CONFIG_SCREEN_HEIGHT - rect_height) / 2};
gfx_drawRect(rect_origin, rect_width, rect_height, color_white, false); gfx_drawRect(rect_origin, rect_width, rect_height, color_white, false);
@ -976,7 +976,7 @@ void _ui_drawSettingsRadio(ui_state_t* ui_state)
else else
snprintf(buf, 17, "%gMHz", (float) ui_state->new_offset / 1000000.0f); snprintf(buf, 17, "%gMHz", (float) ui_state->new_offset / 1000000.0f);
gfx_printLine(1, 1, layout.top_h, SCREEN_HEIGHT - layout.bottom_h, gfx_printLine(1, 1, layout.top_h, CONFIG_SCREEN_HEIGHT - layout.bottom_h,
layout.horizontal_pad, layout.input_font, layout.horizontal_pad, layout.input_font,
TEXT_ALIGN_CENTER, color_white, buf); TEXT_ALIGN_CENTER, color_white, buf);
} }
@ -1153,7 +1153,7 @@ bool _ui_drawMacroMenu(ui_state_t* ui_state)
#endif // UI_NO_KEYBOARD #endif // UI_NO_KEYBOARD
gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_LEFT, gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_LEFT,
yellow_fab413, "7"); yellow_fab413, "7");
#ifdef SCREEN_BRIGHTNESS #ifdef CONFIG_SCREEN_BRIGHTNESS
gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_LEFT, gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_LEFT,
color_white, " B-"); color_white, " B-");
gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_LEFT, gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_LEFT,
@ -1166,7 +1166,7 @@ bool _ui_drawMacroMenu(ui_state_t* ui_state)
#endif // UI_NO_KEYBOARD #endif // UI_NO_KEYBOARD
gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_CENTER, gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_CENTER,
yellow_fab413, "8"); yellow_fab413, "8");
#ifdef SCREEN_BRIGHTNESS #ifdef CONFIG_SCREEN_BRIGHTNESS
gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_CENTER, gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_CENTER,
color_white, " B+"); color_white, " B+");
#endif #endif

View File

@ -88,7 +88,7 @@ const char *settings_items[] =
const char *display_items[] = const char *display_items[] =
{ {
#ifdef SCREEN_CONTRAST #ifdef CONFIG_SCREEN_CONTRAST
"Contrast", "Contrast",
#endif #endif
"Timer" "Timer"
@ -256,7 +256,7 @@ layout_t _ui_calculateLayout()
point_t line3_pos = {horizontal_pad, top_h + top_pad + line1_h + line2_h + line3_h - big_line_v_pad - text_v_offset}; point_t line3_pos = {horizontal_pad, top_h + top_pad + line1_h + line2_h + line3_h - big_line_v_pad - text_v_offset};
point_t line4_pos = {horizontal_pad, top_h + top_pad + line1_h + line2_h + line3_h + line4_h - big_line_v_pad - text_v_offset}; point_t line4_pos = {horizontal_pad, top_h + top_pad + line1_h + line2_h + line3_h + line4_h - big_line_v_pad - text_v_offset};
point_t line5_pos = {horizontal_pad, top_h + top_pad + line1_h + line2_h + line3_h + line4_h + line5_h - big_line_v_pad - text_v_offset}; point_t line5_pos = {horizontal_pad, top_h + top_pad + line1_h + line2_h + line3_h + line4_h + line5_h - big_line_v_pad - text_v_offset};
point_t bottom_pos = {horizontal_pad, SCREEN_HEIGHT - bottom_pad - status_v_pad - text_v_offset}; point_t bottom_pos = {horizontal_pad, CONFIG_SCREEN_HEIGHT - bottom_pad - status_v_pad - text_v_offset};
layout_t new_layout = layout_t new_layout =
{ {
@ -318,7 +318,7 @@ void ui_drawSplashScreen()
{ {
gfx_clearScreen(); gfx_clearScreen();
point_t origin = {0, (SCREEN_HEIGHT / 2) - 6}; point_t origin = {0, (CONFIG_SCREEN_HEIGHT / 2) - 6};
gfx_print(origin, FONT_SIZE_12PT, TEXT_ALIGN_CENTER, yellow_fab413, "O P N\nR T X"); gfx_print(origin, FONT_SIZE_12PT, TEXT_ALIGN_CENTER, yellow_fab413, "O P N\nR T X");
} }
@ -929,7 +929,7 @@ void ui_updateFSM(bool *sync_rtx)
{ {
switch(ui_state.menu_selected) switch(ui_state.menu_selected)
{ {
#ifdef SCREEN_CONTRAST #ifdef CONFIG_SCREEN_CONTRAST
case D_CONTRAST: case D_CONTRAST:
_ui_changeContrast(-4); _ui_changeContrast(-4);
break; break;
@ -945,7 +945,7 @@ void ui_updateFSM(bool *sync_rtx)
{ {
switch(ui_state.menu_selected) switch(ui_state.menu_selected)
{ {
#ifdef SCREEN_CONTRAST #ifdef CONFIG_SCREEN_CONTRAST
case D_CONTRAST: case D_CONTRAST:
_ui_changeContrast(+4); _ui_changeContrast(+4);
break; break;

View File

@ -30,7 +30,7 @@ void _ui_drawMainBackground()
// Print top bar line of hline_h pixel height // Print top bar line of hline_h pixel height
gfx_drawHLine(layout.top_h, layout.hline_h, color_grey); gfx_drawHLine(layout.top_h, layout.hline_h, color_grey);
// Print bottom bar line of 1 pixel height // Print bottom bar line of 1 pixel height
gfx_drawHLine(SCREEN_HEIGHT - layout.bottom_h - 1, layout.hline_h, color_grey); gfx_drawHLine(CONFIG_SCREEN_HEIGHT - layout.bottom_h - 1, layout.hline_h, color_grey);
} }
void _ui_drawMainTop() void _ui_drawMainTop()
@ -252,10 +252,10 @@ void _ui_drawMainBottom()
float squelch = last_state.settings.sqlLevel / 16.0f; float squelch = last_state.settings.sqlLevel / 16.0f;
// Module17 0.1e does not know the volume level, so we will never draw it // Module17 0.1e does not know the volume level, so we will never draw it
float volume = platform_getVolumeLevel() / 255.0f; float volume = platform_getVolumeLevel() / 255.0f;
uint16_t meter_width = SCREEN_WIDTH - 2 * layout.horizontal_pad; uint16_t meter_width = CONFIG_SCREEN_WIDTH - 2 * layout.horizontal_pad;
uint16_t meter_height = layout.bottom_h; uint16_t meter_height = layout.bottom_h;
point_t meter_pos = { layout.horizontal_pad, point_t meter_pos = { layout.horizontal_pad,
SCREEN_HEIGHT - meter_height - layout.bottom_pad}; CONFIG_SCREEN_HEIGHT - meter_height - layout.bottom_pad};
uint8_t mic_level = platform_getMicLevel(); uint8_t mic_level = platform_getMicLevel();
switch(last_state.channel.mode) switch(last_state.channel.mode)
{ {

View File

@ -75,11 +75,11 @@ void _ui_drawMenuList(uint8_t selected, int (*getCurrentEntry)(char *buf, uint8_
{ {
point_t pos = layout.line1_pos; point_t pos = layout.line1_pos;
// Number of menu entries that fit in the screen height // Number of menu entries that fit in the screen height
uint8_t entries_in_screen = (SCREEN_HEIGHT - 1 - pos.y) / layout.menu_h + 1; uint8_t entries_in_screen = (CONFIG_SCREEN_HEIGHT - 1 - pos.y) / layout.menu_h + 1;
uint8_t scroll = 0; uint8_t scroll = 0;
char entry_buf[MAX_ENTRY_LEN] = ""; char entry_buf[MAX_ENTRY_LEN] = "";
color_t text_color = color_white; color_t text_color = color_white;
for(int item=0, result=0; (result == 0) && (pos.y < SCREEN_HEIGHT); item++) for(int item=0, result=0; (result == 0) && (pos.y < CONFIG_SCREEN_HEIGHT); item++)
{ {
// If selection is off the screen, scroll screen // If selection is off the screen, scroll screen
if(selected >= entries_in_screen) if(selected >= entries_in_screen)
@ -94,7 +94,7 @@ void _ui_drawMenuList(uint8_t selected, int (*getCurrentEntry)(char *buf, uint8_
text_color = color_black; text_color = color_black;
// Draw rectangle under selected item, compensating for text height // Draw rectangle under selected item, compensating for text height
point_t rect_pos = {0, pos.y - layout.menu_h + 3}; point_t rect_pos = {0, pos.y - layout.menu_h + 3};
gfx_drawRect(rect_pos, SCREEN_WIDTH, layout.menu_h, color_white, true); gfx_drawRect(rect_pos, CONFIG_SCREEN_WIDTH, layout.menu_h, color_white, true);
} }
gfx_print(pos, layout.menu_font, TEXT_ALIGN_LEFT, text_color, entry_buf); gfx_print(pos, layout.menu_font, TEXT_ALIGN_LEFT, text_color, entry_buf);
pos.y += layout.menu_h; pos.y += layout.menu_h;
@ -108,12 +108,12 @@ void _ui_drawMenuListValue(ui_state_t* ui_state, uint8_t selected,
{ {
point_t pos = layout.line1_pos; point_t pos = layout.line1_pos;
// Number of menu entries that fit in the screen height // Number of menu entries that fit in the screen height
uint8_t entries_in_screen = (SCREEN_HEIGHT - 1 - pos.y) / layout.menu_h + 1; uint8_t entries_in_screen = (CONFIG_SCREEN_HEIGHT - 1 - pos.y) / layout.menu_h + 1;
uint8_t scroll = 0; uint8_t scroll = 0;
char entry_buf[MAX_ENTRY_LEN] = ""; char entry_buf[MAX_ENTRY_LEN] = "";
char value_buf[MAX_ENTRY_LEN] = ""; char value_buf[MAX_ENTRY_LEN] = "";
color_t text_color = color_white; color_t text_color = color_white;
for(int item=0, result=0; (result == 0) && (pos.y < SCREEN_HEIGHT); item++) for(int item=0, result=0; (result == 0) && (pos.y < CONFIG_SCREEN_HEIGHT); item++)
{ {
// If selection is off the screen, scroll screen // If selection is off the screen, scroll screen
if(selected >= entries_in_screen) if(selected >= entries_in_screen)
@ -137,7 +137,7 @@ void _ui_drawMenuListValue(ui_state_t* ui_state, uint8_t selected,
full_rect = false; full_rect = false;
} }
point_t rect_pos = {0, pos.y - layout.menu_h + 3}; point_t rect_pos = {0, pos.y - layout.menu_h + 3};
gfx_drawRect(rect_pos, SCREEN_WIDTH, layout.menu_h, color_white, full_rect); gfx_drawRect(rect_pos, CONFIG_SCREEN_WIDTH, layout.menu_h, color_white, full_rect);
} }
gfx_print(pos, layout.menu_font, TEXT_ALIGN_LEFT, text_color, entry_buf); gfx_print(pos, layout.menu_font, TEXT_ALIGN_LEFT, text_color, entry_buf);
gfx_print(pos, layout.menu_font, TEXT_ALIGN_RIGHT, text_color, value_buf); gfx_print(pos, layout.menu_font, TEXT_ALIGN_RIGHT, text_color, value_buf);
@ -177,7 +177,7 @@ int _ui_getDisplayValueName(char *buf, uint8_t max_len, uint8_t index)
uint8_t value = 0; uint8_t value = 0;
switch(index) switch(index)
{ {
#ifdef SCREEN_CONTRAST #ifdef CONFIG_SCREEN_CONTRAST
case D_CONTRAST: case D_CONTRAST:
value = last_state.settings.contrast; value = last_state.settings.contrast;
break; break;
@ -326,7 +326,7 @@ void _ui_drawMenuGPS()
// Print "GPS" on top bar // Print "GPS" on top bar
gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_CENTER, gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_CENTER,
color_white, "GPS"); color_white, "GPS");
point_t fix_pos = {layout.line2_pos.x, SCREEN_HEIGHT * 2 / 5}; point_t fix_pos = {layout.line2_pos.x, CONFIG_SCREEN_HEIGHT * 2 / 5};
// Print GPS status, if no fix, hide details // Print GPS status, if no fix, hide details
if(!last_state.settings.gps_enabled) if(!last_state.settings.gps_enabled)
gfx_print(fix_pos, layout.line3_font, TEXT_ALIGN_CENTER, gfx_print(fix_pos, layout.line3_font, TEXT_ALIGN_CENTER,
@ -392,17 +392,17 @@ void _ui_drawMenuGPS()
last_state.gps_data.altitude); last_state.gps_data.altitude);
} }
// Draw compass // Draw compass
point_t compass_pos = {layout.horizontal_pad * 2, SCREEN_HEIGHT / 2}; point_t compass_pos = {layout.horizontal_pad * 2, CONFIG_SCREEN_HEIGHT / 2};
gfx_drawGPScompass(compass_pos, gfx_drawGPScompass(compass_pos,
SCREEN_WIDTH / 9 + 2, CONFIG_SCREEN_WIDTH / 9 + 2,
last_state.gps_data.tmg_true, last_state.gps_data.tmg_true,
last_state.gps_data.fix_quality != 0 && last_state.gps_data.fix_quality != 0 &&
last_state.gps_data.fix_quality != 6); last_state.gps_data.fix_quality != 6);
// Draw satellites bar graph // Draw satellites bar graph
point_t bar_pos = {layout.line3_pos.x + SCREEN_WIDTH * 1 / 3, SCREEN_HEIGHT / 2}; point_t bar_pos = {layout.line3_pos.x + CONFIG_SCREEN_WIDTH * 1 / 3, CONFIG_SCREEN_HEIGHT / 2};
gfx_drawGPSgraph(bar_pos, gfx_drawGPSgraph(bar_pos,
(SCREEN_WIDTH * 2 / 3) - layout.horizontal_pad, (CONFIG_SCREEN_WIDTH * 2 / 3) - layout.horizontal_pad,
SCREEN_HEIGHT / 3, CONFIG_SCREEN_HEIGHT / 3,
last_state.gps_data.satellites, last_state.gps_data.satellites,
last_state.gps_data.active_sats); last_state.gps_data.active_sats);
} }
@ -438,7 +438,7 @@ void _ui_drawMenuAbout()
"OpenRTX"); "OpenRTX");
uint8_t line_h = layout.menu_h; uint8_t line_h = layout.menu_h;
point_t pos = {SCREEN_WIDTH / 7, SCREEN_HEIGHT - (line_h * (author_num - 1)) - 5}; point_t pos = {CONFIG_SCREEN_WIDTH / 7, CONFIG_SCREEN_HEIGHT - (line_h * (author_num - 1)) - 5};
for(int author = 0; author < author_num; author++) for(int author = 0; author < author_num; author++)
{ {
gfx_print(pos, layout.top_font, TEXT_ALIGN_LEFT, gfx_print(pos, layout.top_font, TEXT_ALIGN_LEFT,
@ -539,17 +539,17 @@ void _ui_drawSettingsM17(ui_state_t* ui_state)
if(ui_state->edit_mode) if(ui_state->edit_mode)
{ {
gfx_printLine(1, 4, layout.top_h, SCREEN_HEIGHT - layout.bottom_h, gfx_printLine(1, 4, layout.top_h, CONFIG_SCREEN_HEIGHT - layout.bottom_h,
layout.horizontal_pad, layout.menu_font, layout.horizontal_pad, layout.menu_font,
TEXT_ALIGN_LEFT, color_white, "Callsign:"); TEXT_ALIGN_LEFT, color_white, "Callsign:");
// uint16_t rect_width = SCREEN_WIDTH - (layout.horizontal_pad * 2); // uint16_t rect_width = CONFIG_SCREEN_WIDTH - (layout.horizontal_pad * 2);
// uint16_t rect_height = (SCREEN_HEIGHT - (layout.top_h + layout.bottom_h))/2; // uint16_t rect_height = (CONFIG_SCREEN_HEIGHT - (layout.top_h + layout.bottom_h))/2;
// point_t rect_origin = {(SCREEN_WIDTH - rect_width) / 2, // point_t rect_origin = {(CONFIG_SCREEN_WIDTH - rect_width) / 2,
// (SCREEN_HEIGHT - rect_height) / 2}; // (CONFIG_SCREEN_HEIGHT - rect_height) / 2};
// gfx_drawRect(rect_origin, rect_width, rect_height, color_white, false); // gfx_drawRect(rect_origin, rect_width, rect_height, color_white, false);
// Print M17 callsign being typed // Print M17 callsign being typed
gfx_printLine(1, 1, layout.top_h, SCREEN_HEIGHT - layout.bottom_h, gfx_printLine(1, 1, layout.top_h, CONFIG_SCREEN_HEIGHT - layout.bottom_h,
layout.horizontal_pad, layout.input_font, layout.horizontal_pad, layout.input_font,
TEXT_ALIGN_CENTER, color_white, ui_state->new_callsign); TEXT_ALIGN_CENTER, color_white, ui_state->new_callsign);
// Print Button Info // Print Button Info
@ -589,10 +589,10 @@ void _ui_drawSettingsReset2Defaults(ui_state_t* ui_state)
// Make text flash yellow once every 1s // Make text flash yellow once every 1s
color_t textcolor = drawcnt % 2 == 0 ? color_white : yellow_fab413; color_t textcolor = drawcnt % 2 == 0 ? color_white : yellow_fab413;
gfx_printLine(1, 4, layout.top_h, SCREEN_HEIGHT - layout.bottom_h, gfx_printLine(1, 4, layout.top_h, CONFIG_SCREEN_HEIGHT - layout.bottom_h,
layout.horizontal_pad, layout.top_font, layout.horizontal_pad, layout.top_font,
TEXT_ALIGN_CENTER, textcolor, "To reset:"); TEXT_ALIGN_CENTER, textcolor, "To reset:");
gfx_printLine(2, 4, layout.top_h, SCREEN_HEIGHT - layout.bottom_h, gfx_printLine(2, 4, layout.top_h, CONFIG_SCREEN_HEIGHT - layout.bottom_h,
layout.horizontal_pad, layout.top_font, layout.horizontal_pad, layout.top_font,
TEXT_ALIGN_CENTER, textcolor, "Press Enter twice"); TEXT_ALIGN_CENTER, textcolor, "Press Enter twice");

View File

@ -23,7 +23,7 @@
#include <hwconfig.h> #include <hwconfig.h>
#include "backlight.h" #include "backlight.h"
#if defined(PLATFORM_MDUV3x0) && defined(SCREEN_BRIGHTNESS) #if defined(PLATFORM_MDUV3x0) && defined(CONFIG_SCREEN_BRIGHTNESS)
/* /*
* Interrupt-based software PWM for backlight dimming on MD-UV3x0. * Interrupt-based software PWM for backlight dimming on MD-UV3x0.
@ -83,7 +83,7 @@ void backlight_init()
gpio_setMode(LCD_BKLIGHT, OUTPUT); gpio_setMode(LCD_BKLIGHT, OUTPUT);
gpio_clearPin(LCD_BKLIGHT); gpio_clearPin(LCD_BKLIGHT);
#ifdef SCREEN_BRIGHTNESS #ifdef CONFIG_SCREEN_BRIGHTNESS
/* /*
* Configure TIM11 for backlight PWM: Fpwm = 256Hz, 8 bit of resolution. * Configure TIM11 for backlight PWM: Fpwm = 256Hz, 8 bit of resolution.
* APB2 freq. is 84MHz but timer runs at twice this frequency, then: * APB2 freq. is 84MHz but timer runs at twice this frequency, then:
@ -146,7 +146,7 @@ void display_setBacklightLevel(uint8_t level)
*/ */
if(pwmLevel > 1) if(pwmLevel > 1)
{ {
#ifdef SCREEN_BRIGHTNESS #ifdef CONFIG_SCREEN_BRIGHTNESS
TIM11->CCR1 = pwmLevel; TIM11->CCR1 = pwmLevel;
TIM11->CR1 |= TIM_CR1_CEN; TIM11->CR1 |= TIM_CR1_CEN;
#else #else

View File

@ -92,7 +92,7 @@
* starting at 0x20000000 and accessible by the DMA. * starting at 0x20000000 and accessible by the DMA.
* Pixel format is RGB565, 16 bit per pixel. * Pixel format is RGB565, 16 bit per pixel.
*/ */
static uint16_t __attribute__((section(".bss2"))) frameBuffer[SCREEN_WIDTH * SCREEN_HEIGHT]; static uint16_t __attribute__((section(".bss2"))) frameBuffer[CONFIG_SCREEN_WIDTH * CONFIG_SCREEN_HEIGHT];
using namespace miosix; using namespace miosix;
static Thread *lcdWaiting = 0; static Thread *lcdWaiting = 0;
@ -132,7 +132,7 @@ void display_init()
backlight_init(); backlight_init();
/* Clear framebuffer, setting all pixels to 0x00 makes the screen white */ /* Clear framebuffer, setting all pixels to 0x00 makes the screen white */
memset(frameBuffer, 0x00, SCREEN_WIDTH * SCREEN_HEIGHT * sizeof(uint16_t)); memset(frameBuffer, 0x00, CONFIG_SCREEN_WIDTH * CONFIG_SCREEN_HEIGHT * sizeof(uint16_t));
/* /*
* Turn on DMA2 and configure its interrupt. DMA is used to transfer the * Turn on DMA2 and configure its interrupt. DMA is used to transfer the
@ -467,9 +467,9 @@ void display_renderRows(uint8_t startRow, uint8_t endRow)
*/ */
for(uint8_t y = startRow; y < endRow; y++) for(uint8_t y = startRow; y < endRow; y++)
{ {
for(uint8_t x = 0; x < SCREEN_WIDTH; x++) for(uint8_t x = 0; x < CONFIG_SCREEN_WIDTH; x++)
{ {
size_t pos = x + y * SCREEN_WIDTH; size_t pos = x + y * CONFIG_SCREEN_WIDTH;
uint16_t pixel = frameBuffer[pos]; uint16_t pixel = frameBuffer[pos];
frameBuffer[pos] = __builtin_bswap16(pixel); frameBuffer[pos] = __builtin_bswap16(pixel);
} }
@ -491,8 +491,8 @@ void display_renderRows(uint8_t startRow, uint8_t endRow)
* we have to set the transfer size to twice the framebuffer size, since * we have to set the transfer size to twice the framebuffer size, since
* this one is made of 16 bit variables. * this one is made of 16 bit variables.
*/ */
DMA2_Stream7->NDTR = (endRow - startRow) * SCREEN_WIDTH * sizeof(uint16_t); DMA2_Stream7->NDTR = (endRow - startRow) * CONFIG_SCREEN_WIDTH * sizeof(uint16_t);
DMA2_Stream7->PAR = ((uint32_t ) frameBuffer + (startRow * SCREEN_WIDTH DMA2_Stream7->PAR = ((uint32_t ) frameBuffer + (startRow * CONFIG_SCREEN_WIDTH
* sizeof(uint16_t))); * sizeof(uint16_t)));
DMA2_Stream7->M0AR = LCD_FSMC_ADDR_DATA; DMA2_Stream7->M0AR = LCD_FSMC_ADDR_DATA;
DMA2_Stream7->CR = DMA_SxCR_CHSEL /* Channel 7 */ DMA2_Stream7->CR = DMA_SxCR_CHSEL /* Channel 7 */
@ -521,7 +521,7 @@ void display_renderRows(uint8_t startRow, uint8_t endRow)
void display_render() void display_render()
{ {
display_renderRows(0, SCREEN_HEIGHT); display_renderRows(0, CONFIG_SCREEN_HEIGHT);
} }
bool display_renderingInProgress() bool display_renderingInProgress()

View File

@ -24,15 +24,15 @@
#include <string.h> #include <string.h>
// Display is monochromatic, one bit per pixel // Display is monochromatic, one bit per pixel
#define FB_SIZE ((SCREEN_HEIGHT * SCREEN_WIDTH) / 8 + 1) #define FB_SIZE ((CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH) / 8 + 1)
static const struct device *displayDev; static const struct device *displayDev;
static const struct display_buffer_descriptor displayBufDesc = static const struct display_buffer_descriptor displayBufDesc =
{ {
FB_SIZE, FB_SIZE,
SCREEN_WIDTH, CONFIG_SCREEN_WIDTH,
SCREEN_HEIGHT, CONFIG_SCREEN_HEIGHT,
SCREEN_WIDTH, CONFIG_SCREEN_WIDTH,
}; };
static uint8_t frameBuffer[FB_SIZE]; static uint8_t frameBuffer[FB_SIZE];
@ -64,14 +64,14 @@ void display_render()
memset(shadowBuffer, 0x00, FB_SIZE); memset(shadowBuffer, 0x00, FB_SIZE);
rendering = true; rendering = true;
for(uint8_t y = 0; y < SCREEN_HEIGHT; y++) for(uint8_t y = 0; y < CONFIG_SCREEN_HEIGHT; y++)
{ {
for(uint8_t x = 0; x < SCREEN_WIDTH; x++) for(uint8_t x = 0; x < CONFIG_SCREEN_WIDTH; x++)
{ {
size_t cell = x / 8 + y * (SCREEN_WIDTH / 8); size_t cell = x / 8 + y * (CONFIG_SCREEN_WIDTH / 8);
bool pixel = frameBuffer[cell] & (1 << (x % 8)); bool pixel = frameBuffer[cell] & (1 << (x % 8));
if (pixel) if (pixel)
shadowBuffer[x + y / 8 * SCREEN_WIDTH] |= 1 << (y % 8); shadowBuffer[x + y / 8 * CONFIG_SCREEN_WIDTH] |= 1 << (y % 8);
} }
} }

View File

@ -34,7 +34,7 @@
* starting at 0x20000000. * starting at 0x20000000.
* Pixel format is black and white, one bit per pixel. * Pixel format is black and white, one bit per pixel.
*/ */
#define FB_SIZE (((SCREEN_HEIGHT * SCREEN_WIDTH) / 8 ) + 1) #define FB_SIZE (((CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH) / 8 ) + 1)
static uint8_t __attribute__((section(".bss2"))) frameBuffer[FB_SIZE]; static uint8_t __attribute__((section(".bss2"))) frameBuffer[FB_SIZE];
@ -109,7 +109,7 @@ void display_renderRows(uint8_t startRow, uint8_t endRow)
for(uint8_t y = startRow; y < endRow; y++) for(uint8_t y = startRow; y < endRow; y++)
{ {
for(uint8_t x = 0; x < SCREEN_WIDTH/8; x++) for(uint8_t x = 0; x < CONFIG_SCREEN_WIDTH/8; x++)
{ {
gpio_clearPin(LCD_RS); /* RS low -> command mode */ gpio_clearPin(LCD_RS); /* RS low -> command mode */
(void) spi2_sendRecv(y & 0x0F); /* Set Y position */ (void) spi2_sendRecv(y & 0x0F); /* Set Y position */
@ -117,7 +117,7 @@ void display_renderRows(uint8_t startRow, uint8_t endRow)
(void) spi2_sendRecv(0xB0 | x); /* Set X position */ (void) spi2_sendRecv(0xB0 | x); /* Set X position */
gpio_setPin(LCD_RS); /* RS high -> data mode */ gpio_setPin(LCD_RS); /* RS high -> data mode */
size_t pos = x + y * (SCREEN_WIDTH/8); size_t pos = x + y * (CONFIG_SCREEN_WIDTH/8);
spi2_sendRecv(frameBuffer[pos]); spi2_sendRecv(frameBuffer[pos]);
} }
} }
@ -127,7 +127,7 @@ void display_renderRows(uint8_t startRow, uint8_t endRow)
void display_render() void display_render()
{ {
display_renderRows(0, SCREEN_HEIGHT); display_renderRows(0, CONFIG_SCREEN_HEIGHT);
} }
bool display_renderingInProgress() bool display_renderingInProgress()

View File

@ -35,7 +35,7 @@
* starting at 0x20000000. * starting at 0x20000000.
* Pixel format is black and white, one bit per pixel. * Pixel format is black and white, one bit per pixel.
*/ */
#define FB_SIZE (((SCREEN_HEIGHT * SCREEN_WIDTH) / 8 ) + 1) #define FB_SIZE (((CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH) / 8 ) + 1)
static uint8_t __attribute__((section(".bss2"))) frameBuffer[FB_SIZE]; static uint8_t __attribute__((section(".bss2"))) frameBuffer[FB_SIZE];
/** /**
@ -147,7 +147,7 @@ void display_renderRows(uint8_t startRow, uint8_t endRow)
void display_render() void display_render()
{ {
display_renderRows(0, (SCREEN_WIDTH / 8) - 1); display_renderRows(0, (CONFIG_SCREEN_WIDTH / 8) - 1);
} }
bool display_renderingInProgress() bool display_renderingInProgress()

View File

@ -33,7 +33,7 @@
* starting at 0x20000000. * starting at 0x20000000.
* Pixel format is black and white, one bit per pixel. * Pixel format is black and white, one bit per pixel.
*/ */
#define FB_SIZE (((SCREEN_HEIGHT * SCREEN_WIDTH) / 8 ) + 1) #define FB_SIZE (((CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH) / 8 ) + 1)
static uint8_t __attribute__((section(".bss2"))) frameBuffer[FB_SIZE]; static uint8_t __attribute__((section(".bss2"))) frameBuffer[FB_SIZE];
/** /**
@ -132,7 +132,7 @@ void display_renderRows(uint8_t startRow, uint8_t endRow)
void display_render() void display_render()
{ {
display_renderRows(0, SCREEN_HEIGHT / 8); display_renderRows(0, CONFIG_SCREEN_HEIGHT / 8);
} }
bool display_renderingInProgress() bool display_renderingInProgress()

View File

@ -32,7 +32,7 @@
* LCD framebuffer, statically allocated. * LCD framebuffer, statically allocated.
* Pixel format is black and white, one bit per pixel * Pixel format is black and white, one bit per pixel
*/ */
#define FB_SIZE (((SCREEN_HEIGHT * SCREEN_WIDTH) / 8 ) + 1) #define FB_SIZE (((CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH) / 8 ) + 1)
static uint8_t frameBuffer[FB_SIZE]; static uint8_t frameBuffer[FB_SIZE];
/** /**
@ -157,7 +157,7 @@ void display_renderRows(uint8_t startRow, uint8_t endRow)
void display_render() void display_render()
{ {
display_renderRows(0, SCREEN_HEIGHT / 8); display_renderRows(0, CONFIG_SCREEN_HEIGHT / 8);
} }
bool display_renderingInProgress() bool display_renderingInProgress()

View File

@ -55,14 +55,14 @@ static uint32_t fetchPixelFromFb(unsigned int x, unsigned int y)
(void) y; (void) y;
uint32_t pixel = 0; uint32_t pixel = 0;
#ifdef PIX_FMT_BW #ifdef CONFIG_PIX_FMT_BW
/* /*
* Black and white 1bpp format: framebuffer is an array of uint8_t, where * Black and white 1bpp format: framebuffer is an array of uint8_t, where
* each cell contains the values of eight pixels, one per bit. * each cell contains the values of eight pixels, one per bit.
*/ */
uint8_t *fb = (uint8_t *)(frameBuffer); uint8_t *fb = (uint8_t *)(frameBuffer);
unsigned int cell = (x + y*SCREEN_WIDTH) / 8; unsigned int cell = (x + y*CONFIG_SCREEN_WIDTH) / 8;
unsigned int elem = (x + y*SCREEN_WIDTH) % 8; unsigned int elem = (x + y*CONFIG_SCREEN_WIDTH) % 8;
if(fb[cell] & (1 << elem)) pixel = 0xFFFFFFFF; if(fb[cell] & (1 << elem)) pixel = 0xFFFFFFFF;
#endif #endif
@ -72,7 +72,7 @@ static uint32_t fetchPixelFromFb(unsigned int x, unsigned int y)
* replicating the pixel value for the three components * replicating the pixel value for the three components
*/ */
uint8_t *fb = (uint8_t *)(frameBuffer); uint8_t *fb = (uint8_t *)(frameBuffer);
uint8_t px = fb[x + y*SCREEN_WIDTH]; uint8_t px = fb[x + y*CONFIG_SCREEN_WIDTH];
pixel = 0xFF000000 | (px << 16) | (px << 8) | px; pixel = 0xFF000000 | (px << 16) | (px << 8) | px;
#endif #endif
@ -86,12 +86,12 @@ void display_init()
/* /*
* Black and white pixel format: framebuffer type is uint8_t where each * Black and white pixel format: framebuffer type is uint8_t where each
* bit represents a pixel. We have to allocate * bit represents a pixel. We have to allocate
* (SCREEN_HEIGHT * SCREEN_WIDTH)/8 elements * (CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH)/8 elements
*/ */
#ifdef PIX_FMT_BW #ifdef CONFIG_PIX_FMT_BW
unsigned int fbSize = (SCREEN_HEIGHT * SCREEN_WIDTH)/8; unsigned int fbSize = (CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH)/8;
/* Compensate for eventual truncation error in division */ /* Compensate for eventual truncation error in division */
if((fbSize * 8) < (SCREEN_HEIGHT * SCREEN_WIDTH)) fbSize += 1; if((fbSize * 8) < (CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH)) fbSize += 1;
fbSize *= sizeof(uint8_t); fbSize *= sizeof(uint8_t);
#endif #endif
@ -100,15 +100,15 @@ void display_init()
* controls one pixel * controls one pixel
*/ */
#ifdef PIX_FMT_GRAYSC #ifdef PIX_FMT_GRAYSC
unsigned int fbSize = SCREEN_HEIGHT * SCREEN_WIDTH * sizeof(uint8_t); unsigned int fbSize = CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH * sizeof(uint8_t);
#endif #endif
/* /*
* RGB565 pixel format: framebuffer type is uint16_t where each element * RGB565 pixel format: framebuffer type is uint16_t where each element
* controls one pixel * controls one pixel
*/ */
#ifdef PIX_FMT_RGB565 #ifdef CONFIG_PIX_FMT_RGB565
unsigned int fbSize = SCREEN_HEIGHT * SCREEN_WIDTH * sizeof(uint16_t); unsigned int fbSize = CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH * sizeof(uint16_t);
#endif #endif
frameBuffer = malloc(fbSize); frameBuffer = malloc(fbSize);
@ -140,15 +140,15 @@ void display_renderRows(uint8_t startRow, uint8_t endRow)
// receive a texture pixel map // receive a texture pixel map
void *fb; void *fb;
chan_recv(&fb_sync, &fb); chan_recv(&fb_sync, &fb);
#ifdef PIX_FMT_RGB565 #ifdef CONFIG_PIX_FMT_RGB565
memcpy(fb, frameBuffer, sizeof(PIXEL_SIZE) * SCREEN_HEIGHT * SCREEN_WIDTH); memcpy(fb, frameBuffer, sizeof(PIXEL_SIZE) * CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH);
#else #else
uint32_t *pixels = (uint32_t *) fb; uint32_t *pixels = (uint32_t *) fb;
for (unsigned int x = 0; x < SCREEN_WIDTH; x++) for (unsigned int x = 0; x < CONFIG_SCREEN_WIDTH; x++)
{ {
for (unsigned int y = startRow; y < endRow; y++) for (unsigned int y = startRow; y < endRow; y++)
{ {
pixels[x + y * SCREEN_WIDTH] = fetchPixelFromFb(x, y); pixels[x + y * CONFIG_SCREEN_WIDTH] = fetchPixelFromFb(x, y);
} }
} }
#endif #endif
@ -162,7 +162,7 @@ void display_renderRows(uint8_t startRow, uint8_t endRow)
void display_render() void display_render()
{ {
display_renderRows(0, SCREEN_HEIGHT); display_renderRows(0, CONFIG_SCREEN_HEIGHT);
} }
bool display_renderingInProgress() bool display_renderingInProgress()

View File

@ -21,10 +21,10 @@
#include <hwconfig.h> #include <hwconfig.h>
#include <stddef.h> #include <stddef.h>
#ifdef PIX_FMT_BW #ifdef CONFIG_PIX_FMT_BW
static uint8_t frameBuffer[(((SCREEN_WIDTH * SCREEN_HEIGHT) / 8 ) + 1)]; static uint8_t frameBuffer[(((CONFIG_SCREEN_WIDTH * CONFIG_SCREEN_HEIGHT) / 8 ) + 1)];
#else #else
static uint16_t frameBuffer[SCREEN_WIDTH * SCREEN_HEIGHT]; static uint16_t frameBuffer[CONFIG_SCREEN_WIDTH * CONFIG_SCREEN_HEIGHT];
#endif #endif

View File

@ -29,18 +29,18 @@ extern "C" {
#endif #endif
/* Screen dimensions */ /* Screen dimensions */
#define SCREEN_WIDTH 128 #define CONFIG_SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64 #define CONFIG_SCREEN_HEIGHT 64
/* Screen pixel format */ /* Screen pixel format */
#define PIX_FMT_BW #define CONFIG_PIX_FMT_BW
/* Screen has adjustable contrast */ /* Screen has adjustable contrast */
#define SCREEN_CONTRAST #define CONFIG_SCREEN_CONTRAST
#define DEFAULT_CONTRAST 71 #define CONFIG_DEFAULT_CONTRAST 71
/* Screen has adjustable brightness */ /* Screen has adjustable brightness */
#define SCREEN_BRIGHTNESS #define CONFIG_SCREEN_BRIGHTNESS
/* Battery type */ /* Battery type */
#define BAT_LIPO_2S #define BAT_LIPO_2S

View File

@ -29,18 +29,18 @@ extern "C" {
#endif #endif
/* Screen dimensions */ /* Screen dimensions */
#define SCREEN_WIDTH 128 #define CONFIG_SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64 #define CONFIG_SCREEN_HEIGHT 64
/* Screen pixel format */ /* Screen pixel format */
#define PIX_FMT_BW #define CONFIG_PIX_FMT_BW
/* Screen has adjustable contrast */ /* Screen has adjustable contrast */
#define SCREEN_CONTRAST #define CONFIG_SCREEN_CONTRAST
#define DEFAULT_CONTRAST 71 #define CONFIG_DEFAULT_CONTRAST 71
/* Screen has adjustable brightness */ /* Screen has adjustable brightness */
#define SCREEN_BRIGHTNESS #define CONFIG_SCREEN_BRIGHTNESS
/* Battery type */ /* Battery type */
#define BAT_LIPO_2S #define BAT_LIPO_2S

View File

@ -37,14 +37,14 @@ extern "C" {
#define HAS_ABSOLUTE_KNOB #define HAS_ABSOLUTE_KNOB
/* Screen dimensions */ /* Screen dimensions */
#define SCREEN_WIDTH 160 #define CONFIG_SCREEN_WIDTH 160
#define SCREEN_HEIGHT 128 #define CONFIG_SCREEN_HEIGHT 128
/* Screen pixel format */ /* Screen pixel format */
#define PIX_FMT_RGB565 #define CONFIG_PIX_FMT_RGB565
/* Screen has adjustable brightness */ /* Screen has adjustable brightness */
#define SCREEN_BRIGHTNESS #define CONFIG_SCREEN_BRIGHTNESS
/* Battery type */ /* Battery type */
#define BAT_LIPO_2S #define BAT_LIPO_2S

View File

@ -35,15 +35,15 @@ extern "C" {
#define GPS_PRESENT #define GPS_PRESENT
/* Screen dimensions */ /* Screen dimensions */
#define SCREEN_WIDTH 128 #define CONFIG_SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64 #define CONFIG_SCREEN_HEIGHT 64
/* Screen has adjustable contrast */ /* Screen has adjustable contrast */
#define SCREEN_CONTRAST #define CONFIG_SCREEN_CONTRAST
#define DEFAULT_CONTRAST 91 #define CONFIG_DEFAULT_CONTRAST 91
/* Screen pixel format */ /* Screen pixel format */
#define PIX_FMT_BW #define CONFIG_PIX_FMT_BW
/* Battery type */ /* Battery type */
#define BAT_NONE #define BAT_NONE

View File

@ -34,11 +34,11 @@ extern "C" {
#define GPS_PRESENT #define GPS_PRESENT
/* Screen dimensions */ /* Screen dimensions */
#define SCREEN_WIDTH 160 #define CONFIG_SCREEN_WIDTH 160
#define SCREEN_HEIGHT 128 #define CONFIG_SCREEN_HEIGHT 128
/* Screen pixel format */ /* Screen pixel format */
#define PIX_FMT_RGB565 #define CONFIG_PIX_FMT_RGB565
/* Battery type */ /* Battery type */
#define BAT_LIPO_2S #define BAT_LIPO_2S
@ -62,7 +62,7 @@ extern "C" {
* pin and its frequency has to be low (~250Hz) to not put too much overehad on * pin and its frequency has to be low (~250Hz) to not put too much overehad on
* the processor due to timer ISR triggering at an high rate. * the processor due to timer ISR triggering at an high rate.
* *
* #define SCREEN_BRIGHTNESS * #define CONFIG_SCREEN_BRIGHTNESS
*/ */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -29,7 +29,7 @@
#include <interfaces/audio.h> #include <interfaces/audio.h>
#include <chSelector.h> #include <chSelector.h>
#ifdef SCREEN_BRIGHTNESS #ifdef CONFIG_SCREEN_BRIGHTNESS
#include <backlight.h> #include <backlight.h>
#endif #endif

View File

@ -26,15 +26,15 @@
#include "pinmap.h" #include "pinmap.h"
/* Screen dimensions */ /* Screen dimensions */
#define SCREEN_WIDTH 128 #define CONFIG_SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64 #define CONFIG_SCREEN_HEIGHT 64
/* Screen has adjustable contrast */ /* Screen has adjustable contrast */
#define SCREEN_CONTRAST #define CONFIG_SCREEN_CONTRAST
#define DEFAULT_CONTRAST 91 #define CONFIG_DEFAULT_CONTRAST 91
/* Screen pixel format */ /* Screen pixel format */
#define PIX_FMT_BW #define CONFIG_PIX_FMT_BW
/* Device has no battery */ /* Device has no battery */
#define BAT_NONE #define BAT_NONE

View File

@ -25,12 +25,12 @@
#include <stdint.h> #include <stdint.h>
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#ifndef SCREEN_WIDTH #ifndef CONFIG_SCREEN_WIDTH
#define SCREEN_WIDTH 160 #define CONFIG_SCREEN_WIDTH 160
#endif #endif
#ifndef SCREEN_HEIGHT #ifndef CONFIG_SCREEN_HEIGHT
#define SCREEN_HEIGHT 128 #define CONFIG_SCREEN_HEIGHT 128
#endif #endif
enum choices enum choices

View File

@ -289,16 +289,16 @@ void sdlEngine_init()
window = SDL_CreateWindow("OpenRTX", window = SDL_CreateWindow("OpenRTX",
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
SCREEN_WIDTH * 3, SCREEN_HEIGHT * 3, CONFIG_SCREEN_WIDTH * 3, CONFIG_SCREEN_HEIGHT * 3,
SDL_WINDOW_SHOWN ); SDL_WINDOW_SHOWN );
renderer = SDL_CreateRenderer(window, -1, 0); renderer = SDL_CreateRenderer(window, -1, 0);
SDL_RenderSetLogicalSize(renderer, SCREEN_WIDTH, SCREEN_HEIGHT); SDL_RenderSetLogicalSize(renderer, CONFIG_SCREEN_WIDTH, CONFIG_SCREEN_HEIGHT);
displayTexture = SDL_CreateTexture(renderer, displayTexture = SDL_CreateTexture(renderer,
PIXEL_FORMAT, PIXEL_FORMAT,
SDL_TEXTUREACCESS_STREAMING, SDL_TEXTUREACCESS_STREAMING,
SCREEN_WIDTH, CONFIG_SCREEN_WIDTH,
SCREEN_HEIGHT); CONFIG_SCREEN_HEIGHT);
SDL_RenderClear(renderer); SDL_RenderClear(renderer);
// Setting brightness also triggers a render // Setting brightness also triggers a render

View File

@ -26,15 +26,15 @@
* Screen dimensions, adjust basing on the size of the screen you need to * Screen dimensions, adjust basing on the size of the screen you need to
* emulate * emulate
*/ */
#ifndef SCREEN_WIDTH #ifndef CONFIG_SCREEN_WIDTH
#define SCREEN_WIDTH 160 #define CONFIG_SCREEN_WIDTH 160
#endif #endif
#ifndef SCREEN_HEIGHT #ifndef CONFIG_SCREEN_HEIGHT
#define SCREEN_HEIGHT 128 #define CONFIG_SCREEN_HEIGHT 128
#endif #endif
#ifdef PIX_FMT_RGB565 #ifdef CONFIG_PIX_FMT_RGB565
#define PIXEL_FORMAT SDL_PIXELFORMAT_RGB565 #define PIXEL_FORMAT SDL_PIXELFORMAT_RGB565
#define PIXEL_SIZE uint16_t #define PIXEL_SIZE uint16_t
#else #else

View File

@ -23,7 +23,7 @@ extern "C" {
#endif #endif
/* Screen has adjustable brightness */ /* Screen has adjustable brightness */
#define SCREEN_BRIGHTNESS #define CONFIG_SCREEN_BRIGHTNESS
/* Battery type */ /* Battery type */
#define BAT_LIPO_2S #define BAT_LIPO_2S

View File

@ -35,4 +35,4 @@ target_include_directories(app
${OPENRTX_ROOT}/subprojects/XPowersLib/src/REG ${OPENRTX_ROOT}/subprojects/XPowersLib/src/REG
) )
target_compile_definitions(app PRIVATE PLATFORM_TTWRPLUS SCREEN_BRIGHTNESS UI_NO_KEYBOARD) target_compile_definitions(app PRIVATE PLATFORM_TTWRPLUS CONFIG_SCREEN_BRIGHTNESS UI_NO_KEYBOARD)

View File

@ -26,9 +26,9 @@
* Display properties are encoded in the devicetree * Display properties are encoded in the devicetree
*/ */
#define DISPLAY DT_CHOSEN(zephyr_display) #define DISPLAY DT_CHOSEN(zephyr_display)
#define SCREEN_WIDTH DT_PROP(DISPLAY, width) #define CONFIG_SCREEN_WIDTH DT_PROP(DISPLAY, width)
#define SCREEN_HEIGHT DT_PROP(DISPLAY, height) #define CONFIG_SCREEN_HEIGHT DT_PROP(DISPLAY, height)
#define PIX_FMT_BW #define CONFIG_PIX_FMT_BW
#define GPS_PRESENT #define GPS_PRESENT
#define BAT_LIPO_1S #define BAT_LIPO_1S