I finally spend some time over the last week looking at CHDK GPS functionality on my S100. Started out just wanting to update the CHDK manual (using the CHDK-DE google translated manual as a basis) but then things got a little out of control.
Attached is a patch file with the results so far. Principal changes are :
- Tranlated symbols & comments from German to English. I hope nobody will be too offended by this but as philmoz pointed out here having the code all in German has & will hinder much further development
- Added rudi's changes from this post : http://chdk.setepontos.com/index.php?topic=12076.msg118315#msg118315
- Start the main data task from spytask rather than CHDK OSD. Previously, CHDK GPS code would not run until CHDK OSD was enabled.
- Conversion to .flt module format for memory space saving.
- Changes to many (English) text strings to more closely define their function and to fit on the S100 LCD (which is narrower than the SX230 apparently)
- Change to the main GPS menu so that selecting one of compass or track to home or track to picture mode resets the the others (they are mutually exclusive).
- Converted error & warning messages to have a solid white background (from tranparent) to make sure they are seen.
- Show compass mode no longer displays navigation info ( although I will put back some direction and rate info when I get a minute)
- Simplified the code that gets (optionally) added to kbd.c (used so that pressing the DISP button cancels timeouts).
- Assorted small bug fixes - things like mallocs without free, tasks that end without calling ExitTask(), interlock that don't always interlock, and variable that do not do anything
As far as the conversion to .flt module, I'm not too happy with how I had to add stuff to generic/wrappers.c so that non-GPS cameras build properly (labels in module_exportlist.c require real target addresses - unlike labels in core/gps.c which seem to be ignored by the linker if the code is not actually called?) I'm sure there must be a better way?
Oh, and it crashes occasionally. But it also crashed occasionally prior to my making any changes. So it may be the same bug or I may have fixed that one but created others. Looking at ROMLOG.LOG, it seems to kill random task although InitCHDKPTP seems to be come up a lot of the time (both before and after the patch is applied).
Just thought I'd put this out for comments prior to putting a lot more work into it.
Edit : added point 3 about starting GPS_DATA task from spytask rather that CHDK OSD