- vfd: cleanup from unsupported hardware ifdefs; vfd.cpp/h is only used by COOL_HARDWARE

Conflicts:
	src/driver/vfd.cpp

Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
svenhoefer
2017-11-07 21:38:58 +01:00
committed by Thilo Graf
parent 868f6184ae
commit 62843ec241
2 changed files with 16 additions and 547 deletions

View File

@@ -47,222 +47,8 @@
#include <cs_api.h>
extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */
#ifdef HAVE_DUCKBOX_HARDWARE
#include <zapit/zapit.h>
#include <stropts.h>
#define VFD_DEVICE "/dev/vfd"
#if defined (BOXMODEL_OCTAGON1008) || defined (BOXMODEL_TF7700)
#define VFDLENGTH 8
#elif defined (BOXMODEL_FORTIS_HDBOX) || defined (BOXMODEL_ATEVIO7500)
#define VFDLENGTH 12
#elif defined (BOXMODEL_HS7810A) || defined (BOXMODEL_HS7119) || defined (BOXMODEL_HS7819) || defined (BOXMODEL_CUBEREVO_250HD) || defined (BOXMODEL_IPBOX55)
#define VFDLENGTH 4
#elif defined (BOXMODEL_HS7110)
#define VFDLENGTH 0
#elif defined (BOXMODEL_IPBOX9900) || defined (BOXMODEL_IPBOX99)
#define VFDLENGTH 14
#else
#define VFDLENGTH 16
#endif
#define SCROLL_TIME 100000
bool invert = false;
bool blocked = false;
int blocked_counter = 0;
int file_vfd = -1;
bool active_icon[16] = { false };
pthread_t vfd_scrollText;
struct vfd_ioctl_data {
unsigned char start;
unsigned char data[64];
unsigned char length;
};
static void write_to_vfd(unsigned int DevType, struct vfd_ioctl_data * data, bool force = false)
{
int file_closed = 0;
if (blocked) {
if (file_vfd > -1) {
blocked_counter++;
usleep(SCROLL_TIME);
} else {
blocked = false;
}
}
if (blocked_counter > 10) {
force = true;
blocked_counter = 0;
}
// printf("[CVFD] - blocked_counter=%i, blocked=%i, force=%i\n", blocked, blocked_counter, force);
if (force || !blocked) {
if (blocked) {
if (file_vfd > -1) {
file_closed = close(file_vfd);
file_vfd = -1;
}
}
blocked = true;
if (file_vfd == -1)
file_vfd = open (VFD_DEVICE, O_RDWR);
if (file_vfd > -1) {
ioctl(file_vfd, DevType, data);
ioctl(file_vfd, I_FLUSH, FLUSHRW);
file_closed = close(file_vfd);
file_vfd = -1;
}
blocked = false;
blocked_counter = 0;
}
}
#if defined (BOXMODEL_UFS910) || defined (BOXMODEL_UFS922)
static void writeCG (unsigned char adress, unsigned char pixeldata[5])
{
struct vfd_ioctl_data data;
data.start = adress & 0x07;
data.data[0] = pixeldata[0];
data.data[1] = pixeldata[1];
data.data[2] = pixeldata[2];
data.data[3] = pixeldata[3];
data.data[4] = pixeldata[4];
data.length = 5;
write_to_vfd(VFDWRITECGRAM, &data);
return;
}
#endif
static void ShowNormalText(char * str, bool fromScrollThread = false)
{
if (blocked)
{
printf("[CVFD] - blocked\n");
usleep(SCROLL_TIME);
}
int ws = 0; // needed whitespace for centering
struct vfd_ioctl_data data;
if (!fromScrollThread)
{
if(vfd_scrollText != 0)
{
pthread_cancel(vfd_scrollText);
pthread_join(vfd_scrollText, NULL);
vfd_scrollText = 0;
}
}
if ((strlen(str) > VFDLENGTH && !fromScrollThread) && (g_settings.lcd_vfd_scroll >= 1))
{
CVFD::getInstance()->ShowScrollText(str);
return;
}
if (strlen(str) < VFDLENGTH && VFDLENGTH > 7) // do not center on small displays
ws = (VFDLENGTH-strlen(str))/2;
else
ws = 0;
memset(data.data, ' ', 63);
if (!fromScrollThread)
{
memcpy (data.data+ws, str, VFDLENGTH-ws);
data.start = 0;
if ((strlen(str) % 2) == 1 && VFDLENGTH > 7) // do not center on small displays
data.length = VFDLENGTH-ws-1;
else
data.length = VFDLENGTH-ws;
}
else
{
memcpy ( data.data, str, VFDLENGTH);
data.start = 0;
data.length = VFDLENGTH;
}
write_to_vfd(VFDDISPLAYCHARS, &data);
return;
}
void CVFD::ShowScrollText(char *str)
{
printf("CVFD::ShowScrollText: [%s]\n", str);
if (blocked)
{
printf("[CVFD] - blocked\n");
usleep(SCROLL_TIME);
}
//stop scrolltextthread
if(vfd_scrollText != 0)
{
pthread_cancel(vfd_scrollText);
pthread_join(vfd_scrollText, NULL);
vfd_scrollText = 0;
scrollstr = (char *)"";
}
//scroll text thread
scrollstr = str;
pthread_create(&vfd_scrollText, NULL, ThreadScrollText, (void *)scrollstr);
}
void* CVFD::ThreadScrollText(void * arg)
{
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
int i;
char *str = (char *)arg;
int len = strlen(str);
char out[VFDLENGTH+1];
char buf[VFDLENGTH+65];
memset(out, 0, VFDLENGTH+1);
int retries = g_settings.lcd_vfd_scroll;
if (len > VFDLENGTH)
{
printf("CVFD::ThreadScrollText: [%s], length %d\n", str, len);
memset(buf, ' ', (len + VFDLENGTH));
memcpy(buf, str, len);
while(retries--)
{
// usleep(SCROLL_TIME);
for (i = 0; i <= (len-1); i++)
{
// scroll text until end
memcpy(out, buf+i, VFDLENGTH);
ShowNormalText(out,true);
usleep(SCROLL_TIME);
}
}
}
memcpy(out, str, VFDLENGTH); // display first VFDLENGTH chars after scrolling
ShowNormalText(out,true);
pthread_exit(0);
return NULL;
}
#endif
CVFD::CVFD()
{
text[0] = 0;
g_str[0] = 0;
clearClock = 0;
mode = MODE_TVRADIO;
switch_name_time_cnt = 0;
timeout_cnt = 0;
service_number = -1;
#ifdef VFD_UPDATE
m_fileList = NULL;
m_fileListPos = 0;
@@ -278,16 +64,12 @@ CVFD::CVFD()
has_lcd = true;
has_led_segment = false;
#if !HAVE_DUCKBOX_HARDWARE
fd = open("/dev/display", O_RDONLY);
if(fd < 0) {
perror("/dev/display");
has_lcd = false;
has_led_segment = false;
}
#else
fd = 1;
#endif
#ifdef BOXMODEL_CS_HD2
if (fd >= 0) {
@@ -321,16 +103,21 @@ CVFD::CVFD()
support_text = true;
support_numbers = true;
#endif
text.clear();
clearClock = 0;
mode = MODE_TVRADIO;
switch_name_time_cnt = 0;
timeout_cnt = 0;
service_number = -1;
}
CVFD::~CVFD()
{
#if !HAVE_DUCKBOX_HARDWARE
if(fd > 0){
close(fd);
fd = -1;
}
#endif
}
CVFD* CVFD::getInstance()
@@ -379,9 +166,6 @@ void CVFD::wake_up() {
if(g_settings.lcd_info_line){
switch_name_time_cnt = g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR] + 10;
}
#if defined (BOXMODEL_OCTAGON1008)
ShowIcon(ICON_COLON2, false);
#endif
}
@@ -430,68 +214,9 @@ void CVFD::setlcdparameter(int dimm, const int power)
brightness = dimm;
printf("CVFD::setlcdparameter dimm %d power %d\n", dimm, power);
#if !HAVE_DUCKBOX_HARDWARE
int ret = ioctl(fd, IOC_FP_SET_BRIGHT, dimm);
if(ret < 0)
perror("IOC_FP_SET_BRIGHT");
#else
// Brightness
struct vfd_ioctl_data data;
#if !defined (BOXMODEL_HS7810A) && !defined (BOXMODEL_HS7119) && !defined (BOXMODEL_HS7819)
memset(&data, 0, sizeof(struct vfd_ioctl_data));
data.start = brightness & 0x07;
data.length = 0;
write_to_vfd(VFDBRIGHTNESS, &data);
#endif
#if defined (BOXMODEL_FORTIS_HDBOX) || defined (BOXMODEL_ATEVIO7500)
usleep(100000);
memset(&data, 0, sizeof(struct vfd_ioctl_data));
data.start = 0;
data.length = 5;
if (power) {
data.data[0] = 0x01; // red led
}
else
{
data.data[0] = 0xf2; // cross plus blue led
}
data.start = 0;
data.data[4] = 0; // off
data.length = 5;
write_to_vfd(VFDPWRLED, &data);
usleep(100000);
memset(&data, 0, sizeof(struct vfd_ioctl_data));
data.start = 0;
data.length = 5;
if (power) {
data.data[0] = 0xf2; // cross plus blue led
}
else
{
data.data[0] = 0x01; // red led
}
data.start = 0;
data.data[4] = brightness*2;
data.length = 5;
write_to_vfd(VFDPWRLED, &data);
#elif defined (BOXMODEL_HS7810A) || defined (BOXMODEL_HS7819)
memset(&data, 0, sizeof(struct vfd_ioctl_data));
data.start = 0;
data.data[0] = 0x02; // logo
data.data[4] = (brightness & 0x07);
data.length = 5;
write_to_vfd(VFDPWRLED, &data);
#elif !defined (BOXMODEL_UFS912) && !defined (BOXMODEL_UFS913) && !defined (BOXMODEL_OCTAGON1008)
// Power on/off
if (power) {
data.start = 0x01;
} else {
data.start = 0x00;
}
data.length = 0;
write_to_vfd(VFDDISPLAYWRITEONOFF, &data, true);
#endif
#endif
}
void CVFD::setlcdparameter(void)
@@ -502,7 +227,6 @@ void CVFD::setlcdparameter(void)
last_toggle_state_power);
}
#if !HAVE_DUCKBOX_HARDWARE
void CVFD::setled(int led1, int led2)
{
int ret = -1;
@@ -600,7 +324,6 @@ void CVFD::setled(void)
}
setled(led1, led2);
}
#endif
void CVFD::showServicename(const std::string & name, int number) // UTF-8
{
@@ -644,24 +367,6 @@ 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;
#if !defined (BOXMODEL_HS7810A) && !defined (BOXMODEL_HS7819)
#if defined (BOXMODEL_OCTAGON1008)
ShowIcon(ICON_COLON2, true);
#elif defined (BOXMODEL_OCTAGON1008) || defined (BOXMODEL_HS7119) || defined (BOXMODEL_CUBEREVO_250HD)
strftime(timestr, 5, "%H%M", t);
#else
strftime(timestr, 6, "%H:%M", t);
#endif
ShowText(timestr);
#else //HS7810A or HS7819, string should not scroll
strftime(timestr, 6, "%H:%M", t);
struct vfd_ioctl_data data;
memset(data.data, ' ', 6);
memcpy (data.data, timestr, 6);
data.start = 0;
data.length = 5;
write_to_vfd(VFDDISPLAYCHARS, &data);
#endif
if (support_text) {
strftime(timestr, 20, "%H:%M", t);
ShowText(timestr);
@@ -681,44 +386,24 @@ void CVFD::showTime(bool force)
clearClock = 0;
if(has_lcd)
ShowIcon(FP_ICON_CAM1, false);
#if !HAVE_DUCKBOX_HARDWARE
setled(false);//off
#endif
} else {
clearClock = 1;
if(has_lcd)
ShowIcon(FP_ICON_CAM1, true);
#if !HAVE_DUCKBOX_HARDWARE
setled(true);//on
#endif
}
} else if(clearClock || (recstatus != tmp_recstatus)) { // in case icon ON after record stopped
clearClock = 0;
if(has_lcd)
ShowIcon(FP_ICON_CAM1, false);
#if !HAVE_DUCKBOX_HARDWARE
setled();
#endif
}
recstatus = tmp_recstatus;
}
#if HAVE_DUCKBOX_HARDWARE
void CVFD::UpdateIcons()
{
CZapitChannel * chan = CZapit::getInstance()->GetCurrentChannel();
if (chan)
{
ShowIcon(FP_ICON_HD,chan->isHD());
ShowIcon(FP_ICON_LOCK,!chan->camap.empty());
if (chan->getAudioChannel() != NULL)
ShowIcon(FP_ICON_DD, chan->getAudioChannel()->audioChannelType == CZapitAudioChannel::AC3);
}
}
#endif
void CVFD::showRCLock(int duration)
{
if (!has_lcd || !g_settings.lcd_notify_rclock)
@@ -750,75 +435,8 @@ void CVFD::showVolume(const char vol, const bool force_update)
if (g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME] == 1) {
wake_up();
#if HAVE_DUCKBOX_HARDWARE
int pp = (int) round((double) vol / (double) 2);
if(oldpp != pp)
{
#if defined (BOXMODEL_UFS910) || defined (BOXMODEL_UFS922)
int i;
unsigned char speaker[5] = {0x1C, 0x1C, 0x1C, 0x3E, 0x7F}; // speaker symbol
writeCG(0, speaker);
int j = pp / 5;
// v-lines 0-5 = {0x10,0x11,0x12,0x13,0x14,0x15}
char c0[1] = {0x5F};
char c1[1] = {0x11};
char c2[1] = {0x12};
char c3[1] = {0x13};
char c4[1] = {0x14};
char c5[1] = {0x15};
char VolumeBar[17];
memset (VolumeBar, 0, sizeof(VolumeBar));
char act[2] = {0x01, 0x20};
strncat(VolumeBar, act, 2);
for(i=1; i <= j; i++)
{
strncat(VolumeBar, c5, 1);
}
i = pp % 5;
switch (i)
{
case 1:
strncat(VolumeBar, c1, 1);
break;
case 2:
strncat(VolumeBar, c2, 1);
break;
case 3:
strncat(VolumeBar, c3, 1);
break;
case 4:
strncat(VolumeBar, c4, 1);
break;
}
//dprintf(DEBUG_DEBUG,"CVFD::showVolume: vol %d - pp %d - fullblocks %d - mod %d - %s\n", vol, pp, j, i, VolumeBar);
if (strlen(VolumeBar) < 12) {
for (int a=strlen(VolumeBar); a < 12; a++)
strncat(VolumeBar, c0, 1);
}
ShowText(VolumeBar);
#elif defined (BOXMODEL_TF7700)
char vol_chr[64] = "";
snprintf(vol_chr, sizeof(vol_chr)-1, "VOL: %d%%", (int)vol);
ShowText(vol_chr);
#elif defined (BOXMODEL_OCTAGON1008)
char vol_chr[64] = "";
snprintf(vol_chr, sizeof(vol_chr)-1, "VOL=%3d", (int)vol);
ShowText(vol_chr);
#elif defined (BOXMODEL_HS7119) || defined (BOXMODEL_HS7810A) || defined (BOXMODEL_HS7819) || defined (BOXMODEL_CUBEREVO_250HD) || defined (BOXMODEL_IPBOX55)
char vol_chr[64] = "";
snprintf(vol_chr, sizeof(vol_chr)-1, "v%3d", (int)vol);
ShowText(vol_chr);
#elif defined (BOXMODEL_FORTIS_HDBOX) || defined (BOXMODEL_ATEVIO7500) || defined (BOXMODEL_UFS912) || defined (BOXMODEL_UFS913) || defined (BOXMODEL_CUBEREVO) || defined (BOXMODEL_CUBEREVO_MINI) || defined (BOXMODEL_CUBEREVO_MINI2) || defined (BOXMODEL_CUBEREVO_2000HD) || defined (BOXMODEL_CUBEREVO_3000HD) || defined (BOXMODEL_IPBOX9900) || defined (BOXMODEL_IPBOX99)
char vol_chr[64] = "";
snprintf(vol_chr, sizeof(vol_chr)-1, "Volume: %d%%", (int)vol);
ShowText(vol_chr);
#endif
oldpp = pp;
}
#else
ShowIcon(FP_ICON_FRAME, true);
int pp = (int) round((double) vol * (double) 8 / (double) 100);
int pp = (vol * 8 + 50) / 100;
if(pp > 8) pp = 8;
if(force_update || oldpp != pp) {
@@ -835,15 +453,11 @@ printf("CVFD::showVolume: %d, bar %d\n", (int) vol, pp);
}
oldpp = pp;
}
#endif
}
}
void CVFD::showPercentOver(const unsigned char perc, const bool /*perform_update*/, const MODES origin)
{
#if HAVE_DUCKBOX_HARDWARE
return;
#else
static int ppold = 0;
if(!has_lcd) return;
@@ -863,7 +477,7 @@ void CVFD::showPercentOver(const unsigned char perc, const bool /*perform_update
if(perc == 255)
pp = 0;
else
pp = (int) round((double) perc * (double) 8 / (double) 100);
pp = (perc * 8 + 50) / 100;
if(pp > 8) pp = 8;
if(pp != ppold) {
@@ -881,7 +495,6 @@ void CVFD::showPercentOver(const unsigned char perc, const bool /*perform_update
ppold = pp;
}
}
#endif
}
void CVFD::showMenuText(const int /*position*/, const char * ptext, const int /*highlight*/, const bool /*utf_encoded*/)
@@ -920,38 +533,18 @@ void CVFD::showAudioPlayMode(AUDIOMODES m)
case AUDIO_MODE_PLAY:
ShowIcon(FP_ICON_PLAY, true);
ShowIcon(FP_ICON_PAUSE, false);
#ifdef HAVE_DUCKBOX_HARDWARE
ShowIcon(FP_ICON_FF, false);
ShowIcon(FP_ICON_FR, false);
#endif
break;
case AUDIO_MODE_STOP:
ShowIcon(FP_ICON_PLAY, false);
ShowIcon(FP_ICON_PAUSE, false);
#ifdef HAVE_DUCKBOX_HARDWARE
ShowIcon(FP_ICON_FF, false);
ShowIcon(FP_ICON_FR, false);
#endif
break;
case AUDIO_MODE_PAUSE:
ShowIcon(FP_ICON_PLAY, false);
ShowIcon(FP_ICON_PAUSE, true);
#ifdef HAVE_DUCKBOX_HARDWARE
ShowIcon(FP_ICON_FF, false);
ShowIcon(FP_ICON_FR, false);
#endif
break;
case AUDIO_MODE_FF:
#ifdef HAVE_DUCKBOX_HARDWARE
ShowIcon(FP_ICON_FF, true);
ShowIcon(FP_ICON_FR, false);
#endif
break;
case AUDIO_MODE_REV:
#ifdef HAVE_DUCKBOX_HARDWARE
ShowIcon(FP_ICON_FF, false);
ShowIcon(FP_ICON_FR, true);
#endif
break;
}
wake_up();
@@ -1039,11 +632,6 @@ void CVFD::setMode(const MODES m, const char * const title)
ShowIcon(FP_ICON_COL1, true);
ShowIcon(FP_ICON_COL2, true);
#endif
#if ! HAVE_COOL_HARDWARE
ClearIcons();
#endif
ShowIcon(FP_ICON_USB, false);
ShowIcon(FP_ICON_HDD, false);
showclock = true;
showTime(true); /* "showclock = true;" implies that "showTime();" does a "displayUpdate();" */
/* "showTime()" clears the whole lcd in MODE_STANDBY */
@@ -1071,9 +659,7 @@ void CVFD::setMode(const MODES m, const char * const title)
#endif // VFD_UPDATE
}
wake_up();
#if !HAVE_DUCKBOX_HARDWARE
setled();
#endif
}
void CVFD::setBrightness(int bright)
@@ -1087,13 +673,8 @@ void CVFD::setBrightness(int bright)
int CVFD::getBrightness()
{
//FIXME for old neutrino.conf
#if defined (BOXMODEL_OCTAGON1008) || defined (BOXMODEL_FORTIS_HDBOX) || defined (BOXMODEL_ATEVIO7500)
if(g_settings.lcd_setting[SNeutrinoSettings::LCD_BRIGHTNESS] > 7)
g_settings.lcd_setting[SNeutrinoSettings::LCD_BRIGHTNESS] = 7;
#else
if(g_settings.lcd_setting[SNeutrinoSettings::LCD_BRIGHTNESS] > 15)
g_settings.lcd_setting[SNeutrinoSettings::LCD_BRIGHTNESS] = 15;
#endif
return g_settings.lcd_setting[SNeutrinoSettings::LCD_BRIGHTNESS];
}
@@ -1109,13 +690,8 @@ void CVFD::setBrightnessStandby(int bright)
int CVFD::getBrightnessStandby()
{
//FIXME for old neutrino.conf
#if defined (BOXMODEL_OCTAGON1008) || defined (BOXMODEL_FORTIS_HDBOX) || defined (BOXMODEL_ATEVIO7500)
if(g_settings.lcd_setting[SNeutrinoSettings::LCD_STANDBY_BRIGHTNESS] > 7)
g_settings.lcd_setting[SNeutrinoSettings::LCD_STANDBY_BRIGHTNESS] = 7;
#else
if(g_settings.lcd_setting[SNeutrinoSettings::LCD_STANDBY_BRIGHTNESS] > 15)
g_settings.lcd_setting[SNeutrinoSettings::LCD_STANDBY_BRIGHTNESS] = 15;
#endif
return g_settings.lcd_setting[SNeutrinoSettings::LCD_STANDBY_BRIGHTNESS];
}
@@ -1130,13 +706,8 @@ void CVFD::setBrightnessDeepStandby(int bright)
int CVFD::getBrightnessDeepStandby()
{
//FIXME for old neutrino.conf
#if defined (BOXMODEL_OCTAGON1008) || defined (BOXMODEL_FORTIS_HDBOX) || defined (BOXMODEL_ATEVIO7500)
if(g_settings.lcd_setting[SNeutrinoSettings::LCD_DEEPSTANDBY_BRIGHTNESS] > 7)
g_settings.lcd_setting[SNeutrinoSettings::LCD_DEEPSTANDBY_BRIGHTNESS] = 7;
#else
if(g_settings.lcd_setting[SNeutrinoSettings::LCD_DEEPSTANDBY_BRIGHTNESS] > 15)
g_settings.lcd_setting[SNeutrinoSettings::LCD_DEEPSTANDBY_BRIGHTNESS] = 15;
#endif
return g_settings.lcd_setting[SNeutrinoSettings::LCD_DEEPSTANDBY_BRIGHTNESS];
}
@@ -1194,122 +765,39 @@ void CVFD::Unlock()
void CVFD::Clear()
{
if(fd < 0) return;
#if !HAVE_DUCKBOX_HARDWARE
int ret = ioctl(fd, IOC_FP_CLEAR_ALL, 0);
if(ret < 0)
perror("IOC_FP_SET_TEXT");
else
text[0] = 0;
#else
#if defined (BOXMODEL_HS7810A) || defined (BOXMODEL_HS7119) || defined (BOXMODEL_HS7819) || defined (BOXMODEL_CUBEREVO_250HD) || defined (BOXMODEL_IPBOX55)
ShowText(" ");
#elif defined (BOXMODEL_OCTAGON1008) || defined (BOXMODEL_TF7700)
ShowText(" ");
#elif defined (BOXMODEL_FORTIS_HDBOX) || defined (BOXMODEL_ATEVIO7500)
ShowText(" ");
#elif defined (BOXMODEL_IPBOX9900) || defined (BOXMODEL_IPBOX99)
ShowText(" ");
#elif !defined (BOXMODEL_HS7110)
ShowText(" ");
#endif
#endif
text.clear();
}
void CVFD::ShowIcon(fp_icon icon, bool show)
{
#if !HAVE_DUCKBOX_HARDWARE
if(!has_lcd || fd < 0) return;
//printf("CVFD::ShowIcon %s %x\n", show ? "show" : "hide", (int) icon);
int ret = ioctl(fd, show ? IOC_FP_SET_ICON : IOC_FP_CLEAR_ICON, icon);
if(ret < 0)
perror(show ? "IOC_FP_SET_ICON" : "IOC_FP_CLEAR_ICON");
#else
#if defined (BOXMODEL_ATEVIO7500) || defined (BOXMODEL_HS7110) || defined (BOXMODEL_HS7810A) || defined (BOXMODEL_HS7119) || defined (BOXMODEL_HS7819)
return;
#endif
if (icon == 0)
return;
if (active_icon[icon & 0x0F] == show)
return;
else
active_icon[icon & 0x0F] = show;
//printf("CVFD::ShowIcon %s %x\n", show ? "show" : "hide", (int) icon);
struct vfd_ioctl_data data;
memset(&data, 0, sizeof(struct vfd_ioctl_data));
data.start = 0x00;
data.data[0] = icon;
data.data[4] = show;
data.length = 5;
write_to_vfd(VFDICONDISPLAYONOFF, &data);
return;
#endif
}
#ifdef HAVE_DUCKBOX_HARDWARE
void CVFD::ClearIcons()
{
#if defined (BOXMODEL_ATEVIO7500) || defined (BOXMODEL_HS7110) || defined (BOXMODEL_HS7810A) || defined (BOXMODEL_HS7119) || defined (BOXMODEL_HS7819)
return;
#endif
for (int id = 0x10; id < FP_ICON_MAX; id++) {
#if defined (BOXMODEL_OCTAGON1008)
if (id != FP_ICON_USB && id != FP_ICON_HDD)
#elif defined(BOXMODEL_FORTIS_HDBOX) || defined (BOXMODEL_TF7700)
if (id != FP_ICON_USB)
#else
if (id != 0x10 && id != 0x12)
#endif
ShowIcon((fp_icon)id, false);
}
return;
}
void CVFD::ShowText(const char * str)
{
memset(g_str, 0, sizeof(g_str));
memcpy(g_str, str, sizeof(g_str)-1);
int i = strlen(str);
if (i > 63) {
g_str[60] = '.';
g_str[61] = '.';
g_str[62] = '.';
g_str[63] = '\0';
i = 63;
}
ShowNormalText(g_str, false);
}
void CVFD::repaintIcons()
{
char * model = g_info.hw_caps->boxname;
if(strstr(model, "ufs912") || strstr(model, "ufs913"))
{
bool tmp_icon[16] = {false};
printf("VFD repaint icons boxmodel: %s\n", model);
for (int i = 0x10; i < FP_ICON_MAX; i++)
{
tmp_icon[i & 0x0F] = active_icon[i & 0x0F];
active_icon[i & 0x0F] = false;
ShowIcon((fp_icon)i, tmp_icon[i & 0x0F]);
}
}
}
#else
void CVFD::ShowText(const char * str)
{
if (fd < 0 || !support_text)
return;
char flags[2] = { FP_FLAG_ALIGN_LEFT, 0 };
if (! str) {
printf("CVFD::ShowText: str is NULL!\n");
return;
}
if (g_settings.lcd_scroll)
if (g_settings.lcd_scroll && ((int)strlen(str) > g_info.hw_caps->display_xres))
flags[0] |= FP_FLAG_SCROLL_ON | FP_FLAG_SCROLL_SIO | FP_FLAG_SCROLL_DELAY;
std::string txt = std::string(flags) + str;
txt = trim(txt);
printf("CVFD::ShowText: [%s]\n", txt.c_str() + 1);
printf("CVFD::ShowText: [0x%02x][%s]\n", flags[0], txt.c_str() + 1);
size_t len = txt.length();
if (txt == text || len > 255)
@@ -1322,7 +810,6 @@ void CVFD::ShowText(const char * str)
perror("IOC_FP_SET_TEXT");
}
}
#endif
void CVFD::ShowNumber(int number)
{