FS#7814 - Enable H300, X5 and M5 RTC Alarm
Opened by Alexander Spyridakis (xaviergr) - Saturday, 22 September 2007, 02:03 GMT
Last edited by Solomon Peachy (pizza) - Tuesday, 25 December 2018, 14:02 GMT
|
DetailsThis small patch enables the RTC Alarm for the H300 iriver players (and eventually X5 and M5).
It will enable the unit to turn on automatically on the time that was set, and enable the Wakeup Screen menu. I was surprised to see that almost the same code was located on rtc_pcf50605.c and no one tried to enable it on pcf50606 too. |
Tuesday, 25 December 2018, 14:02 GMT
Reason for closing: Accepted
Additional comments about closing: Good news, an updated version of this patch has finally landed into master.
So if anyone is still around, grab the next dev build (ETA ~30 min from when I write this) and let me know if there are any issues.
So until a new bootloader (revision 12546 and later) is flashed this patch is useless. :(
P.S: Keep in mind that recent svn bootloader revisions have a bug currently that will not let you boot into rockbox.
Hug on OF remnants.
Thanks I didn't notice that X5 used the same chip.
I hope that I didn't forget another target.
Now I'm going to try to write a plugin to slowly ramp up the volume while playing, and this will be the perfect wake-up device
Anyway, all rtc code will eventually change when date is incorporated as a trigger on the rtc alarms.
FS#5289) needs a small fix to support RTC.so I thought that a part of the hard implemented OF (like charging and usb, when powered off) sends the wakeup singnal.
The dual bootloader checks this byte and should boot OF if it is set.
No idea why it works....
But as preglow said the code might need to be merged with pcf50605 instead of copying it, though I want to make sure for some bits on the alarm setting that might not be needed on other targets.
I'm not sure whet triggers this behaviour yet, but I'm certain it only happens with this patch. Will carry on diagnosing...
when i tried the patch on my h300 i experienced the same behavior like pondlife.
When the time display disappears and you open the clock plugin then the correct time is still shown, the date is also correct except for the date which is shown as 1999.
So the clock doesn't get completely unset, but only the date is wrong. The reason that the time disappears in the statusbar and WPS is that the function valid_time() (which returns false for years earlier than 2000) is called before displaying the time (the clock plugin doesn't do this check)
The reason that this happens seems to be that the functions pcf50606_read* and pcf50606_write* without using disable_irq_save() before and restore_irq() afterwards. This seems to be necessary on H300 in order to avoid conflicts with the button driver.
See here: http://www.rockbox.org/irc/log-20080605#12:54:12
When i use disable_irq_save() and restore_irq() similarly like it is done in rtc_read_datetime() (in \firmware\drivers\rtc\rtc_pcf50606.c) then the clock doesn't disappear anymore.
Except the bootloader it worked fine enough.
And I also saw 2 small problems: the manuals wouldn't build correctly for the 3 targets with this patch and a button action conflict in the alarm settings screen on the M5/X5 pad that wouldn't let me increase the hour by pressing "right" - which would only accept the alarm setting and leave the screen. I had a look at alarm_menu.c and the button actions and contexts that's used there and could solve the problem (I wonder whether it actually shows somewhere else currently even without the patch). As it is a button action conflict it also shows in an X5 or M5 sim in case someone wants to try.
Attached are 2 patches (1 fix for each problem). I also tested whether the X5 keymap change (the same file is used for the M5 too) needs all 3 added actions in the settings context but it seems it's really needed to have the full controls. The manual patch was needed because the alarm settings section is automatically included through the features.tex (parsed from the lang's feature.txt) and this section uses a macro for the buttons which was simply missing in the platform files, so I added it there. Both patches are independent from the main alarm patch here because they touch different files, of course it's somehow related.
Thank you for waking me up ;)
I don't know if it's possible to merge the two completely, or whether an #ifdef hell could be used, but ideas are welcome.
I'm not sure what's changed - the only functional chsnge was to explicitly disable the alarm by:
+ /* Make sure we don't wake on RTC after shutting down */
+ pcf50606_write(0x8, pcf50606_read(0x8) & ~0x10);