glcd: re-add driver selection

Origin commit data
------------------
Branch: ni/coolstream
Commit: 8605be5228
Author: vanhofen <vanhofen@gmx.de>
Date: 2020-06-22 (Mon, 22 Jun 2020)

Origin message was:
------------------
- glcd: re-add driver selection

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

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2020-06-22 10:07:31 +02:00
parent 7c72a6dea2
commit e7725c8b01
4 changed files with 52 additions and 3 deletions

View File

@@ -786,7 +786,11 @@ void cGLCD::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");
@@ -1705,3 +1709,14 @@ int cGLCD::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t /* data */)
return messages_return::unhandled;
}
int cGLCD::GetConfigSize()
{
return (int) GLCD::Config.driverConfigs.size();
}
std::string cGLCD::GetConfigName(int driver)
{
if ((driver < 0) || (driver > GetConfigSize() - 1))
driver = 0;
return GLCD::Config.driverConfigs[driver].name;
}