diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 564ecf643..7ccc58506 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -641,6 +641,9 @@ lcdmenu.statusline Statuszeile lcdmenu.statusline.both Lautstärke/ Fortschritt lcdmenu.statusline.playtime Sendungsfortschritt lcdmenu.statusline.volume Lautstärke +ledcontroler.mode.tv Led +ledcontroler.mode.deepstandby Led DeepStandby +ledcontroler.mode.standby Led Standby mainmenu.audioplayer Audioplayer mainmenu.clearsectionsd Lösche EPG Cache mainmenu.games Spiele diff --git a/data/locale/english.locale b/data/locale/english.locale index f69be3136..f8887b2df 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -461,6 +461,9 @@ lcdmenu.statusline status line lcdmenu.statusline.both volume / playtime lcdmenu.statusline.playtime playtime lcdmenu.statusline.volume volume +ledcontroler.mode.tv Led +ledcontroler.mode.deepstandby Led DeepStandby +ledcontroler.mode.standby Led Standby mainmenu.audioplayer Audioplayer mainmenu.games Games mainmenu.head Main Menu diff --git a/src/driver/vfd.cpp b/src/driver/vfd.cpp index 8c256f304..be92f169d 100644 --- a/src/driver/vfd.cpp +++ b/src/driver/vfd.cpp @@ -164,6 +164,38 @@ void CVFD::setlcdparameter(void) 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){ + int ret = ioctl(fd, IOC_VFD_LED_CTRL, led1); + if(ret < 0) + perror("IOC_VFD_LED_CTRL"); + ret = ioctl(fd, IOC_VFD_LED_CTRL, led2); + if(ret < 0) + perror("IOC_VFD_LED_CTRL"); +} +void CVFD::setled(void) +{ + if(!has_lcd) return; + + int led1 = 0, led2 = 0; + int select = 0; + + if(mode == MODE_MENU_UTF8 || mode == MODE_TVRADIO ) + select = g_settings.led_tv_mode; + else if(mode == MODE_STANDBY) + select = g_settings.led_standby_mode; + + switch(select){ + case 0: + led1 = VFD_LED_1_OFF; led2 = VFD_LED_2_OFF; + break; + case 1: + led1 = VFD_LED_1_ON; led2 = VFD_LED_2_ON; + break; + default: + break; + } + setled(led1, led2); +} void CVFD::showServicename(const std::string & name) // UTF-8 { @@ -445,6 +477,7 @@ void CVFD::setMode(const MODES m, const char * const title) #endif // VFD_UPDATE } wake_up(); + setled(); } void CVFD::setBrightness(int bright) diff --git a/src/driver/vfd.h b/src/driver/vfd.h index 37dfd8985..f01555fd9 100644 --- a/src/driver/vfd.h +++ b/src/driver/vfd.h @@ -97,12 +97,13 @@ class CVFD static void* TimeThread(void*); void setlcdparameter(int dimm, int power); + void setled(int led1, int led2); public: ~CVFD(); bool has_lcd; void setlcdparameter(void); - + void setled(void); static CVFD* getInstance(); void init(const char * fontfile, const char * fontname); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 33f3ea13f..007ef9c90 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -808,6 +808,11 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.rotor_swap = configfile.getInt32( "rotor_swap", 0); g_settings.emlog = configfile.getInt32( "emlog", 0); + //led + g_settings.led_tv_mode = configfile.getInt32( "led_tv_mode", 1); + g_settings.led_standby_mode = configfile.getInt32( "led_standby_mode", 1); + g_settings.led_deep_mode = configfile.getInt32( "led_deep_mode", 1); + g_settings.hdd_fs = configfile.getInt32( "hdd_fs", 0); g_settings.hdd_sleep = configfile.getInt32( "hdd_sleep", 120); g_settings.hdd_noise = configfile.getInt32( "hdd_noise", 254); @@ -1335,6 +1340,10 @@ void CNeutrinoApp::saveSetup(const char * fname) //fb-alpha values for gtx configfile.setInt32( "gtx_alpha1", g_settings.gtx_alpha1 ); configfile.setInt32( "gtx_alpha2", g_settings.gtx_alpha2 ); + //led + configfile.setInt32( "led_tv_mode", g_settings.led_tv_mode); + configfile.setInt32( "led_standby_mode", g_settings.led_standby_mode); + configfile.setInt32( "led_deep_mode", g_settings.led_deep_mode); //misc configfile.setInt32( "power_standby", g_settings.power_standby); @@ -3731,7 +3740,7 @@ void CNeutrinoApp::ExitRun(const bool /*write_si*/, int retcode) printf("now: %ld, timer %ld, FP timer %ld\n", mtime/60, timer_minutes/60, fp_timer);fflush(stdout); standby.brightness = g_settings.lcd_setting[SNeutrinoSettings::LCD_DEEPSTANDBY_BRIGHTNESS]; - standby.flags = 0x40; + standby.flags = g_settings.led_deep_mode ? 0x40:0; standby.current_hour = tmtime->tm_hour; standby.current_minute = tmtime->tm_min; standby.timer_minutes_hi = fp_timer >> 8;; diff --git a/src/neutrino_menue.cpp b/src/neutrino_menue.cpp index 77f8dfe5e..767910796 100644 --- a/src/neutrino_menue.cpp +++ b/src/neutrino_menue.cpp @@ -2660,7 +2660,16 @@ void CNeutrinoApp::InitLcdSettings(CMenuWidget &lcdSettings) lcdSettings.addItem(GenericMenuSeparatorLine); lcdSettings.addItem(new CMenuForwarder(LOCALE_LCDMENU_LCDCONTROLER, true, NULL, lcdsliders, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED)); + CMenuWidget * ledMenu = new CMenuWidget(LOCALE_LEDCONTROLER_MODE_TV, NEUTRINO_ICON_SETTINGS); + addMenueIntroItems(*ledMenu); + ledMenu->addItem(new CMenuOptionChooser(LOCALE_LEDCONTROLER_MODE_TV, &g_settings.led_tv_mode, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, new CLedControlNotifier())); + ledMenu->addItem(new CMenuOptionChooser(LOCALE_LEDCONTROLER_MODE_STANDBY, &g_settings.led_standby_mode, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); + if(cs_get_revision() > 7) + ledMenu->addItem(new CMenuOptionChooser(LOCALE_LEDCONTROLER_MODE_DEEPSTANDBY, &g_settings.led_deep_mode, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); + + lcdSettings.addItem(new CMenuForwarder(LOCALE_LEDCONTROLER_MODE_TV, true, NULL, ledMenu, NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN)); lcdSettings.addItem(GenericMenuSeparatorLine); + CMenuOptionChooser* oj = new CMenuOptionChooser(LOCALE_LCDMENU_STATUSLINE, &g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME], LCDMENU_STATUSLINE_OPTIONS, LCDMENU_STATUSLINE_OPTION_COUNT, true); lcdSettings.addItem(oj); } diff --git a/src/system/locals.h b/src/system/locals.h index 864f3f236..6b1f3d72e 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -493,6 +493,9 @@ typedef enum { LOCALE_LCDMENU_STATUSLINE_BOTH, LOCALE_LCDMENU_STATUSLINE_PLAYTIME, LOCALE_LCDMENU_STATUSLINE_VOLUME, + LOCALE_LEDCONTROLER_MODE_TV, + LOCALE_LEDCONTROLER_MODE_DEEPSTANDBY, + LOCALE_LEDCONTROLER_MODE_STANDBY, LOCALE_MAINMENU_AUDIOPLAYER, LOCALE_MAINMENU_CLEARSECTIONSD, LOCALE_MAINMENU_GAMES, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 95dcb7d97..309c1c196 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -493,6 +493,9 @@ const char *locale_real_names[] = { "lcdmenu.statusline.both", "lcdmenu.statusline.playtime", "lcdmenu.statusline.volume", + "ledcontroler.mode.tv", + "ledcontroler.mode.deepstandby", + "ledcontroler.mode.standby", "mainmenu.audioplayer", "mainmenu.clearsectionsd", "mainmenu.games", diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index 1c2753b47..43d6c9c97 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -961,6 +961,11 @@ int CDataResetNotifier::exec(CMenuTarget* /*parent*/, const std::string& actionK } return true; } +bool CLedControlNotifier::changeNotify(const neutrino_locale_t, void * data) +{ + CVFD::getInstance()->setled(); + return true; +} bool CFanControlNotifier::changeNotify(const neutrino_locale_t, void * data) { @@ -983,9 +988,9 @@ bool CFanControlNotifier::changeNotify(const neutrino_locale_t, void * data) return true; } -extern cCpuFreqManager * cpuFreq; bool CCpuFreqNotifier::changeNotify(const neutrino_locale_t, void * data) { +extern cCpuFreqManager * cpuFreq; int freq = * (int *) data; printf("CCpuFreqNotifier: %d Mhz\n", freq); diff --git a/src/system/setting_helpers.h b/src/system/setting_helpers.h index b7d64f236..5696df466 100644 --- a/src/system/setting_helpers.h +++ b/src/system/setting_helpers.h @@ -294,6 +294,12 @@ public: int exec(CMenuTarget* parent, const std::string& actionKey); }; +class CLedControlNotifier : public CChangeObserver +{ +public: + bool changeNotify(const neutrino_locale_t, void * data); +}; + class CFanControlNotifier : public CChangeObserver { public: diff --git a/src/system/settings.h b/src/system/settings.h index 2d21f4fd2..52ff9dc5b 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -393,7 +393,9 @@ struct SNeutrinoSettings char lcd_setting_dim_time[4]; char lcd_setting_dim_brightness[4]; - + int led_tv_mode; + int led_standby_mode; + int led_deep_mode; #define FILESYSTEM_ENCODING_TO_UTF8(a) (g_settings.filesystem_is_utf8 ? (a) : ZapitTools::Latin1_to_UTF8(a).c_str()) #define UTF8_TO_FILESYSTEM_ENCODING(a) (g_settings.filesystem_is_utf8 ? (a) : ZapitTools::UTF8_to_Latin1(a).c_str()) #define FILESYSTEM_ENCODING_TO_UTF8_STRING(a) (g_settings.filesystem_is_utf8 ? (a) : Latin1_to_UTF8(a))