CHDK Wiki
Register
No edit summary
(Special script-exit routine?)
Line 76: Line 76:
   
 
IF//THEN//ELSE//ENDIF would allow a more convienent and more transparent way to code some proceedures. The currently IF/THEN/ELSE construct does not permit more than one basic command for the THEN and ELSE alternatives. If more than one command is needed, you typically will have to use gosubs to subroutines as the THEN/ELSE alternatives, which has the disadvantage of moving those lines of code elsewhere in the program file.
 
IF//THEN//ELSE//ENDIF would allow a more convienent and more transparent way to code some proceedures. The currently IF/THEN/ELSE construct does not permit more than one basic command for the THEN and ELSE alternatives. If more than one command is needed, you typically will have to use gosubs to subroutines as the THEN/ELSE alternatives, which has the disadvantage of moving those lines of code elsewhere in the program file.
  +
  +
== Special script-exit routine? ==
  +
  +
Currently, when a script is terminated by the user by pressing the Shutter button, the camera just stops. Would it be possible for uBasic to instead jump to a special subroutine in the script?
  +
  +
Ideally, the script should have the ability to restore any camera settings that were changed by the script (Iso, exposure compensation, image resolution, etc). And if script terminates on its own (due to time or completion of its tasks) this is easily done in the script.
  +
  +
However, the user can also terminate a script by hitting the shutter button, and in that case the script is unable to restore anything.
  +
  +
One way this might be implimented is to have the routine that detects the shutter button first check to see if there is a special label in the script with an unusual name (such as ":terminate_restore_and_end") and if there is one, then instead of doing what it now does, it instead jumps to that location so that the commands that follow it are executed. [If there is no such label, then it does what it just does what it does now to terminate the program.]
  +
  +
Script-writers can then include such a routine (with that exact name) as a standard exit routine in all scripts.

Revision as of 04:20, 7 October 2007

Help: talk pages, talk page guidelines


This page is specifically for suggestions related to CHDK uBasic, either suggested new or modified uBasic script commands, or for sugggested CHDK-specific implimentations of the uBasic language.

The idea is to separate out these requests from other issues found in the (now overwhelming and somewhat stale) general suggestion page.

I've seeded this with some of my requests ( :) ), and I also reviewed the general suggestions page and carried over any such suggestions that others have posted. (If they were your suggestions, please feel free to edit them if I didn't quite make it clear what you wanted, and *please* delete them if you no longer desire those extensions).

If you'd like to post a *NEW* uBasic-specific suggestion, click the post a new comment button at the top of this page.

If you want to modify or comment on an *EXISTING* suggestion posted here, use the "EDIT" link next to that specific suggestion.

The ability to read the system time in a Script

I'd like the ability to get the system time. Would be very userful for intervalometer scripts, and perhaps for other procedures as well that depend in precise timing.

A suggested format: "get_sys_time x", where x=the time in whatever units the camera uses (msec, 0.1 msec, whatever!)

[This probably would be easy to impliment, since it appears that there already is a C routine that deals with this variable.]

ability to turn on/off darkframe subtraction

The ability to turn on/off darkframe subtraction in a script.

Suggested format: set_DF_off and set_DF_on.

[This also likely would be easy to impliment, since CHDK already controls this function via the menu.]

ability to get & set image resolution

The ability to get and set the image resolution state. Like some other parameters (e.g., ISO) the ability to "press" buttons lets you change this setting, but only if you know what state it is in at the start.

Suggested format: "get_image_res x" and "set_image_res x"

ability to get & set exposure compensation

ability to set (and get) the exposure compensation (+/-)? [Question: are all Canon cameras like the S3, where your ability to adjust is in 1/3 stop units over the range of -2 to +2?]

Note: currently one can set the exposure compensation, and reset it back, using the press button commands only if you know the initial setting. (You can set it to anything regardless of the initial setting using the button press command by first driving it down to -2 by doing 12 button presses (which will put it in a known state regardless of where it starts at, but in that situation, you won't be able to return it to where it was).

Suggested format "get_ex_comp x" and "set_ex_comp x", where x=0 is normal, and +/- 1 is up or down 1/3 stop, +/1 = 2/3 stop, etc. (i.e., the range of the variable x will be from -6 to +6, corresponding to -2 to +2 stops)

ability to set sharpness, saturation & contrast.

ability to set Sharpness, Saturation and Contrast in a script.

Similar to parameters like Exposure compensation, ISO, etc. The format of such commands would probably best be similar (e/g/. "get/set_contrast x")

(suggested by another user previously in the general suggestion page)

ability to read the battery voltage

ability to read the battery voltage (or % battery remaining?)

This was suggested by another user in the general suggestion page.

Suggested format: "get_battery_volts x" where x is the voltage in mV (although for most purposes the %battery remaining parameter that CHDK already calculates for the battery display would probably be sufficient)

Ability to delete images

[This was suggested by another user in the general suggestion page.]

A set of extensions that would allow file deletion. As the person who requested this points out, unless you can enter playback mode, the "erase" button doesn't work for that function. He/she suggested having either a command to switch between recording to playback modes, or a delete command with a variable that would specify deletion of the most recent image.

Suggested format: "fdel x" where x = 0 to delete the most recent image, and -1,-2,etc to delete previous images) or a prior image (variable = 1 for immediately preceeding image, etc)

IF//THEN//ELSE//ENDIF

[This was suggested by another user in the general suggestion page.]

IF//THEN//ELSE//ENDIF would allow a more convienent and more transparent way to code some proceedures. The currently IF/THEN/ELSE construct does not permit more than one basic command for the THEN and ELSE alternatives. If more than one command is needed, you typically will have to use gosubs to subroutines as the THEN/ELSE alternatives, which has the disadvantage of moving those lines of code elsewhere in the program file.

Special script-exit routine?

Currently, when a script is terminated by the user by pressing the Shutter button, the camera just stops. Would it be possible for uBasic to instead jump to a special subroutine in the script?

Ideally, the script should have the ability to restore any camera settings that were changed by the script (Iso, exposure compensation, image resolution, etc). And if script terminates on its own (due to time or completion of its tasks) this is easily done in the script.

However, the user can also terminate a script by hitting the shutter button, and in that case the script is unable to restore anything.

One way this might be implimented is to have the routine that detects the shutter button first check to see if there is a special label in the script with an unusual name (such as ":terminate_restore_and_end") and if there is one, then instead of doing what it now does, it instead jumps to that location so that the commands that follow it are executed. [If there is no such label, then it does what it just does what it does now to terminate the program.]

Script-writers can then include such a routine (with that exact name) as a standard exit routine in all scripts.