Assembla home | Assembla project page
 

Ticket #11 (closed defect: invalid)

Opened 1 year ago

Last modified 7 months ago

alt-button's original function triggered on short click when inside alt-mode

Reported by: cyril42e Assigned to: phyrephox
Priority: minor Keywords: alt-button
Cc:

Description

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:

  • long click triggers original function, and
  • short click enters alt-mode.

However when you are inside alt-mode:

  • long click triggers original function, but
  • short click exits alt-mode AND triggers original function too!

That's pretty annoying, because you cannot exit alt-mode without triggering the original function of the alt-button, so you have to disable it, and you waste one key.

Change History

06/09/08 03:36:45 changed by cyril42e

I had to reorganize a little bit the kbd_process function, because it was managing the delay emulation with the same code for both alt-mode and normal-mode, but always in alt-mode... so it was impossible to fix the bug with this structure.

I hope the new structure is clear, I tested it on my SD1000 and it works perfectly (I didn't test zoom focus but I didn't change this part).

I also restored auto-iso-shift management, at a different place, and it works perfectly too. What was the reason why it was disabled? I also 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...).

So if somebody wants to test it and add it to the trunk...

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;
+}

(in reply to: ↑ description ) 06/10/08 07:35:36 changed by dzsemx

try to uncomment this line in your platform/sd1000/kbd.c //physw_status[1] |= alt_mode_key_mask; should work with current trunc code i had the same problem with a650 for more look at platform/a650/kbd.c

Replying to cyril42e:

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: - long click triggers original function, and - short click enters alt-mode. However when you are inside alt-mode: - long click triggers original function, but - short click exits alt-mode AND triggers original function too! That's pretty annoying, because you cannot exit alt-mode without triggering the original function of the alt-button, so you have to disable it, and you waste one key.

08/03/08 22:53:56 changed by phyrephox

did this land in trunk yet? just checking old tickets.

08/13/08 22:49:24 changed by phyrephox

  • owner set to phyrephox.
  • status changed from new to assigned.

http://chdk.setepontos.com/index.php/topic,265.msg19753.html#msg19753 there seems to be a shorter fix for this, will check it out later sometime.

10/09/08 17:59:41 changed by phyrephox

hm. do we still need this? hmhm.

10/20/08 16:33:13 changed by anonymous

Ô¸Ä}{

12/02/08 23:53:17 changed by phyrephox

  • status changed from assigned to closed.
  • resolution set to invalid.