Only small things, what do you (users & devs) think of these?
All these modifications suggestions have been successfully tested on my SD1000. Diffs are against r412, but just designed as reminders to do it manually. I can make a true patch against any release (or branche) with the desired features...
1. Fix get_nr_raw ubasic command [juciphox-416]I guess this is a bug fix, because everything has already been prepared to include this command, except one line:
lib/ubasic/tokenizer.c:116
+ {"get_raw_nr", TOKENIZER_GET_RAW_NR},
This is very useful when want to use set_nr_raw and to restore the state of the camera at the end of the script.
2. Add get_raw ubasic command [juciphox-416]Same thing that get_raw, useful to restore the state of the camera.
A little bit more stuff to do:
lib/ubasic/tokenizer.h:143
+ TOKENIZER_GET_RAW,
lib/ubasic/tokenizer.c:117
+ {"get_raw", TOKENIZER_GET_RAW},
lib/ubasic/ubasic.c:220
+ case TOKENIZER_GET_RAW:
+ accept(TOKENIZER_GET_RAW);
+ r = ubasic_camera_get_raw();
+ break;
core/conf.c:90
+
+int ubasic_camera_get_raw()
+{
+ // "Off", "On"
+ return conf.save_raw;
+}
include/platform.h:414
+int ubasic_camera_get_raw();
3. Force restoring when interrupting script [juciphox-417]I like restoring the state of the camera at the end of scripts. Problem: if the user interrupts the script pressing shoot_full, nothing is restored. For instance for picture size, when I change the propcase it is taken into account but the Canon GUI still displays the previous setting, so the user cannot know that the size has changed: very annoying. So at first I was scruting the buttons in the script loop, and if the user pressed shoot_half it went directly to restoring. But you have to warn the user at first to use shoot_half instead of shoot_full to interrupt the script, you're not sure he will do it, and keys scrutation is not very reliable. In brief, it's very dirty.
So my solution: when shoot_full is clicked during script execution, CHDK tries to jump to a label called "restore". If it doesn't exist, script is interrupted. If restoring is too long and the user clicks a second time shoot_full, then script is interrupted (so there is always a way to interrupt script execution whatever crazy stuff there is after "restore" label).
The diff file (not that long):
lib/ubasic/ubasic.c:405
-static int
+int
jump_label(char * label)
lib/ubasic/ubasic.h:57
+int jump_label(char * label);
lib/ubasic/ubasic.c:50
#endif
+#include "../../include/conf.h"
lib/ubasic/ubasic.c:425
+if (state_kbd_script_run == 1) {
DEBUG_PRINTF("Label %s not found", label);
ubasic_error = UBASIC_E_UNK_LABEL;
+}
return 0;
core/kbd.c:454
if (!state_kbd_script_run){
script_console_clear();
script_console_add_line(lang_str(LANG_CONSOLE_TEXT_STARTED));
script_start();
-} else {
+} else
+if (state_kbd_script_run == 2)
+{
script_console_add_line(lang_str(LANG_CONSOLE_TEXT_INTERRUPTED));
script_end();
+} else
+{
+ state_kbd_script_run = 2;
+ if (jump_label("restore") == 0)
+ {
+ script_console_add_line(lang_str(LANG_CONSOLE_TEXT_INTERRUPTED));
+ script_end();
+ }
+}
4. First element selected when opening menu [juciphox-416]When you open a menu or enter a submenu, no line is selected by default. So you have to click one button to select one line (either the first one or the last one). I don't feel it very intuitive, and I prefer when the first line is selected by default, and you save one click when you want to go down!
So is there a good reason why it is like that? What do you guys prefer?
Here is what to do to change it:
core/gui_menu.c:51
-gui_menu_set_curr_menu(menu_ptr, 0, -1);
+gui_menu_set_curr_menu(menu_ptr, 0, 0);
core/gui_menu.c:241
-gui_menu_set_curr_menu((CMenu*)(curr_menu->menu[gui_menu_curr_item].value), 0, -1);
+gui_menu_set_curr_menu((CMenu*)(curr_menu->menu[gui_menu_curr_item].value), 0, 0);
core.gui_menu.c:275
-gui_menu_set_curr_menu(curr_menu, 0, -1);
+gui_menu_set_curr_menu(curr_menu, 0, 0);
core.gui_menu.c:283
-gui_menu_set_curr_menu((CMenu*)(curr_menu->menu[gui_menu_curr_item].value), 0, -1);
+gui_menu_set_curr_menu((CMenu*)(curr_menu->menu[gui_menu_curr_item].value), 0, 0);
5. Modulo in file browser navigation [juciphox-416]Just like the previous thing, I didn't feel intuitive to not being able to go to the last line by clicking up on the first line (and to the first clicking down on the last one), like in the menus. So again are there good reasons, what do you prefer ? (it is still possible to use zoom_in and zoom_out to go quickly to the first or last line).
So if you want to do it.
core/gui_fselect.c:363
- register int j;
+ register int j, i;
core/gui_fselect.c:368
if (selected->prev)
selected=selected->prev;
+ else
+ if (step == 1)
+ {
+ for(; selected->next; selected=selected->next);
+ for (i=0, top=selected; i<NUM_LINES-1 && top->prev; ++i, top=top->prev);
+ }
core/gui_fselect.c:383
if (selected->next)
selected=selected->next;
+ else
+ if (step == 1)
+ {
+ for(; top->prev; top = top->prev);
+ selected = top;
+ }
6. Swap zoom_in/out for increment value changeI'm starting to wonder if I'm "normal", but once again I don't feel intuitive at all to increase the increment using zoom_out, and to decrease it using zoom_in. I mean when you start up your camera, it is zoomed out, and if you want to change the zoom you will zoom in, and if you want to restore you will zoom out. Here when you begin the increment is 1, so if you want to change it you should use zoom in, and if you want to restore it to use zoom out...
What do you think?...
Trivial diff:
gui_menu.c:316
-case KEY_ZOOM_IN:
+case KEY_ZOOM_OUT:
-case KEY_ZOOM_OUT:
+case KEY_ZOOM_IN:
7. Fix alt-button click in alt-mode triggers original function [juciphox-417]I already created a
ticket on CHDK trac, but it doesn't seem to really be used...
A short click on alt-button is supposed to switch alt-mode, and a long click to trigger the original function of the button.
It works when you are outside alt-mode, but when you are inside alt-mode short click both exits alt-mode AND triggers original function of alt-button. Consequently you cannot exit alt-mode without triggering the original function of the alt-button, so the long click emulation is useless.
The problem is that given the existing structure of the kbd_process function, it was impossible to fix this, because it was managing the delay emulation with the same code for both alt-mode and normal-mode, but always in alt-mode. Thus I had to organize differently the function and that's quite a lot of lines changed, so it should be tested by several people to ensure that bugs weren't introduced during the process before to include it somewhere (I tested it and it seems ok, but we are never sure...).
I also restored the auto iso shift management because it seems to work perfectly (do you know why it was commented out?), and fixed a small possible bug: when the alt-button is released between CAM_EMUL_KEYPRESS_DELAY and CAM_EMUL_KEYPRESS_DELAY+CAM_EMUL_KEYPRESS_DURATION, then the emulated alt-button was never released (that's only 50ms but...).
core/kbd.c:334
-long kbd_process()
-{
-/* Alternative keyboard mode stated/exited by pressing print key.
- * While running Alt. mode shoot key will start a script execution.
- */
-
- if (kbd_blocked){
- if (key_pressed){
- if (kbd_is_key_pressed(conf.alt_mode_button)) {
- ++key_pressed;
- if (key_pressed==CAM_EMUL_KEYPRESS_DELAY) {
- kbd_key_press(conf.alt_mode_button);
- } else if (key_pressed==(CAM_EMUL_KEYPRESS_DELAY+CAM_EMUL_KEYPRESS_DURATION)) {
- kbd_key_release(conf.alt_mode_button);
- key_pressed = 2;
- kbd_blocked = 0;
-// gui_kbd_leave();
- }
- } else if (kbd_get_pressed_key() == 0) {
- if (key_pressed!=100)
- gui_kbd_enter();
- key_pressed = 0;
- }
- return 1;
- }
-
- if (kbd_is_key_pressed(conf.alt_mode_button)){
- key_pressed = 2;
- kbd_blocked = 0;
- gui_kbd_leave();
- return 1;
- }
-
- if (kbd_is_key_pressed(KEY_SHOOT_FULL)){
- key_pressed = 100;
- if (!state_kbd_script_run){
- script_console_clear();
- script_console_add_line(lang_str(LANG_CONSOLE_TEXT_STARTED));
- script_start();
- } else {
- script_console_add_line(lang_str(LANG_CONSOLE_TEXT_INTERRUPTED));
- script_end();
- }
- }
-
- if (state_kbd_script_run)
- process_script();
- else {
- gui_kbd_process();
- }
- } else {
-
-// if (kbd_is_key_pressed(KEY_SHOOT_HALF) && kbd_is_key_pressed(conf.alt_mode_button)) return 0;
-
- if (!key_pressed && kbd_is_key_pressed(conf.alt_mode_button)){
- kbd_blocked = 1;
- key_pressed = 1;
- kbd_key_release_all();
-// gui_kbd_enter();
- return 1;
- } else
- if ((key_pressed == 2) && !kbd_is_key_pressed(conf.alt_mode_button)){
- key_pressed = 0;
- }
-
- if (conf.use_zoom_mf && kbd_use_zoom_as_mf()) {
- return 1;
- }
- }
-
- return kbd_blocked;
-}
+long kbd_process()
+{
+/* Alternative keyboard mode stated/exited by pressing print key.
+ * While running Alt. mode shoot key will start a script execution.
+ */
+ // deals with alt-mode switch and delay emulation
+ if (key_pressed)
+ {
+ if (kbd_is_key_pressed(conf.alt_mode_button) ||
+ ((key_pressed >= CAM_EMUL_KEYPRESS_DELAY) &&
+ (key_pressed < CAM_EMUL_KEYPRESS_DELAY+CAM_EMUL_KEYPRESS_DURATION)))
+ {
+ if (key_pressed <= CAM_EMUL_KEYPRESS_DELAY+CAM_EMUL_KEYPRESS_DURATION)
+ key_pressed++;
+ if (key_pressed == CAM_EMUL_KEYPRESS_DELAY)
+ kbd_key_press(conf.alt_mode_button);
+ else if (key_pressed == +CAM_EMUL_KEYPRESS_DELAY+CAM_EMUL_KEYPRESS_DURATION)
+ kbd_key_release(conf.alt_mode_button);
+ return 1;
+ } else
+ if (kbd_get_pressed_key() == 0)
+ {
+ if (key_pressed != 100 && (key_pressed < CAM_EMUL_KEYPRESS_DELAY))
+ {
+ kbd_blocked = 1-kbd_blocked;
+ if (kbd_blocked) gui_kbd_enter(); else gui_kbd_leave();
+ }
+ key_pressed = 0;
+ return 1;
+ }
+ return 1;
+ }
+
+ // auto iso shift
+ if (kbd_is_key_pressed(KEY_SHOOT_HALF) && kbd_is_key_pressed(conf.alt_mode_button)) return 0;
+
+ if (kbd_is_key_pressed(conf.alt_mode_button))
+ {
+ key_pressed = 1;
+ kbd_key_release_all();
+ return 1;
+ }
+
+ // deals with the rest
+ if (kbd_blocked)
+ {
+ if (kbd_is_key_pressed(KEY_SHOOT_FULL))
+ {
+ key_pressed = 100;
+ if (!state_kbd_script_run)
+ {
+ script_console_clear();
+ script_console_add_line(lang_str(LANG_CONSOLE_TEXT_STARTED));
+ script_start();
+ } else
+ {
+ script_console_add_line(lang_str(LANG_CONSOLE_TEXT_INTERRUPTED));
+ script_end();
+ }
+ }
+
+ if (state_kbd_script_run)
+ process_script(); else
+ gui_kbd_process();
+ } else
+ {
+ if (conf.use_zoom_mf && kbd_use_zoom_as_mf())
+ return 1;
+ }
+
+ return kbd_blocked;
+}
(be careful, modification #3 changes some code in this function, that is not taken into account here)
EDIT 2008/06/178. Don't show script params if no param [juciphox-424]I don't know why, but when a script has no parameter, three parameters a/b/c are still shown. I don't like it, because visually you think there are parameters so you read them, just to see that there are actually no parameter, and you just waste time... I guess the idea was to provide three parameters without having to declare them, but honestly it's not difficult to declare parameters when you need it, and you can give an actual title, so I don't think these automatic params are worth the pain. What do you think?
My modifications to CHDK9. Display zebra only when necessary [juciphox-424]When zebra are displayed, all the built-in OSD disappears. That's without doubt why the "Blink#" zebra modes exist, but I still feel annoying that the OSD blink too. So what I did is to not drawing zebra at all when there is no under/over-exposed region, so that the built-in OSD is still there. It has another advantage: you'll see more easily when there are under/over-exposed regions, because your OSD will disappear/blink in addition to the actual zebra. And if no problem, no pain.
My modifications to CHDKEDIT 2008/06/2211. Save script parameters values and parameters sets [juciphox-428]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.
You can also save up to 10 different parameters sets for each script, and switch easily between them.
My modifications to CHDKEDIT 2008/06/2712. Show and erase RAW in review modeSo 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
My modifications to CHDKThe current viewed file name address is maybe platform dependent...
I'm waiting for your feedback!