modemap - General Discussion and Assistance - CHDK Forum

modemap

  • 4 Replies
  • 5206 Views
*

Offline fudgey

  • *****
  • 1705
  • a570is
modemap
« on: 04 / July / 2008, 15:45:34 »
Advertisements
I was planning on doing some awfully non-portable scripting and needed mode dial propcase values for all models. Well, if I'm not mistaken, they are listed in platform/*/main.c in a struct called modemap.

I checked platform/a570/main.c for propcase 49/50 values from my camera and found out they aren't the same... are the a570is modemap values copy&pasted from some other model and never checked or are they supposed to be different from the propcase values? Does CHDK even currently use the modemap for anything?

Of course, ultimately I only need a ubasic command which tells me the mode (I suppose the enum number from include/platform.h is fine). My memory leaks like [insert software&OS you hate] so I can't remember if we already have something like that in some build...

In any case for this to work properly the values need to actually be correct for all camera models. So, if modemap is supposed to match the propcase (49 and 50 in Digic III), below is a diff against trunk 430 to fix it for the a570is:

Code: [Select]
--- platform/a570/main.c-trunk430
+++ platform/a570/main.c
@@ -37,32 +37,27 @@
        int hackmode;
        int canonmode;
 } modemap[] = {
-    { MODE_AUTO,               32768 },
-    { MODE_P,                  32772 },
-    { MODE_TV,                 32771 },
-    { MODE_AV,                 32770 },
-    { MODE_M,                  32769 },
+    { MODE_AUTO,               -32768 },
+    { MODE_P,                  -32764 },
+    { MODE_TV,                 -32765 },
+    { MODE_AV,                 -32766 },
+    { MODE_M,                  -32767 },
     { MODE_VIDEO_STD,          2597  },
     { MODE_VIDEO_SPEED,        2598  },
     { MODE_VIDEO_COMPACT,      2599  },
-    { MODE_STITCH,             33290 },
+    { MODE_STITCH,             -33246 },
     { MODE_SCN_WATER,          16406 },
     { MODE_SCN_AQUARIUM,       16407 },
     { MODE_SCN_NIGHT,          16398 },
-    // { MODE_SCN_CHILD,          16399 },
-    // { MODE_SCN_PARTY,          16400 },
     { MODE_SCN_GRASS,          16402 },
     { MODE_SCN_SNOW,           16403 },
     { MODE_SCN_BEACH,          16404 },
     { MODE_SCN_FIREWORK,       16405 },
-    // { MODE_SCN_ISO_3200,       16411 },
-    { MODE_INDOOR,             32785 },
-    { MODE_KIDS_PETS,          32764 },
-    { MODE_NIGHT_SNAPSHOT,     32779 },
-    { MODE_LANDSCAPE,          32780 },
-    { MODE_PORTRAIT,           32781 },
-    // { MODE_SCN_SPORT,          16903 },
-    // { MODE_SCN_COLOR_ACCENT,   16921 }
+    { MODE_INDOOR,             -32751 },
+    { MODE_KIDS_PETS,          -32752 },
+    { MODE_NIGHT_SNAPSHOT,     -32757 },
+    { MODE_LANDSCAPE,          -32756 },
+    { MODE_PORTRAIT,           -32755 },
 };
 #define MODESCNT (sizeof(modemap)/sizeof(modemap[0]))

*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: modemap
« Reply #1 on: 04 / July / 2008, 16:02:23 »
unfortunately this list isnt completely done for all cameras, afaik only a few models have all the modes correctly written down in the main.c files. for example on my s3is it lacks the sports mode dial position. i'm having the same problem as you, i have written functional code already that prevents the writing of raw in certain situations (among them, in sportsmode), which i can't roll out right now because of this issue. don't know how this can be solved though, by sifting through the firmwares or by user-interaction... this would take ages.

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: modemap
« Reply #2 on: 04 / July / 2008, 16:30:34 »
This makes me think... user interaction would be more useful if we had a mechanism to directly contact willing & able users of a certain camera whenever the developers have something to ask.

Personal messages on this forum could be good if the forum software supports creating user groups like that, but a regular (moderated) mailing list for each camera would work as well. The key is to have those people subscribe to receive the messages instead of hoping for them to eventually read and maybe respond on the forum or wiki.


*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: modemap
« Reply #3 on: 04 / July / 2008, 16:50:54 »
well, imo we need a bugtracker
* PhyrePhoX slaps acseven over the head with a big trout :D


*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: modemap
« Reply #4 on: 11 / July / 2008, 14:45:00 »
Aww... just found out something.

Enable Debug Parameters -> "Show PropCases" and "PropCase Page" = 5 (to show propcase 50 of Digic III, I suppose page 23 and propcase 236 are good for the Digic II propset?

Then run the script below to show what uBasic thinks of propcases 49 and 50. Compare. Turn the mode dial, compare, etc... For my a570is they aren't even close except for maybe one mode. And this isn't just the sign (The debug view doesn't seem to interpret the propcase values as two's complement (signed) whereas uBasic does (and quite rightly so in the cases I know of)).

Code: [Select]
@title modemaptest
@param a dummy
@default a 0

:loop
  get_prop 49 A
  get_prop 50 B
  print "49:"A " 50:"B
  sleep 500
goto "loop"

The debug view gives numbers in trunk modemap (I didn't check them all):
http://tools.assembla.com/chdk/browser/trunk/platform/a570/main.c#L39

and the above script gives the values I listed above in this thread.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal