make driver selectable for graphlcd

Conflicts:
	data/locale/deutsch.locale
	data/locale/english.locale
	src/driver/nglcd.h
	src/gui/glcdsetup.cpp
	src/gui/glcdsetup.h
	src/neutrino.cpp
	src/system/locals.h
	src/system/locals_intern.h
	src/system/settings.h

Signed-off-by: Thilo Graf <dbt@novatux.de>

compile fixed
This commit is contained in:
TangoCash
2019-12-29 23:46:52 +01:00
committed by Thilo Graf
parent 3fd2d5011f
commit efe45e9b7a
10 changed files with 68 additions and 1 deletions

View File

@@ -562,7 +562,11 @@ void nGLCD::Run(void)
break;
int warmUp = 10;
lcd = GLCD::CreateDriver(GLCD::Config.driverConfigs[0].id, &GLCD::Config.driverConfigs[0]);
if ((g_settings.glcd_selected_config < 0) || (g_settings.glcd_selected_config > GetConfigSize() - 1))
g_settings.glcd_selected_config = 0;
lcd = GLCD::CreateDriver(GLCD::Config.driverConfigs[g_settings.glcd_selected_config].id, &GLCD::Config.driverConfigs[g_settings.glcd_selected_config]);
if (!lcd) {
#ifdef GLCD_DEBUG
fprintf(stderr, "CreateDriver failed.\n");
@@ -959,3 +963,14 @@ int nGLCD::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t /* data */)
return messages_return::unhandled;
}
int nGLCD::GetConfigSize()
{
return (int) GLCD::Config.driverConfigs.size();
}
std::string nGLCD::GetConfigName(int driver)
{
if ((driver < 0) || (driver > GetConfigSize() - 1))
driver = 0;
return GLCD::Config.driverConfigs[driver].name;
}

View File

@@ -130,6 +130,8 @@ class nGLCD
static void Exit();
static void Blit();
static void SetBrightness(unsigned int b);
int GetConfigSize();
std::string GetConfigName(int);
void UpdateBrightness();
int handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data);
};