CHDK has two scripting functions for use with a camera's ND filter. You can determine your camera configuration with
get_nd_present() - returns 0 if the camera does not have an ND filter, 1 if the camera has only an ND filter and 2 if the camera has an ND filter and a diaphragm. And you can change the position of the ND filter with
set_nd_filter(n) - n=0 for auto, n=1 for filter in, n=2 for filter out
However, there does not seem to be a way to determine the current position of the filter. There is are propcases defined that should tell the state but apparently only in M mode (assuming your camera even has one). In P and Auto modes the value never changes.
Furthermore, if you manually set the filter state, the filter does not move in until just before the shot, and after the exposure has been set. For example :
set_nd_filter(1)
press("shoot_half")
repeat sleep(100) until get_shooting() == true
click("shoot_full")
release("shoot_half")
repeat sleep(100) until get_shooting() == false
set_nd_filter(2)
press("shoot_half")
repeat sleep(100) until get_shooting() == true
click("shoot_full")
release("shoot_half")
repeat sleep(100) until get_shooting() == false
produces two photos with very different exposure ( the first is much darker than the second).
Does anyone have any pointers for working with the ND filter that I might have missed. I'm playing with bracketing modes and trying to figure out how to either lock the ND filter in one state or how to understand what it does when in automatic modes.