hide_osd() script function - page 7 - General Discussion and Assistance - CHDK Forum

hide_osd() script function

  • 98 Replies
  • 35552 Views
*

Offline lapser

  • *****
  • 1093
Re: hide_osd() script function
« Reply #60 on: 02 / October / 2013, 12:43:31 »
Advertisements
OK, now we're back on track. I love bit fields, and "magic number" parameters for scripts. You have to look it up once when you're writing the script, but the script presents the options in human readable form, like "Press <set> to toggle".  If reyalp and Phil like the idea, we can develop it further. Implementation is a little more work, but it won't be that hard.

As long as you're using a bit field, you could also have a bit for "toggle". 0x8F would toggle everything, or 0x81 would just toggle <alt> line. Personally, I would prefer to use the sign bit, i.e. -0xF to toggle everything.

I don't think the "get" function would be needed, with a toggle bit.

 By the way, do ubasic and Lua both accept hex, "0x0F" numerical input?  Is "-0xF" valid?
====
Also, I think I solved the touchscreen issue in a camera independent way. When the osd is hidden, pressing ANY key on the touch screen shows the osd, and touch screen buttons. The actual key clicked while the osd is hidden is ignored. This is the code, added to kbd_process.c
Code: [Select]
    // Set clicked key for scripts.
    if (kbd_get_clicked_key())
    {
        camera_info.state.kbd_last_clicked = kbd_get_clicked_key();
        camera_info.state.kbd_last_clicked_time = get_tick_count();
//#ifdef CAM_TOUCHSCREEN_UI
        if(camera_info.state.osd_off)
        {
          camera_info.state.osd_off=0;
          camera_info.state.kbd_last_clicked = 0;
        }
//#endif
    }
I commented out the #ifdef for testing on my camaera, and it works correctly. Is there someone with a touchscreen camera who could test it for me?

A better way to do it would be to only turn on the key outlines, and turn them back off if you press the screen outside the key area. I'll need a tester before I can work on that idea.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

Re: hide_osd() script function
« Reply #61 on: 02 / October / 2013, 20:49:16 »
I love bit fields, and "magic number" parameters for scripts.
The need to use magic numbers might ultimately cause this proposal to get rejected.

Quote
As long as you're using a bit field, you could also have a bit for "toggle". 0x8F would toggle everything, or 0x81 would just toggle <alt> line. Personally, I would prefer to use the sign bit, i.e. -0xF to toggle everything. I don't think the "get" function would be needed, with a toggle bit.
Please go back and reread why toggle was rejected and the "get" functions requested.  Nothing has changed in that regard.

Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline lapser

  • *****
  • 1093
Re: hide_osd() script function
« Reply #62 on: 03 / October / 2013, 01:02:20 »
The need to use magic numbers might ultimately cause this proposal to get rejected.
Please go back and reread why toggle was rejected and the "get" functions requested.  Nothing has changed in that regard.
I was thinking the same thing. Would you be happy with just adding 2 more functions?

set_alt_line( 0 | false | 1 | true)
get_alt_line()

This way, you could hide everything, or just hide the <alt> line. It would work the same way as set_chdk_osd().
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

Re: hide_osd() script function
« Reply #63 on: 03 / October / 2013, 08:06:07 »
I was thinking the same thing. Would you be happy with just adding 2 more functions?
I would have been happy with any of the various patches proposed so far.  But I think the general CHDK philosophy is for scripts functions to provide the cleanest basic functionality necessary for the script coder to use in building up his script  (rather than highly specialized functions with long names).

Quote
set_alt_line( 0 | false | 1 | true)
get_alt_line()
This way, you could hide everything, or just hide the <alt> line. It would work the same way as set_chdk_osd().
I guess that's as good as it gets.  When you say it works the same way as set_chdk_osd() I assume you mean it just enables / disables display of the <ALT> and script name ?  Other OSD icons and the console need to be managed seperately?
Ported :   A1200    SD940   G10    Powershot N    G16

Re: hide_osd() script function
« Reply #64 on: 03 / October / 2013, 08:20:22 »
This way, you could hide everything, or just hide the <alt> line. It would work the same way as set_chdk_osd().

Sorry, I don't follow the thread very carefully, but as far as I get it you want to have two things:

  • set_chdk_osd() which turns on/off all CHDK OSD except ALT line
  • set_alt_line() which aims to turn on/off the ALT line only or ALT line AND OSD

?

Isn't it much more clear to provide function like:

set_chdk_osd(0|1|2) which would mean:

  • 0 - nothing from CHDK OSD displayed
  • 1 - only ALT line
  • 2 - everything that is suppoused to be visible is shown

?

Of course argument can have different meaning that above, but you get the idea?
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

Re: hide_osd() script function
« Reply #65 on: 03 / October / 2013, 08:42:39 »
Sorry, I don't follow the thread very carefully, but as far as I get it you want to have two things:
  • set_chdk_osd() which turns on/off all CHDK OSD except ALT line
  • set_alt_line() which aims to turn on/off the ALT line only or ALT line AND OSD
