- move oled data to one single place in data/oled

Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
svenhoefer
2020-06-21 17:39:51 +02:00
committed by Thilo Graf
parent e947d53eba
commit 3e6bab00d8
58 changed files with 53 additions and 92 deletions

View File

@@ -320,7 +320,7 @@ void cGLCD::Exec()
g_PicViewer->getSize(Logo.c_str(), &icon_start_width, &icon_start_height);
if (g_settings.glcd_show_logo && percent_logo &&
showImage(channel_id, Channel, 0, t.glcd_channel_x_position, t.glcd_channel_y_position, percent_logo * bitmap->Height()/100, true, false)) {
showImage(channel_id, Channel, t.glcd_channel_x_position, t.glcd_channel_y_position, bitmap->Width() - 4, percent_logo * bitmap->Height()/100, true, false)) {
doScrollChannel = false;
scrollChannelSkip = 0;
} else if (percent_logo && icon_start_width && icon_start_height &&
@@ -634,8 +634,8 @@ void cGLCD::updateFonts()
if (!fonts_initialized || (fontsize_smalltext_new != fontsize_smalltext)) {
fontsize_smalltext = fontsize_smalltext_new;
if (!font_smalltext.LoadFT2(/*t.glcd_font*/FONTDIR "/lcd.ttf", "UTF-8", fontsize_smalltext)) {
t.glcd_font = FONTDIR "/lcd.ttf";
if (!font_smalltext.LoadFT2(FONTDIR "/oled/terminator.ttf", "UTF-8", fontsize_smalltext)) {
t.glcd_font = FONTDIR "/neutrino.ttf";
font_smalltext.LoadFT2(t.glcd_font, "UTF-8", fontsize_smalltext);
}
}

View File

@@ -1,5 +1,5 @@
/*
simple clock - DBoxII-Project
lcd clock - DBoxII-Project
Copyright (C) 2018 redblue
@@ -31,7 +31,7 @@
static bool fonts_initialized = false;
GLCD::cFont font_time_standby_second;
GLCD::cFont lcd_font_time_standby;
void InitLcdClock(void)
{
@@ -47,9 +47,8 @@ void LcdClockUpdateFonts(void)
int fontsize_time_standby_new = percent_time_standby * cglcd->lcd->Height() / 100;
if (!fonts_initialized || (fontsize_time_standby_new != fontsize_time_standby)) {
fontsize_time_standby = fontsize_time_standby_new;
if (!font_time_standby_second.LoadFT2(/*t.glcd_font*/FONTDIR "/lcd.ttf", "UTF-8", fontsize_time_standby)) {
t.glcd_font = FONTDIR "/lcd.ttf";
font_time_standby_second.LoadFT2(t.glcd_font, "UTF-8", fontsize_time_standby);
if (!lcd_font_time_standby.LoadFT2(FONTDIR "/oled/lcd.ttf", "UTF-8", fontsize_time_standby)) {
lcd_font_time_standby.LoadFT2(FONTDIR "/neutrino.ttf", "UTF-8", fontsize_time_standby);
}
}
fonts_initialized = true;
@@ -57,18 +56,19 @@ void LcdClockUpdateFonts(void)
void RenderLcdClock(std::string Time, int x, int y)
{
(void) x;
cGLCD *cglcd = cGLCD::getInstance();
SNeutrinoGlcdTheme &t = g_settings.glcd_theme;
LcdClockUpdateFonts();
cglcd->bitmap->DrawText(std::max(2,(cglcd->bitmap->Width() - 4 - font_time_standby_second.Width(Time))/2),
cglcd->bitmap->DrawText(std::max(2,(cglcd->bitmap->Width() - 4 - lcd_font_time_standby.Width(Time))/2),
y, cglcd->bitmap->Width() - 1, Time,
&font_time_standby_second, cglcd->ColorConvert3to1(t.glcd_color_fg_red, t.glcd_color_fg_green, t.glcd_color_fg_blue), GLCD::cColor::Transparent);
&lcd_font_time_standby, cglcd->ColorConvert3to1(t.glcd_color_fg_red, t.glcd_color_fg_green, t.glcd_color_fg_blue), GLCD::cColor::Transparent);
}
void ShowLcdClock(std::string Time)
{
cGLCD *cglcd = cGLCD::getInstance();
SNeutrinoGlcdTheme &t = g_settings.glcd_theme;
int y = g_settings.glcd_standby_weather ? t.glcd_simple_clock_y_position : (cglcd->bitmap->Height() - font_time_standby_second.Height(Time)) / 2;
int y = g_settings.glcd_standby_weather ? t.glcd_simple_clock_y_position : (cglcd->bitmap->Height() - lcd_font_time_standby.Height(Time)) / 2;
RenderLcdClock(Time, 255, y);
}

