mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
neutrino: add support for CST new simple frontpanel with LED segment display. (c) focus and adjusted by me.
Conflicts: src/daemonc/remotecontrol.cpp src/gui/channellist.cpp
This commit is contained in:
@@ -62,17 +62,54 @@ CVFD::CVFD()
|
||||
m_progressLocal = 0;
|
||||
#endif // VFD_UPDATE
|
||||
|
||||
has_lcd = 1;
|
||||
has_lcd = true;
|
||||
has_led_segment = false;
|
||||
fd = open("/dev/display", O_RDONLY);
|
||||
if(fd < 0) {
|
||||
perror("/dev/display");
|
||||
has_lcd = 0;
|
||||
has_lcd = false;
|
||||
has_led_segment = false;
|
||||
}
|
||||
|
||||
#ifdef BOXMODEL_APOLLO
|
||||
if (fd >= 0) {
|
||||
int ret = ioctl(fd, IOC_FP_GET_DISPLAY_CAPS, &caps);
|
||||
if (ret < 0) {
|
||||
perror("IOC_FP_GET_DISPLAY_CAPS");
|
||||
printf("VFD: please update driver!\n");
|
||||
support_text = true;
|
||||
support_numbers = true;
|
||||
} else {
|
||||
switch (caps.display_type) {
|
||||
case FP_DISPLAY_TYPE_NONE:
|
||||
has_lcd = false;
|
||||
has_led_segment = false;
|
||||
break;
|
||||
case FP_DISPLAY_TYPE_LED_SEGMENT:
|
||||
has_lcd = false;
|
||||
has_led_segment = true;
|
||||
break;
|
||||
default:
|
||||
has_lcd = true;
|
||||
has_led_segment = false;
|
||||
break;
|
||||
}
|
||||
support_text = (caps.display_type != FP_DISPLAY_TYPE_LED_SEGMENT &&
|
||||
caps.text_support != FP_DISPLAY_TEXT_NONE);
|
||||
support_numbers = caps.number_support;
|
||||
}
|
||||
}
|
||||
#else
|
||||
support_text = true;
|
||||
support_numbers = true;
|
||||
#endif
|
||||
|
||||
text[0] = 0;
|
||||
clearClock = 0;
|
||||
mode = MODE_TVRADIO;
|
||||
switch_name_time_cnt = 0;
|
||||
timeout_cnt = 0;
|
||||
service_number = -1;
|
||||
}
|
||||
|
||||
CVFD::~CVFD()
|
||||
@@ -117,7 +154,8 @@ void CVFD::count_down() {
|
||||
}
|
||||
|
||||
void CVFD::wake_up() {
|
||||
if(!has_lcd) return;
|
||||
if(fd < 0) return;
|
||||
|
||||
if (atoi(g_settings.lcd_setting_dim_time.c_str()) > 0) {
|
||||
timeout_cnt = atoi(g_settings.lcd_setting_dim_time.c_str());
|
||||
g_settings.lcd_setting_dim_brightness > -1 ?
|
||||
@@ -128,6 +166,7 @@ void CVFD::wake_up() {
|
||||
if(g_settings.lcd_info_line){
|
||||
switch_name_time_cnt = g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR] + 10;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void* CVFD::TimeThread(void *)
|
||||
@@ -159,7 +198,7 @@ void CVFD::init(const char * /*fontfile*/, const char * /*fontname*/)
|
||||
|
||||
void CVFD::setlcdparameter(int dimm, const int power)
|
||||
{
|
||||
if(!has_lcd) return;
|
||||
if(fd < 0) return;
|
||||
|
||||
if(dimm < 0)
|
||||
dimm = 0;
|
||||
@@ -182,13 +221,14 @@ printf("CVFD::setlcdparameter dimm %d power %d\n", dimm, power);
|
||||
|
||||
void CVFD::setlcdparameter(void)
|
||||
{
|
||||
if(!has_lcd) return;
|
||||
if(fd < 0) return;
|
||||
last_toggle_state_power = g_settings.lcd_setting[SNeutrinoSettings::LCD_POWER];
|
||||
setlcdparameter((mode == MODE_STANDBY) ? g_settings.lcd_setting[SNeutrinoSettings::LCD_STANDBY_BRIGHTNESS] : (mode == MODE_SHUTDOWN) ? g_settings.lcd_setting[SNeutrinoSettings::LCD_DEEPSTANDBY_BRIGHTNESS] : g_settings.lcd_setting[SNeutrinoSettings::LCD_BRIGHTNESS],
|
||||
last_toggle_state_power);
|
||||
}
|
||||
|
||||
void CVFD::setled(int led1, int led2){
|
||||
void CVFD::setled(int led1, int led2)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
if(led1 != -1){
|
||||
@@ -220,40 +260,43 @@ void CVFD::setled(bool on_off)
|
||||
|
||||
int led1 = -1, led2 = -1;
|
||||
if(on_off){//on
|
||||
switch(g_settings.led_rec_mode){
|
||||
switch(g_settings.led_rec_mode) {
|
||||
case 1:
|
||||
led1 = FP_LED_1_ON; led2 = FP_LED_2_ON;
|
||||
break;
|
||||
led1 = FP_LED_1_ON; led2 = FP_LED_2_ON;
|
||||
break;
|
||||
case 2:
|
||||
led1 = FP_LED_1_ON;
|
||||
break;
|
||||
led1 = FP_LED_1_ON;
|
||||
break;
|
||||
case 3:
|
||||
led2 = FP_LED_2_ON;
|
||||
break;
|
||||
led2 = FP_LED_2_ON;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {//off
|
||||
switch(g_settings.led_rec_mode){
|
||||
break;
|
||||
switch(g_settings.led_rec_mode) {
|
||||
case 1:
|
||||
led1 = FP_LED_1_OFF; led2 = FP_LED_2_OFF;
|
||||
break;
|
||||
case 2:
|
||||
led1 = FP_LED_1_OFF;
|
||||
break;
|
||||
led1 = FP_LED_1_OFF;
|
||||
break;
|
||||
case 3:
|
||||
led2 = FP_LED_2_OFF;
|
||||
break;
|
||||
led2 = FP_LED_2_OFF;
|
||||
break;
|
||||
default:
|
||||
led1 = FP_LED_1_OFF; led2 = FP_LED_2_OFF;
|
||||
break;
|
||||
led1 = FP_LED_1_OFF; led2 = FP_LED_2_OFF;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
setled(led1, led2);
|
||||
}
|
||||
|
||||
void CVFD::setled(void)
|
||||
{
|
||||
if(!has_lcd) return;
|
||||
if(fd < 0) return;
|
||||
|
||||
int led1 = -1, led2 = -1;
|
||||
int select = 0;
|
||||
@@ -265,33 +308,38 @@ void CVFD::setled(void)
|
||||
|
||||
switch(select){
|
||||
case 0:
|
||||
led1 = FP_LED_1_OFF; led2 = FP_LED_2_OFF;
|
||||
break;
|
||||
led1 = FP_LED_1_OFF; led2 = FP_LED_2_OFF;
|
||||
break;
|
||||
case 1:
|
||||
led1 = FP_LED_1_ON; led2 = FP_LED_2_ON;
|
||||
break;
|
||||
led1 = FP_LED_1_ON; led2 = FP_LED_2_ON;
|
||||
break;
|
||||
case 2:
|
||||
led1 = FP_LED_1_ON; led2 = FP_LED_2_OFF;
|
||||
break;
|
||||
led1 = FP_LED_1_ON; led2 = FP_LED_2_OFF;
|
||||
break;
|
||||
case 3:
|
||||
led1 = FP_LED_1_OFF; led2 = FP_LED_2_ON;
|
||||
break;
|
||||
led1 = FP_LED_1_OFF; led2 = FP_LED_2_ON;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
setled(led1, led2);
|
||||
}
|
||||
|
||||
void CVFD::showServicename(const std::string & name) // UTF-8
|
||||
void CVFD::showServicename(const std::string & name, int number) // UTF-8
|
||||
{
|
||||
if(!has_lcd) return;
|
||||
if(fd < 0) return;
|
||||
|
||||
printf("CVFD::showServicename: %s\n", name.c_str());
|
||||
servicename = name;
|
||||
service_number = number;
|
||||
|
||||
if (mode != MODE_TVRADIO)
|
||||
return;
|
||||
|
||||
ShowText(name.c_str());
|
||||
if (support_text)
|
||||
ShowText(name.c_str());
|
||||
else
|
||||
ShowNumber(service_number);
|
||||
wake_up();
|
||||
}
|
||||
|
||||
@@ -303,11 +351,11 @@ void CVFD::showTime(bool force)
|
||||
if(!has_lcd)
|
||||
return;
|
||||
#endif
|
||||
if(has_lcd && mode == MODE_SHUTDOWN) {
|
||||
if(fd >= 0 && mode == MODE_SHUTDOWN) {
|
||||
ShowIcon(FP_ICON_CAM1, false);
|
||||
return;
|
||||
}
|
||||
if (has_lcd && showclock) {
|
||||
if (fd >= 0 && showclock) {
|
||||
if (mode == MODE_STANDBY || ( g_settings.lcd_info_line && (MODE_TVRADIO == mode))) {
|
||||
char timestr[21];
|
||||
struct timeb tm;
|
||||
@@ -319,8 +367,14 @@ void CVFD::showTime(bool force)
|
||||
if(force || ( switch_name_time_cnt == 0 && ((hour != t->tm_hour) || (minute != t->tm_min))) ) {
|
||||
hour = t->tm_hour;
|
||||
minute = t->tm_min;
|
||||
strftime(timestr, 20, "%H:%M", t);
|
||||
ShowText(timestr);
|
||||
if (support_text) {
|
||||
strftime(timestr, 20, "%H:%M", t);
|
||||
ShowText(timestr);
|
||||
} else if (support_numbers && has_led_segment) {
|
||||
ShowNumber((t->tm_hour*100) + t->tm_min);
|
||||
if (fd >= 0)
|
||||
ioctl(fd, IOC_FP_SET_COLON, 0x01);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -342,8 +396,10 @@ void CVFD::showTime(bool force)
|
||||
clearClock = 0;
|
||||
if(has_lcd)
|
||||
ShowIcon(FP_ICON_CAM1, false);
|
||||
|
||||
setled();
|
||||
}
|
||||
|
||||
recstatus = tmp_recstatus;
|
||||
}
|
||||
|
||||
@@ -419,7 +475,7 @@ void CVFD::showPercentOver(const unsigned char perc, const bool /*perform_update
|
||||
|
||||
void CVFD::showMenuText(const int /*position*/, const char * ptext, const int /*highlight*/, const bool /*utf_encoded*/)
|
||||
{
|
||||
if(!has_lcd) return;
|
||||
if(fd < 0) return;
|
||||
if (mode != MODE_MENU_UTF8)
|
||||
return;
|
||||
|
||||
@@ -429,7 +485,7 @@ void CVFD::showMenuText(const int /*position*/, const char * ptext, const int /*
|
||||
|
||||
void CVFD::showAudioTrack(const std::string & /*artist*/, const std::string & title, const std::string & /*album*/)
|
||||
{
|
||||
if(!has_lcd) return;
|
||||
if(fd < 0) return;
|
||||
if (mode != MODE_AUDIO)
|
||||
return;
|
||||
printf("CVFD::showAudioTrack: %s\n", title.c_str());
|
||||
@@ -445,7 +501,8 @@ printf("CVFD::showAudioTrack: %s\n", title.c_str());
|
||||
|
||||
void CVFD::showAudioPlayMode(AUDIOMODES m)
|
||||
{
|
||||
if(!has_lcd) return;
|
||||
if(fd < 0) return;
|
||||
|
||||
switch(m) {
|
||||
case AUDIO_MODE_PLAY:
|
||||
ShowIcon(FP_ICON_PLAY, true);
|
||||
@@ -487,7 +544,11 @@ void CVFD::showAudioProgress(const char /*perc*/, bool /*isMuted*/)
|
||||
|
||||
void CVFD::setMode(const MODES m, const char * const title)
|
||||
{
|
||||
if(!has_lcd) return;
|
||||
if(fd < 0) return;
|
||||
|
||||
// Clear colon in display if it is still there
|
||||
if (support_numbers && has_led_segment)
|
||||
ioctl(fd, IOC_FP_SET_COLON, 0x00);
|
||||
|
||||
if(mode == MODE_AUDIO)
|
||||
ShowIcon(FP_ICON_MP3, false);
|
||||
@@ -584,7 +645,7 @@ void CVFD::setMode(const MODES m, const char * const title)
|
||||
|
||||
void CVFD::setBrightness(int bright)
|
||||
{
|
||||
if(!has_lcd) return;
|
||||
if(!has_lcd && !has_led_segment) return;
|
||||
|
||||
g_settings.lcd_setting[SNeutrinoSettings::LCD_BRIGHTNESS] = bright;
|
||||
setlcdparameter();
|
||||
@@ -601,7 +662,7 @@ int CVFD::getBrightness()
|
||||
|
||||
void CVFD::setBrightnessStandby(int bright)
|
||||
{
|
||||
if(!has_lcd) return;
|
||||
if(!has_lcd && !has_led_segment) return;
|
||||
|
||||
g_settings.lcd_setting[SNeutrinoSettings::LCD_STANDBY_BRIGHTNESS] = bright;
|
||||
setlcdparameter();
|
||||
@@ -617,7 +678,7 @@ int CVFD::getBrightnessStandby()
|
||||
|
||||
void CVFD::setBrightnessDeepStandby(int bright)
|
||||
{
|
||||
if(!has_lcd) return;
|
||||
if(!has_lcd && !has_led_segment) return;
|
||||
|
||||
g_settings.lcd_setting[SNeutrinoSettings::LCD_DEEPSTANDBY_BRIGHTNESS] = bright;
|
||||
setlcdparameter();
|
||||
@@ -646,7 +707,7 @@ int CVFD::getPower()
|
||||
|
||||
void CVFD::togglePower(void)
|
||||
{
|
||||
if(!has_lcd) return;
|
||||
if(fd < 0) return;
|
||||
|
||||
last_toggle_state_power = 1 - last_toggle_state_power;
|
||||
setlcdparameter((mode == MODE_STANDBY) ? g_settings.lcd_setting[SNeutrinoSettings::LCD_STANDBY_BRIGHTNESS] : (mode == MODE_SHUTDOWN) ? g_settings.lcd_setting[SNeutrinoSettings::LCD_DEEPSTANDBY_BRIGHTNESS] : g_settings.lcd_setting[SNeutrinoSettings::LCD_BRIGHTNESS],
|
||||
@@ -672,19 +733,19 @@ void CVFD::pause()
|
||||
|
||||
void CVFD::Lock()
|
||||
{
|
||||
if(!has_lcd) return;
|
||||
if(fd < 0) return;
|
||||
creat("/tmp/vfd.locked", 0);
|
||||
}
|
||||
|
||||
void CVFD::Unlock()
|
||||
{
|
||||
if(!has_lcd) return;
|
||||
if(fd < 0) return;
|
||||
unlink("/tmp/vfd.locked");
|
||||
}
|
||||
|
||||
void CVFD::Clear()
|
||||
{
|
||||
if(!has_lcd) return;
|
||||
if(fd < 0) return;
|
||||
int ret = ioctl(fd, IOC_FP_CLEAR_ALL, 0);
|
||||
if(ret < 0)
|
||||
perror("IOC_FP_SET_TEXT");
|
||||
@@ -703,6 +764,9 @@ void CVFD::ShowIcon(fp_icon icon, bool show)
|
||||
|
||||
void CVFD::ShowText(const char * str)
|
||||
{
|
||||
if (fd < 0 || !support_text)
|
||||
return;
|
||||
|
||||
char flags[2] = { FP_FLAG_ALIGN_LEFT, 0 };
|
||||
|
||||
if (g_settings.lcd_scroll)
|
||||
@@ -718,11 +782,29 @@ void CVFD::ShowText(const char * str)
|
||||
|
||||
text = txt;
|
||||
int ret = ioctl(fd, IOC_FP_SET_TEXT, len > 1 ? txt.c_str() : NULL);
|
||||
if(ret < 0)
|
||||
if(ret < 0) {
|
||||
support_text = false;
|
||||
perror("IOC_FP_SET_TEXT");
|
||||
}
|
||||
}
|
||||
|
||||
void CVFD::ShowNumber(int number)
|
||||
{
|
||||
if (fd < 0 || (!support_text && !support_numbers))
|
||||
return;
|
||||
|
||||
if (number < 0)
|
||||
return;
|
||||
|
||||
int ret = ioctl(fd, IOC_FP_SET_NUMBER, number);
|
||||
if(ret < 0) {
|
||||
support_numbers = false;
|
||||
perror("IOC_FP_SET_NUMBER");
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef VFD_UPDATE
|
||||
|
||||
/*****************************************************************************************/
|
||||
// showInfoBox
|
||||
/*****************************************************************************************/
|
||||
|
Reference in New Issue
Block a user