No - sorry for the confusion.  At this point we have settled on just adding the set_alt_line() function.  The set_chdk_osd() function can be handled with existing capabilities and so will not be added.


Quote
Isn't it much more clear to provide function like:
set_chdk_osd(0|1|2) which would mean:
  • 0 - nothing from CHDK OSD displayed
  • 1 - only ALT line
  • 2 - everything that is suppoused to be visible is shown
Of course argument can have different meaning that above, but you get the idea?
That would work but we seem to have decided on the simplest approach of just adding a function to handle hiding the <ALT> line.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline lapser

  • *****
  • 1093
Re: hide_osd() script function
« Reply #66 on: 03 / October / 2013, 09:26:49 »
I would have been happy with any of the various patches proposed so far.  But I think the general CHDK philosophy is for scripts functions to provide the cleanest basic functionality necessary for the script coder to use in building up his script  (rather than highly specialized functions with long names).
I agree with that, and would add that it's best to keep things consistent with the existing functions. That's why I originally wrote it as:
set_chdk_osd( 0 | 1 | -1 )
like:
set_backlight( 0 | 1 )

Adding a "get" function doesn't provide any new capability, and is inconsistent with set_backlight. But as long as it doesn't take away any capability, I can live with it.

But I'll have to say, I don't really have this much time to spend trying to get every simple function into the trunk. I'd like to share some of the new capabilities I've added to my version of CHDK, but I just don't think it's going to be possible unless I can make the final decision about how it's done, after listening to all the suggestions. My final decision in this case would still be my original function, with  a new name, and fixes for the textbox, file browser, and touch screen issues.

Hiding the console, <alt> line, and osd separately is something that can be done in the future if there is a request for it. I don't need that capability, but if anyone ever does, it could be added as an extra parameter to set_chdk_osd. Or, since the chdk osd is one of the options, perhaps we should change the name to:

set_chdk_display(-1|0|1 [, type])
type= default 0 all, 1 <alt> line, 2 console, 3 osd, 4 touchscreen buttons, >4 future)
 
Please don't accuse me of just repeating "do it my way". I'd be happy to do it anybody's way if it at least adds the capability I need. But I don't have the time to add code for cosmetic reasons, i.e. that doesn't provide new capabilities, and even restricts current and new capabilities. Even if it might be a little better to some people, we just don't have the programming resources to do it.

Writing a program is necessarily an obsessive thing to do,  You have to stick with it until it works. But there's a name for obsessive perfectionism: Paralysis. Here's an interesting article on the subject:
http://www.lifehack.org/articles/productivity/why-being-a-perfectionist-may-not-be-so-perfect.html

Quote
Quote
set_alt_line( 0 | false | 1 | true)
get_alt_line()
This way, you could hide everything, or just hide the <alt> line. It would work the same way as set_chdk_osd().
I guess that's as good as it gets.  When you say it works the same way as set_chdk_osd() I assume you mean it just enables / disables display of the <ALT> and script name ?  Other OSD icons and the console need to be managed seperately?
Yes, that's what I meant. With the current get/set paradigm, we need 2 new functions for every new thing we want to show or hide.
=====
@outslider, I just saw your post while I was typing. How do you like the idea to do it the way I described above?

set_chdk_display(-1|0|1 [, type])
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

Re: hide_osd() script function
« Reply #67 on: 03 / October / 2013, 10:08:34 »
OK, now we're back on track. I love bit fields, and "magic number" parameters for scripts.

I am tempted to comment in detail regarding this thread but cannot build-up the enthusiasm.

Just let me say that virtually 100% of SDM users and probably a large percentage of CHDK users have no knowledge or interest in bit fields or the necessity to use 'magic numbers'.

As far as philosophy is concerned, SDM is exactly opposite that of CHDK.

For example, CHDK has uBasic function set_nd_filter 0/1/2.

SDM has nd_filter_off,nd_filter_out and nd_filter_in.

Some of the experienced  programmers in the forum refer to this as "polluting the namespace".


David

*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: hide_osd() script function
« Reply #68 on: 03 / October / 2013, 11:02:42 »
@Microfunguy
SDM is a one man show. A person determines what the user gets. CHDK is the result of a nice community and some genius programmer. That is the difference and nothing else.

@all
set_backlight is a very bad example. After each shoot action a disabled backlight is activated again. Let us try to make as uniform as possible functions. get / set is a proven method.

The consensus seems to be create a new feature to turn off the script title and alt line. All other OSD elements can be deactivated manually or via set_config_value.

msl
CHDK-DE:  CHDK-DE links

Re: hide_osd() script function
« Reply #69 on: 03 / October / 2013, 11:09:48 »
The consensus seems to be create a new feature to turn off the script title and alt line.
Agreed.  We are done.  Time to implement and move on.

Quote
All other OSD elements can be deactivated manually or via set_config_value.
I'll take a look at fixing the Show OSD menu item so that it also disables all icons when <ALT> mode is active.  This will be an independent patch from the one to disable <ALT> & Script Title.
« Last Edit: 03 / October / 2013, 11:23:26 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics


SimplePortal © 2008-2014, SimplePortal