View File

@@ -1,5 +1,5 @@
/*
simple clock - DBoxII-Project
led clock - DBoxII-Project
Copyright (C) 2018 redblue
@@ -31,7 +31,7 @@
static bool fonts_initialized = false;
GLCD::cFont second_font_time_standby;
GLCD::cFont led_font_time_standby;
void InitLedClock(void)
{
@@ -47,9 +47,8 @@ void LedClockUpdateFonts(void)
int fontsize_time_standby_new = percent_time_standby * cglcd->lcd->Height() / 100;
if (!fonts_initialized || (fontsize_time_standby_new != fontsize_time_standby)) {
fontsize_time_standby = fontsize_time_standby_new;
if (!second_font_time_standby.LoadFT2(/*t.glcd_font*/FONTDIR "/led.ttf", "UTF-8", fontsize_time_standby)) {
t.glcd_font = FONTDIR "/led.ttf";
second_font_time_standby.LoadFT2(t.glcd_font, "UTF-8", fontsize_time_standby);
if (!led_font_time_standby.LoadFT2(FONTDIR "/oled/led.ttf", "UTF-8", fontsize_time_standby)) {
led_font_time_standby.LoadFT2(FONTDIR "/neutrino.ttf", "UTF-8", fontsize_time_standby);
}
}
fonts_initialized = true;
@@ -57,18 +56,19 @@ void LedClockUpdateFonts(void)
void RenderLedClock(std::string Time, int x, int y)
{
(void) x;
cGLCD *cglcd = cGLCD::getInstance();
SNeutrinoGlcdTheme &t = g_settings.glcd_theme;
LedClockUpdateFonts();
cglcd->bitmap->DrawText(std::max(2,(cglcd->bitmap->Width() - 4 - second_font_time_standby.Width(Time))/2),
cglcd->bitmap->DrawText(std::max(2,(cglcd->bitmap->Width() - 4 - led_font_time_standby.Width(Time))/2),
y, cglcd->bitmap->Width() - 1, Time,
&second_font_time_standby, cglcd->ColorConvert3to1(t.glcd_color_fg_red, t.glcd_color_fg_green, t.glcd_color_fg_blue), GLCD::cColor::Transparent);
&led_font_time_standby, cglcd->ColorConvert3to1(t.glcd_color_fg_red, t.glcd_color_fg_green, t.glcd_color_fg_blue), GLCD::cColor::Transparent);
}
void ShowLedClock(std::string Time)
{
cGLCD *cglcd = cGLCD::getInstance();
SNeutrinoGlcdTheme &t = g_settings.glcd_theme;
int y = g_settings.glcd_standby_weather ? t.glcd_simple_clock_y_position : (cglcd->bitmap->Height() - second_font_time_standby.Height(Time)) / 2;
int y = g_settings.glcd_standby_weather ? t.glcd_simple_clock_y_position : (cglcd->bitmap->Height() - led_font_time_standby.Height(Time)) / 2;
RenderLedClock(Time, 255, y);
}