Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: [PATCH,RFC] avoid radio noise on sansa clipplus

[PATCH,RFC] avoid radio noise on sansa clipplus

From: Stefan Seyfried <stefan.seyfried_at_googlemail.com>
Date: Wed, 07 Nov 2012 10:11:54 +0100

Hi all,

I'm new to rockbox development, so bear with me if I'm violating
the mailing list etiquette etc.

On my sansa clip+, there is a quiet, ticking noise on weak fm radio
channels.
I found out that this is probably due to the cpu being woken up to
update the display 5 times a second, even if the display is turned off.

This patch fixes the issue by not updating the display unless it is
turned on.

diff --git a/apps/radio/radio_skin.c b/apps/radio/radio_skin.c
index 521890c..0c05f33 100644
--- a/apps/radio/radio_skin.c
+++ b/apps/radio/radio_skin.c
@@ -96,7 +96,13 @@ void fms_fix_displays(enum fms_exiting toggle_state)
 int fms_do_button_loop(bool update_screen)
 {
     int button = skin_wait_for_action(FM_SCREEN, CONTEXT_FM,
- update_screen ? TIMEOUT_NOBLOCK : HZ/5);
+ update_screen ? TIMEOUT_NOBLOCK :
+#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
+ (lcd_active() ? HZ/5 : TIMEOUT_BLOCK)
+#else
+ HZ/5
+#endif
+ );
 #ifdef HAVE_TOUCHSCREEN
     struct touchregion *region;
     int offset;

Unfortunately, if combined with the "backlight filters first
keypress: on" config option, this causes the display (including
RSSI) to also not be updated after it is woken up again, simply
because skin_wait_for_action() will not return if the keypress
was only turning on the backlight.
The following patch pushes a dummy event into the button queue
to work around that.

diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index c165e8f..3e4e9e2 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -316,7 +316,13 @@ static void button_tick(void)
                            )
                             button_try_post(btn, data);
                         else
+ {
+#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
+ /* propagate the backlight_on() up the queue with a dummy event */
+ button_try_post(BUTTON_NONE, 0);
+#endif
                             skip_release = true;
+ }
 #else /* no backlight, nothing to skip */
                     button_try_post(btn, data);
 #endif

I did test both patches and they work for me. However, I'm
not really sure that I understand all the implications to
other parts of the code, so comments are very welcome.
In case those patches are deemed acceptable for inclusion,
I'll produce a proper git patch that can be applied easily.

Best regards,

        Stefan

-- 
Stefan Seyfried
Linux Consultant & Developer -- GPG Key: 0x731B665B
B1 Systems GmbH
Osterfeldstra├če 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
Received on 2012-11-07

Page was last modified "Jan 10 2012" The Rockbox Crew
aaa