As I'm trying to solve my own problem with getting a badpixel.bin file for my SD450, I'm dissecting the badpixel.lua that came by default in the 1.00c download for this camera, and have a few questions on it.
Here's the main "get_bad_count" function, with my comments added:
function get_bad_count()
a=get_raw() -- Save current "RAW enabled?" setting
set_raw(255) -- Turn on RAW capture
set_tv96_direct(96) -- same as "set_tv 1"; sets the shutter speed to 1/8"
shoot() -- Take a picture
b=get_raw() -- Current "RAW enabled?" setting; should still be 255?
set_raw(a) -- Set "RAW enabled?" setting back to the original
return b -- Return 255?
end
Firstly, since there's a known issue with the SD450 models not liking the "shoot()" command, and the suggested change is 'click "shoot_full"', why is the default script included with the download for this model including that command? I had my camera hang on the script execution until I changed that line.
Then the script executed, and from further down the script, I see that it pulls a file from "A/CHDK/bad_tmp.bin" to save in "A/CHDK/badpixel.bin". But in that "get_bad_count" function, I don't see anywhere that actually saves a bad_tmp.bin file. Is that file automatically created when a RAW image is saved?
Additionally, what is the purpose of the "b" variable in this function? It seems to always grab the current setting of the "RAW capture enabled?" setting (which is 255, from a few lines above), and return that. And that seems to be the case, since my camera is reporting that I have "255" bad pixels, each time I run the script, which is an echo of the return of the function, which is 'b'. Now, I'm gleaning that from the fact that the
UBASIC documentation indicates "set_raw" and "get_raw" deal with the enabled/disabled state of capturing RAW images in addition to JPEGs; I could find no reference to a LUA function of the same name, and whether or not it does something different. It would seem to me that the value for "b" needs to be fetched from some function that grabs the number of dead pixels the camera's native firmware thinks there are, but is "get_raw" the proper function for that?