From a3398a21435045fb6af1af14cc5638fd0cb52119 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Fri, 24 Jul 2020 18:14:32 -0400 Subject: plugins: Fix the builds for targets lacking HAVE_BACKLIGHT Change-Id: Ifdb1501834b7ea63ca6f731bbd6414305d7e0001 --- apps/plugins/chopper.c | 4 ++++ apps/plugins/credits.c | 6 +++++- apps/plugins/fft/fft.c | 4 ++++ apps/plugins/lib/helper.c | 2 ++ apps/plugins/lua/rocklib.c | 22 +++++++++++++--------- apps/plugins/pictureflow/pictureflow.c | 4 ++++ apps/plugins/random_folder_advance_config.c | 8 ++++++++ 7 files changed, 40 insertions(+), 10 deletions(-) diff --git a/apps/plugins/chopper.c b/apps/plugins/chopper.c index f42801f10f..37fed5dd01 100644 --- a/apps/plugins/chopper.c +++ b/apps/plugins/chopper.c @@ -1105,8 +1105,10 @@ enum plugin_status plugin_start(const void* parameter) rb->lcd_set_foreground(LCD_WHITE); #endif +#ifdef HAVE_BACKLIGHT /* Turn off backlight timeout */ backlight_ignore_timeout(); +#endif rb->srand( *rb->current_tick ); @@ -1118,8 +1120,10 @@ enum plugin_status plugin_start(const void* parameter) configfile_save(CFG_FILE, config, 1, 0); rb->lcd_setfont(FONT_UI); +#ifdef HAVE_BACKLIGHT /* Turn on backlight timeout (revert to settings) */ backlight_use_settings(); +#endif return ret; } diff --git a/apps/plugins/credits.c b/apps/plugins/credits.c index 593b54277e..3374a33415 100644 --- a/apps/plugins/credits.c +++ b/apps/plugins/credits.c @@ -303,17 +303,21 @@ enum plugin_status plugin_start(const void* parameter) { (void)parameter; +#ifdef HAVE_BACKLIGHT /* Turn off backlight timeout */ backlight_ignore_timeout(); +#endif rb->show_logo(); /* Show the logo for about 3 secs allowing the user to stop */ if(!rb->action_userabort(3*HZ)) roll_credits(); - + +#ifdef HAVE_BACKLIGHT /* Turn on backlight timeout (revert to settings) */ backlight_use_settings(); +#endif return PLUGIN_OK; } diff --git a/apps/plugins/fft/fft.c b/apps/plugins/fft/fft.c index 1349b07012..9edb02a15e 100644 --- a/apps/plugins/fft/fft.c +++ b/apps/plugins/fft/fft.c @@ -1532,7 +1532,9 @@ static void fft_cleanup(void) #ifndef HAVE_LCD_COLOR grey_release(); #endif +#ifdef HAVE_BACKLIGHT backlight_use_settings(); +#endif /* save settings if changed */ if (rb->memcmp(&fft, &fft_disk, sizeof(fft))) @@ -1583,7 +1585,9 @@ static bool fft_setup(void) mylcd_clear_display(); myosd_lcd_update(); #endif +#ifdef HAVE_BACKLIGHT backlight_ignore_timeout(); +#endif #ifdef HAVE_ADJUSTABLE_CPU_FREQ rb->trigger_cpu_boost(); diff --git a/apps/plugins/lib/helper.c b/apps/plugins/lib/helper.c index 6eb3498791..f36c01b23e 100644 --- a/apps/plugins/lib/helper.c +++ b/apps/plugins/lib/helper.c @@ -22,6 +22,7 @@ #include "plugin.h" #include "helper.h" +#ifdef HAVE_BACKLIGHT /* Force the backlight on */ void backlight_force_on(void) { @@ -51,6 +52,7 @@ void backlight_use_settings(void) backlight_timeout_plugged); #endif /* CONFIG_CHARGING */ } +#endif /* HAVE_BACKLIGHT */ #ifdef HAVE_SW_POWEROFF static bool original_sw_poweroff_state = true; diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c index e6eb543eda..8eab08f987 100644 --- a/apps/plugins/lua/rocklib.c +++ b/apps/plugins/lua/rocklib.c @@ -579,6 +579,7 @@ RB_WRAP(mixer_frequency) return 1; } +#ifdef HAVE_BACKLIGHT /* DEVICE LIGHTING CONTROL */ RB_WRAP(backlight_onoff) { @@ -599,11 +600,6 @@ SIMPLE_VOID_WRAPPER(remote_backlight_force_on); SIMPLE_VOID_WRAPPER(remote_backlight_use_settings); #endif -#ifdef HAVE_BUTTON_LIGHT -SIMPLE_VOID_WRAPPER(buttonlight_force_on); -SIMPLE_VOID_WRAPPER(buttonlight_use_settings); -#endif - #ifdef HAVE_BACKLIGHT_BRIGHTNESS RB_WRAP(backlight_brightness_set) { @@ -618,6 +614,12 @@ RB_WRAP(backlight_brightness_set) return 0; } #endif +#endif /* HAVE_BACKLIGHT */ + +#ifdef HAVE_BUTTON_LIGHT +SIMPLE_VOID_WRAPPER(buttonlight_force_on); +SIMPLE_VOID_WRAPPER(buttonlight_use_settings); +#endif #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS RB_WRAP(buttonlight_brightness_set) @@ -954,6 +956,7 @@ static const luaL_Reg rocklib[] = RB_FUNC(pcm), RB_FUNC(mixer_frequency), +#ifdef HAVE_BACKLIGHT /* DEVICE LIGHTING CONTROL */ RB_FUNC(backlight_onoff), @@ -966,15 +969,16 @@ static const luaL_Reg rocklib[] = RB_FUNC(remote_backlight_use_settings), #endif +#ifdef HAVE_BACKLIGHT_BRIGHTNESS + RB_FUNC(backlight_brightness_set), +#endif +#endif /* HAVE_BACKLIGHT */ + #ifdef HAVE_BUTTON_LIGHT RB_FUNC(buttonlight_force_on), RB_FUNC(buttonlight_use_settings), #endif -#ifdef HAVE_BACKLIGHT_BRIGHTNESS - RB_FUNC(backlight_brightness_set), -#endif - #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS RB_FUNC(buttonlight_brightness_set), #endif diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c index a32298f861..ba3ae3018f 100644 --- a/apps/plugins/pictureflow/pictureflow.c +++ b/apps/plugins/pictureflow/pictureflow.c @@ -2971,8 +2971,10 @@ static void cleanup(void) rb->cpu_boost(false); #endif end_pf_thread(); +#ifdef HAVE_BACKLIGHT /* Turn on backlight timeout (revert to settings) */ backlight_use_settings(); +#endif #ifdef USEGSLIB grey_release(); @@ -3508,7 +3510,9 @@ static int pictureflow_main(void) draw_splashscreen(pf_idx.buf, pf_idx.buf_sz); if(pf_cfg.backlight_mode == 0) { /* Turn off backlight timeout */ +#ifdef HAVE_BACKLIGHT backlight_ignore_timeout(); +#endif } init_scroll_lines(); diff --git a/apps/plugins/random_folder_advance_config.c b/apps/plugins/random_folder_advance_config.c index 68440e4602..c9dce0223b 100644 --- a/apps/plugins/random_folder_advance_config.c +++ b/apps/plugins/random_folder_advance_config.c @@ -569,10 +569,12 @@ static enum plugin_status main_menu(void) #ifdef HAVE_ADJUSTABLE_CPU_FREQ rb->cpu_boost(false); #endif +#ifdef HAVE_BACKLIGHT #ifdef HAVE_REMOTE_LCD rb->remote_backlight_on(); #endif rb->backlight_on(); +#endif break; case 1: #ifdef HAVE_ADJUSTABLE_CPU_FREQ @@ -583,10 +585,12 @@ static enum plugin_status main_menu(void) #ifdef HAVE_ADJUSTABLE_CPU_FREQ rb->cpu_boost(false); #endif +#ifdef HAVE_BACKLIGHT #ifdef HAVE_REMOTE_LCD rb->remote_backlight_on(); #endif rb->backlight_on(); +#endif break; case 2: /* export to textfile */ #ifdef HAVE_ADJUSTABLE_CPU_FREQ @@ -596,10 +600,12 @@ static enum plugin_status main_menu(void) #ifdef HAVE_ADJUSTABLE_CPU_FREQ rb->cpu_boost(false); #endif +#ifdef HAVE_BACKLIGHT #ifdef HAVE_REMOTE_LCD rb->remote_backlight_on(); #endif rb->backlight_on(); +#endif break; case 3: /* import from textfile */ #ifdef HAVE_ADJUSTABLE_CPU_FREQ @@ -609,10 +615,12 @@ static enum plugin_status main_menu(void) #ifdef HAVE_ADJUSTABLE_CPU_FREQ rb->cpu_boost(false); #endif +#ifdef HAVE_BACKLIGHT #ifdef HAVE_REMOTE_LCD rb->remote_backlight_on(); #endif rb->backlight_on(); +#endif break; case 4: if (!start_shuffled_play()) -- cgit v1.2.3