I don't have the kap.log files from previous flights but here are two images from the same flight. I resize them so I could attach to this post.
Now we are getting somewhere. Assuming the resize operation did not mangle the internal EXIF info, this is quite interesting. You've picked two sequential shots with dramaticly different exposures.
Here's the info from the EXIF data :
IMG_0569.JPG Tv : 1/1250 Av: f9.0 Sv: 160
IMG_0570.JPG Tv : 1/1250 Av: f3 Sv: 200
Same shutter speed, slightly higher sensitivity in the second (brighter) image. Not enough to explain the exposure difference though.
But notice the Av (aperture value) settings : f9.0 vs f3!! This is a huge change - enough to completely explain the exposure difference. But note my previous comment - the A4000 does not have an adjustable aperture. The fixed aperture should be reported as somewhere between F3 & F5.9 depending on the zoom position (the effective aperture gets smaller as you zoom in). If you are shooting at the widest angle, that would be f3. So that only leaves one thing - the internal switchable neutral density filter.
In the first image - the underexposed one - the image EXIF information indicates that the internal ND filter was used. In the second, correctly exposed image it was not. Why?
This is where it would be really nice to have the KAP.LOG file. I'm pretty certain that the script did not try to insert the ND filter in the first shot. In fact, it would have tried to force the ND filter to stay out. But the Canon exposure logic appears to have inserted it - ignoring CHDK's override.
All of which leads me to the conclusion that the script command that controls the ND filter might not work on your A4000.
We can test that if you have time. I've attached a little script that takes two sequential shots - one in "auto" and the other with the ND filter forced to the opposite state from whatever the camera picks for the first shot. If you point the camera at something really bright (a 60W light bulb from 12" away for example) and shoot in Canon AUTO mode, it should insert the ND filter. Let's see if a script can override that in the second shot. Do the resulting images look the same or different?
Edit 1 : is seems that I have been down this road before without a clear resolution :
ND filter swinging in even when "ND filter state" is "Out" A work-around might be to configure the camera so that it does not try to use the ND filter on its own. Not sure what those settings are though.
Edit 2 : it looks like nafraf did the
A4000 port blind. I don't see anything in the porting thread that indicates the ND filter override was actually tested.