My modifications to CHDK - page 2 - General Discussion and Assistance - CHDK Forum supplierdeeply

My modifications to CHDK

  • 28 Replies
  • 17085 Views
*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: My modifications to CHDK
« Reply #10 on: 18 / June / 2008, 16:55:59 »
Advertisements
Just my 5 cents or so, but I find the default a b c parameter thing quite unnecessary, confusing and ugly... I don't have any need for such a quick way to access the three first parameter letters (I can't remember what a parameter does unless I give it a proper description anyway, and since we can't create scripts in-camera, there's always time for those 10 seconds it takes to finish the script by copy-pasting a @param/@default line from an old script).

I do have use for scripts with no parameters, and I have created one or two with a single dummy parameter to make those three default ones go away.

And cyril42e, keep up the good work polishing some of the rough edges in CHDK (and whatever you may come up with), your improvements are very welcome!

Btw, #11 really is a familiar feature request and it is something I'd find very useful. There should probably be some sort of detection for changes in the script, though, to prevent odd behavior when the script is updated and parameter assignments change (like a script file checksum stored in the config file, or just a simple file date and size check while loading the script).

*

Offline cyril42e

  • ***
  • 111
  • SD1000/Ixus70 1.02a
    • CR-TEKnologies
Re: My modifications to CHDK
« Reply #11 on: 18 / June / 2008, 20:26:23 »
Added 8 and 9. ;)
:)

edit: Ok, done. Now, should I commit this..? :]
As it could be understood from my post, I completely agree with fudgey. From my point of view there is no advantage to these default variables, because it's encouraging bad practice. But if some people really do want to keep this feature, your solution could be a good compromise :). Happy not to have to decide :P.

I think 11 has been requested before. If you have the enthusiasm, go for it. :]
I'll go for it :)
Btw, #11 really is a familiar feature request and it is something I'd find very useful. There should probably be some sort of detection for changes in the script, though, to prevent odd behavior when the script is updated and parameter assignments change (like a script file checksum stored in the config file, or just a simple file date and size check while loading the script).
Very good point! I'll see what I can do. Thanks!

And cyril42e, keep up the good work polishing some of the rough edges in CHDK (and whatever you may come up with), your improvements are very welcome!
Thank you for your encouragement! :)

*

Offline cyril42e

  • ***
  • 111
  • SD1000/Ixus70 1.02a
    • CR-TEKnologies
Re: My modifications to CHDK
« Reply #12 on: 22 / June / 2008, 14:05:03 »
So here it is:

11. Save script parameters values
Instead of initializing parameters with default values when a script is loaded, they are initialized with the same value than last time the script was run. Parameters values are stored in a file A/CHDK/DATA/script-name.cfg, with the same syntax than script header (@param & @default). Parameter descriptions are compared and value is restored only if it hasn't changed. Values are saved when the script is started. There is a new menu item "Load default param values" to load default values instead of saved values.

EDIT: now manages parameters sets too. Latest diff file: 11_script-params-sets_r5_juciphox427.svn.diff


Suggestion: instead of having a script submenu:

...
----- Current script -----
script-name
------- Parameters -------
param1                  [4]
param2                  [2]
...


why not having:

...
------- script-name -------
param1                  [4]
param2                  [2]
...


