edit:
The following response is a bit flamey. I don't mean to cause personal offense. I certainly appreciate that lapser has put a lot of effort into digging into the shooting code, and I hope useful improvements will result.
--
The key press/click/release functions have a simple, easily understood and well defined behavior. They simulate physical manipulation of the keys, as closely as possible.
Changing this to have some other special behavior for some keys is not acceptable. I will reject any patch which does this. I strongly urge the everyone with commit access to do the same.
I hope this is clear.
That's a good point that "shoot_full" in video mode doesn't take a photo. There's already a test for that:
This is an *example* of why pressing a button should not be tied to shooting specific behavior. I specifically stated that I didn't consider adding yet more special cases to be an appropriate solution
Moving the wait loop to C can give a significant improvement in how fast the shot is taken. I've been doing some timing experiments as part of my shot histogram research.
If this is the case, then the script interface should be improved rather than adding spaghetti to the keyboard code. This bug may be relevant
http://chdk.setepontos.com/index.php?topic=7611.msg81072#msg81072http://chdk.wikia.com/wiki/Script_commands#set_yield may also be relevant, although if you are in a sleep loop that sleeps I don't think it should be significant.
Simplifying scripts isn't the major reason for these changes, but I don't think it's a trivial accomplishment. Reducing script code and moving it to C code saves memory and speeds execution
No, moving script logic to core code
takes away memory from everyone who doesn't need that particular bit of logic. Raw execution speed should not be a concern with lua, it's very fast. If script is actually too slow, that likely indicates a problem somewhere rather raw execution speed being too slow.
It also makes script writing easier to learn. click("shoot_full" and "shoot_full_only") should take a shot as quickly as possible every time, not require a lot of extra code and delays to get it to work most of the time.
I disagree with this completely. Making keyboard functions not actually keyboard functions makes them substantially more confusing. click("shoot_full") is not the equivalent of shoot, it's the equivalent of clicking the shutter button, which does not always successfully shoot.