glcd: remove unnecessary defines; count arrays automatically; fix path to icons

Origin commit data
------------------
Branch: ni/coolstream
Commit: ba17126f8e
Author: vanhofen <vanhofen@gmx.de>
Date: 2020-06-23 (Tue, 23 Jun 2020)

Origin message was:
------------------
- glcd: remove unnecessary defines; count arrays automatically; fix path to icons

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2020-06-23 01:05:35 +02:00
parent 529b217443
commit f2174ab04a
6 changed files with 24 additions and 33 deletions

View File

@@ -38,28 +38,29 @@ enum files
ANALOG_MIN = 2 ANALOG_MIN = 2
}; };
const char * const file_name[LCD_NUMBER_OF_FILES] = const char * const file_name[] =
{ {
"analog_clock", "analog_clock",
"analog_hour", "analog_hour",
"analog_min" "analog_min"
}; };
#define LCD_NUMBER_OF_FILES (sizeof(file_name)/sizeof(file_name[0]))
#define NUMBER_OF_PATHS 2 const char * const file_path[] =
const char * const file_path[NUMBER_OF_PATHS] =
{ {
LCDDIR_VAR "/oled/clock/", ICONSDIR "/oled/clock/",
DATADIR "/oled/clock/" ICONSDIR_VAR "/oled/clock/"
}; };
#define NUMBER_OF_PATHS (sizeof(file_path)/sizeof(file_path[0]))
static std::string file[LCD_NUMBER_OF_FILES] = {""}; static std::string file[LCD_NUMBER_OF_FILES] = {""};
void InitAnalogClock(void) void InitAnalogClock(void)
{ {
for (int i = 0; i < LCD_NUMBER_OF_FILES; i++) for (unsigned int i = 0; i < LCD_NUMBER_OF_FILES; i++)
{ {
std::string tmp_file; std::string tmp_file;
for (int j = 0; j < NUMBER_OF_PATHS; j++) for (unsigned int j = 0; j < NUMBER_OF_PATHS; j++)
{ {
std::string file_jpg = file_path[j]; std::string file_jpg = file_path[j];
file_jpg += file_name[i]; file_jpg += file_name[i];

View File

@@ -25,10 +25,6 @@
#include "glcd.h" #include "glcd.h"
#define LCDDIR_VAR "/usr/share/tuxbox/neutrino/icons"
#define LCD_NUMBER_OF_FILES 3
void InitAnalogClock(); void InitAnalogClock();
void RenderClock(int x, int y); void RenderClock(int x, int y);
void RenderHands(int hour, int min, int sec, int posx, int posy, int hour_size, int min_size, int sec_size); void RenderHands(int hour, int min, int sec, int posx, int posy, int hour_size, int min_size, int sec_size);

View File

@@ -47,7 +47,7 @@ enum digits
TIME_DOTS = 10 TIME_DOTS = 10
}; };
const char * const digit_name[LCD_NUMBER_OF_DIGITS] = const char * const digit_name[] =
{ {
"time_zero", "time_zero",
"time_one", "time_one",
@@ -61,22 +61,23 @@ const char * const digit_name[LCD_NUMBER_OF_DIGITS] =
"time_nine", "time_nine",
"time_dots" "time_dots"
}; };
#define LCD_NUMBER_OF_DIGITS (sizeof(digit_name)/sizeof(digit_name[0]))
#define NUMBER_OF_PATHS 2 const char * const digit_path[] =
const char * const digit_path[NUMBER_OF_PATHS] =
{ {
LCDDIR_VAR "/oled/clock/", ICONSDIR "/oled/clock/",
DATADIR "/oled/clock/" ICONSDIR_VAR "/oled/clock/"
}; };
#define NUMBER_OF_PATHS (sizeof(digit_path)/sizeof(digit_path[0]))
static std::string digit[LCD_NUMBER_OF_DIGITS] = {""}; static std::string digit[LCD_NUMBER_OF_DIGITS] = {""};
void InitDigitalClock(void) void InitDigitalClock(void)
{ {
for (int i = 0; i < LCD_NUMBER_OF_DIGITS; i++) for (unsigned int i = 0; i < LCD_NUMBER_OF_DIGITS; i++)
{ {
std::string digit_file; std::string digit_file;
for (int j = 0; j < NUMBER_OF_PATHS; j++) for (unsigned int j = 0; j < NUMBER_OF_PATHS; j++)
{ {
std::string file_jpg = digit_path[j]; std::string file_jpg = digit_path[j];
file_jpg += digit_name[i]; file_jpg += digit_name[i];

View File

@@ -28,10 +28,6 @@
#pragma GCC diagnostic warning "-Wunused-parameter" #pragma GCC diagnostic warning "-Wunused-parameter"
#include "glcd.h" #include "glcd.h"
#define LCDDIR_VAR "/usr/share/tuxbox/neutrino/icons"
#define LCD_NUMBER_OF_DIGITS 11
void InitDigitalClock(); void InitDigitalClock();
void RenderTimeDigit(int _digit, int x, int y); void RenderTimeDigit(int _digit, int x, int y);
void RenderDots(int x, int y); void RenderDots(int x, int y);

View File

@@ -42,7 +42,7 @@ enum weathers
//WEATHER_UNKNOWN = 10 //WEATHER_UNKNOWN = 10
}; };
const char * const weather_name[LCD_NUMBER_OF_WEATHERS] = const char * const weather_name[] =
{ {
"clear-day", "clear-day",
"clear-night", "clear-night",
@@ -56,13 +56,14 @@ const char * const weather_name[LCD_NUMBER_OF_WEATHERS] =
"wind", "wind",
//"unknown" //"unknown"
}; };
#define LCD_NUMBER_OF_WEATHERS (sizeof(weather_name)/sizeof(weather_name[0]))
#define NUMBER_OF_PATHS 2 const char * const weather_path[] =
const char * const weather_path[NUMBER_OF_PATHS] =
{ {
LCDDIR_VAR "/oled/weather/", ICONSDIR "/oled/weather/",
DATADIR "/oled/weather/" ICONSDIR_VAR "/oled/weather/"
}; };
#define NUMBER_OF_PATHS (sizeof(weather_path)/sizeof(weather_path[0]))
static bool ForceUpdate = true; static bool ForceUpdate = true;
static bool fonts_initialized = false; static bool fonts_initialized = false;
@@ -85,10 +86,10 @@ static std::string st_next_wicon = "";
void InitWeather(void) void InitWeather(void)
{ {
for (int i = 0; i < LCD_NUMBER_OF_WEATHERS; i++) for (unsigned int i = 0; i < LCD_NUMBER_OF_WEATHERS; i++)
{ {
std::string weather_file; std::string weather_file;
for (int j = 0; j < NUMBER_OF_PATHS; j++) for (unsigned int j = 0; j < NUMBER_OF_PATHS; j++)
{ {
std::string file_jpg = weather_path[j]; std::string file_jpg = weather_path[j];
file_jpg += weather_name[i]; file_jpg += weather_name[i];

View File

@@ -28,10 +28,6 @@
#pragma GCC diagnostic warning "-Wunused-parameter" #pragma GCC diagnostic warning "-Wunused-parameter"
#include "glcd.h" #include "glcd.h"
#define LCDDIR_VAR "/usr/share/tuxbox/neutrino/icons"
#define LCD_NUMBER_OF_WEATHERS 10
void InitWeather(); void InitWeather();
void WeatherUpdateFonts(); void WeatherUpdateFonts();
int WeatherNameToNumber(std::string name); int WeatherNameToNumber(std::string name);