It would save two lines, available to display more script parameters without scrolling (ie you can see them directly) (I suggest that because I added one menu item and it hides one more parameter :(. But it may not be clear anymore for newbies that there are parameters...)
« Last Edit: 30 / June / 2008, 08:05:08 by cyril42e »

*

Offline wontolla

  • ****
  • 413
  • S3 & G9 & A720
Re: My modifications to CHDK
« Reply #13 on: 22 / June / 2008, 14:35:52 »
Woooow cyril42e!

Let me be the first to congratulate you.

I use to have sets of files with different default parameters for my timelapses, it was a mess. But not anymore!

Downloading your changes... :lol


*

Offline cyril42e

  • ***
  • 111
  • SD1000/Ixus70 1.02a
    • CR-TEKnologies
Re: My modifications to CHDK
« Reply #14 on: 22 / June / 2008, 17:19:28 »
Let me be the first to congratulate you.
Thanks :) (however that's nothing compared to what other CHDK developers are doing ;))

Quote
I use to have sets of files with different default parameters for my timelapses, it was a mess. But not anymore!
Not sure to understand... You can only save one set of parameters, so you still will have to change them if you want different sets of parameters...?

It would be possible to implement saving of different parameters sets though. The easy way would be one more menuitem "int" to chose the parameters set, parameters are automatically saved to the given set (so no name, and no delete, only overwrite). Is that what you would like wontolla?

EDIT: done, new diff file

Oh, concerning the mess in scripts, I had another idea: being able to call scripts from inside scripts. Something like:
script <scriptname> [param1] [param2] ...
Some work to do to save the context (maybe allowing only one degree of inclusion), but it would be more readable and reliable than including them manually, having to change variable names, and propagate changes etc...
« Last Edit: 22 / June / 2008, 23:59:49 by cyril42e »

*

Offline cyril42e

  • ***
  • 111
  • SD1000/Ixus70 1.02a
    • CR-TEKnologies
Re: My modifications to CHDK
« Reply #15 on: 26 / June / 2008, 20:54:41 »
12. Show and erase RAW in review mode

So the idea is, when in review mode:
- to display in OSD if there is a RAW file corresponding to the current viewed JPG
- to allow in alt-mode RAW deletion (disp button), but also navigation between pictures (left/right) and jpg deletion (bottom) like outside alt-mode

Code: [Select]
platform/ixus70_sd1000/sub/102a/stubs_min.S:15
+DEF(review_file,0xF640)
include/platform.h:58
+extern char review_file;

core/raw.h:28
+extern static char prefixes[][4];
+extern static char exts[][4];
core/raw.c:16
-static char raw_prefixes[][4] = { "IMG", "CRW", "SND" };
-static char raw_exts[][4] = { "JPG", "CRW", "CR2", "THM", "WAV" };
+char raw_prefixes[][4] = { "IMG", "CRW", "SND" };
+char raw_exts[][4] = { "JPG", "CRW", "CR2", "THM", "WAV" };
gui_osd.h:61
+extern char* gui_raw_file;
+extern int gui_raw_exists;
gui_osd.c:24
+char gui_raw_file[64] = "";
+int gui_raw_exists = 0;
core/gui_osd.c:15
+#include "raw.h"
core/gui_osd.c:691
+void gui_osd_draw_raw_file()
+{
+ int pos, fd;
+
+ strncpy(gui_raw_file, &review_file, 64);
+ if (gui_raw_file[63] != 0) return;
+ pos = strlen(gui_raw_file);
+ strncpy(gui_raw_file+pos-12, raw_prefixes[conf.raw_prefix], 3);
+ strncpy(gui_raw_file+pos-3, raw_exts[conf.raw_ext], 3);
+ if (!conf.raw_in_dir) strncpy(gui_raw_file+7, "100", 3);
+ fd = open(gui_raw_file, O_RDONLY, 0777);
+ if (fd >= 0)
+ {
+ gui_raw_exists = 1;
+ close(fd);
+ draw_string(conf.mode_raw_pos.x, conf.mode_raw_pos.y, "RAW pic", conf.osd_color_warn);
+ } else
+ {
+ draw_string(conf.mode_raw_pos.x, conf.mode_raw_pos.y, "", conf.osd_color_warn);
+ gui_raw_exists = 0;
+ }
+}
core/gui.c:2032,gui_draw_osd
+ if ((m&MODE_MASK) == MODE_PLAY && conf.show_raw_state && !mode_video)
+ gui_osd_draw_raw_file();
+
  if ((m&MODE_MASK) == MODE_REC && (recreview_hold==0 || conf.show_osd_in_review) ) {

core/gui.c:1671
+static void gui_delete_raw_selected(unsigned int btn)
+{
+ if (btn == MBOX_BTN_YES)
+ {
+ if  (gui_raw_exists) remove(gui_raw_file);
+ }
+}
core/gui.c:1751,gui_kbd_process
 case GUI_MODE_ALT:
+ if ((mode_get()&MODE_MASK) == MODE_PLAY)
+ {
+ if (kbd_is_key_clicked(KEY_LEFT))
+ { kbd_key_press(KEY_LEFT); pressed_key = KEY_LEFT; } else
+ if (kbd_is_key_clicked(KEY_RIGHT))
+ { kbd_key_press(KEY_RIGHT); pressed_key = KEY_RIGHT; } else
+ if (kbd_is_key_clicked(KEY_DOWN))
+ { kbd_key_press(KEY_DOWN); pressed_key = KEY_DOWN; } else
+ if (kbd_is_key_clicked(KEY_UP))
+ { kbd_key_press(KEY_UP); pressed_key = KEY_UP; } else
+ if (kbd_is_key_clicked(KEY_SET))
+ { kbd_key_press(KEY_SET); pressed_key = KEY_SET; } else
+ if (kbd_is_key_clicked(KEY_DISPLAY))
+ {
+ gui_mbox_init(LANG_MSG_DELETE_RAW, (int)"", MBOX_FUNC_RESTORE|MBOX_BTN_YES_NO, &gui_delete_raw_selected);
+ }
+ } else {
  if (kbd_is_key_clicked(SHORTCUT_TOGGLE_RAW)) {
core/gui.c:1862,kbd_key_processed
  }
+ }
  break;
 case GUI_MODE_MENU:
core/gui_lang.h:488
+#define LANG_MSG_DELETE_RAW       384
core/gui_lang.h:492
-#define GUI_LANG_ITEMS                  383
+#define GUI_LANG_ITEMS                  384
core/gui_lang.c:502
+"384 \"Delete RAW?\"\n"

So only the current viewed file name address is maybe platform dependant... Are there RAM dumps available for all platforms?
« Last Edit: 27 / June / 2008, 06:54:17 by cyril42e »

*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: My modifications to CHDK
« Reply #16 on: 27 / June / 2008, 03:01:49 »
Hah thats funny,that would have been my next project :)
In review_file,do you see the whole name? And also if it is an avi? Because then i could code slideshows... We only need to find out if a shown movie is playing or paused.anyhow,nice progress,thanks!

*

Offline cyril42e

  • ***
  • 111
  • SD1000/Ixus70 1.02a
    • CR-TEKnologies
Re: My modifications to CHDK
« Reply #17 on: 27 / June / 2008, 07:29:57 »


*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: My modifications to CHDK
« Reply #18 on: 27 / June / 2008, 07:47:16 »
well, playback is on every canon camera, but for example on my a620 it 5ucks very much in comparison to the one on the s3is.
by the way, check out #21 in for devs: vacant jobs, must-have features, status & overview / for users: a poll
you can see that your feature can possibly lead to a whole new range of features, at least these are some of the features i thought of when i compiled the list.

*

Offline Jucifer

  • *****
  • 251
  • [A710IS]
Re: My modifications to CHDK
« Reply #19 on: 29 / June / 2008, 14:09:52 »
Suggestion: instead of having a script submenu:

...
----- Current script -----
script-name
------- Parameters -------
param1                  [4]
param2                  [2]
...


why not having:

...
------- script-name -------
param1                  [4]
param2                  [2]
...


I'd like that. :]

Tried to add tweak 11 (with sets), didn't quite succeed yet (cam doesn't start properly). :I
Maybe I'll try again some other day.

 

Related Topics