Details

this is a simple plugin called 'moonrock' which shows the phase of the
moon. It is not the most earthshatteringly original thing but nevertheless the effect is pretty nice. Hopefully someone else likes this!

For targets with CONFIG_RTC, it either shows a text description
or, for HAVE_LCD_BITMAP and at least greyscale targets, a (pre-calculated) picture of the moon. But only if the data file (moonrock.dat) is present and found in the apps/ directory. (it should be attached to this post, I hope it shows up here, as the file is 3MB). (time of the player is assumed to be GMT)

you can switch between picture and text with select button, and choose a new date with play (which does not change the internal clock).

The patche changes some small things in the api and in the bitmap reading routines to be able to do things easily.

I noticed that the read in of the bmp was limited to the target size. I increased it from LCD_WIDTH because 320 is the widest of any target (I think), then you can read in this size and scale down bmp with smooth_resize on other targets. (this could be a often occuring use of resize). (the dat file actually is patched together bmp)

hmmm, I see.
It is worthwhile, though, to consider increasing the size allowed by the buffer in the read_bmp routine.
(also, the buffer is for one image line: the penalty is not the full image size)
Is there another way to read in bmp with sizes bigger than the screen?

I tried to re-sync the patch.
It's possible that all the affected files but moonrock.c are ok.
moonrock.c it seems to be too much far from the actual svn sources, so I'm not able to re-sync it.
Any volunteers? ;-)

Hello,
ok, I was able to apply the patch for the current release and it seems to work so far and nicely.
But you should mention, thet the patch has to be applied from the /rockbox/-Project directory and has to be run with the -p0 parameter.
I had to copy the moonrock.dat manually to the /.rockbox/rocks/apps-directory on my player to see the moon picture. Is that correct?
I am very interested in further development of this rock. I plan to do some extensions of displaying the calculations.
More soon (tonight?)

so far it runs. I've started to investigate the source and going to add some more informations since I am very interested in astronomical calculations
Here a very quick and dirty screenshot with dummy placeholders, but you should image what it does mean.
The main problem at the time, that the Rockbox-Time handler does not (?) have got an informations about time shift or time zones, but astronomical algoriths usually need at least UTC for reference.
My proposal as a workaround would be to add a .moonrockrc (run command) file where e.g. the UTC shift and font-size could be stored.
What do you think about? Are you interested in?

looks nice!
yes, at the moment the plugin assumes that the time zone is GMT - so time zone info would be necessary - ideally this would be something settable within the plugin..
I wonder if it's a big deal to include this in the firmware time struct....

here some more hacking effort:
* implemented UTC shift by means of julian time conversion
* implemented calculation of easter date
* implemented output of week day names and moth names
The source code needs tidy up and optimization, hat to write some own functions or workaraound, since a lot of simple mathematical functions like modf are not (?) implemented to Rockbox compiler, therefore the orgies with the castings.
Runs on Simulator for Sansa e200V1, can not compile for hardware so far :-(

Ho to apply this patch?
First apply plugins-9270moonrock3.0.patch from above. Run it from the /rockbox project directory with -p0 parameter
Then cd /apps/plugins and apply my patch. It works only on moonrock .c, do not forget to backup it with -b parameter.
run make. run make install to your simulator or copy the firmware to your player. do not forget to copy moonrock.dat to apps/plugins directory.
Ok, for the rest of the evening, let's celebrate year's change!
Regards

Ok, a little more improvement. Use the following patch to patch the previous plugins_9270_moonrock_3.4_20091231.patch.
Should compile on Simulator and Hardware. Added a function to print double numbers in strings, since the platform compiler does not support double output in snprintf.
Still looking forward to implement phasehunt and prediction of next phases.

I have checked using the x5l simulator - fresh chechout, applying the latest (22/7) patch, copying the dat file to apps/plugin in the source
then make. It seems to work - does it exit the plugin or does it give an error ("no image data") and go into main menu?
(the dat file is combination of jpg files and data)