Ixus 140 CHDK bugs - General Discussion and Assistance - CHDK Forum

Ixus 140 CHDK bugs

  • 13 Replies
  • 6582 Views
Ixus 140 CHDK bugs
« on: 27 / May / 2014, 04:38:10 »
Advertisements
Firstly, as this is my first post here - thanks for the work you all put in to this software. It's a great resource.
I've recently purchased an Ixus 140 to use with CHDK for a timelapse recording, but it seems there are some bugs with the port for this camera. Or maybe my camera has newer firmware than was ported for...

1. Reset command seems to crash camera (powers off)
  - I put this first since having it available would be a workaround for other bugs

2. When I leave the timelapse script running, after 30 shots or so, shoot() stops working. Nothing is saved; get_exp_count doesn't increase. I had my script doing a press("shoot_half") repeat sleep(50) until get_shooting() but it kept getting stuck there after so many shots - it seems the camera is unwilling to lock focus. Or the button presses and shoot command are not getting through. When I look at the camera once it's in this state, it seems like the shutter button presses are reaching the ALT mode screen instead of actually shooting. Going to play mode and back to rec works, but doesn't help.

3. RemoteShoot works fine (as long as camera not in the state as mentioned above) but on entering play mode the camera crashes. Powering back on is the only solution.

EDIT: ACID says my firmware is 100b. I'm running ixus140_elph130-100b-1.2.0-3439-full_BETA

Any help is much appreciated
« Last Edit: 27 / May / 2014, 05:49:06 by anikrooz »

Re: Ixus 140 CHDK bugs
« Reply #1 on: 27 / May / 2014, 04:39:52 »
Perhaps I should add the code I'm using... it's a bash script communicating through CHDKPTP
Code: [Select]
#!/bin/bash

# delay (in seconds) between shots, not including time spent in command + file transfer
# This must be long enough to allow JPEG writing to finish
delay=300
zoom=0
path=/home/pi/photos
logfile=$path/log-`date +'%F'`.log

CHDKPTP_DIR=/home/pi/chdk
export LUA_PATH="$CHDKPTP_DIR/lua/?.lua"

CHDK=$CHDKPTP_DIR/chdkptp


echo "Backlight off"
#$CHDK -c -e"luar return get_buildinfo()"
$CHDK -c -e"luar set_backlight(0)"
sleep 5
datum_x=`date +'%F_%I-%M'`

function log {
curenttime_x=`date +"+%Y-%m-%d %H:%M:%S"`
echo "$curenttime_x - $1 $2 $3 $4 $5 $6 $7 $8 $9" >> $logfile
echo "$curenttime_x - $1 $2 $3 $4 $5 $6 $7 $8 $9"
}

take_photo()
{
  echo "Shooting"
  $CHDK -c -erec -e"luar set_zoom($zoom)"
  echo "rec mode"
  #LUMI=`$CHDK -c -e"luar press(\"shoot_half\") repeat  sleep(50) until get_shooting() == true release(\"shoot_half\") repeat sleep(50) until get_shooting() == false return get_bv96()" | cut -d: -f3`
  log "Shooting"
  $CHDK -c -eshoot
  LUMI=`$CHDK -c -e"luar return get_bv96()" | cut -d: -f3`
  log "Luminance: "$LUMI" / 400"
  if [ $LUMI -gt 400 ]
  then
sleep 2
copy_image
  fi
  $CHDK -c -eplay
  echo "play mode"
  sleep 2
  $CHDK -c -e"luar set_backlight(0)"
}

copy_image()
{
latest=`$CHDK -c -e"luar return string.format('%s/IMG_%04d.JPG',get_image_dir(),get_exp_count())" | cut -d: -f3`
$CHDK -c -e"d $latest $path"
latest=$latest | cut -d\> -f1
log "Saved "$latest
}
# transfer latest image from camera
remove_latest_images()
{
#-e"mdl -fmatch=%.JPG$ DCIM $path"
$CHDK -c -e"rm -nodirs -fmatch=%.JPG$ DCIM"


}

while [ "$quit" != "1" ]; do
 

  take_photo
 
  echo "sleeping, press q to exit"
  read -t $delay -n 1 key
  if [ "$key" == "q" ]; then
    quit=1
    log "Exiting, but first cleaning up..."
  fi

  VBatt=`$CHDK -c -e"luar return get_vbatt()" | cut -d: -f3`
  #If less than 100 photos space, clear. Should help with wear on SD card not doing it every time
  if [ `$CHDK -c -e"luar return get_jpg_count()" | cut -d: -f3` -lt 100 ]
  then
echo "mem full - deleting"
remove_latest_images
log "Cleared images. Battery level: "$VBatt
  fi
 
  if [ $VBatt -lt 3300 ]
  then
log "*************  WARNING: Battery Low! ***************"
  fi
done

log "Turning backlight on"
$CHDK -c -e"luar set_backlight(1)"
log "done."


*

Offline reyalp

  • ******
  • 14117
Re: Ixus 140 CHDK bugs
« Reply #2 on: 27 / May / 2014, 17:12:52 »
Or maybe my camera has newer firmware than was ported for...
Unlikely, the 100b firmware code appears identical to 100a. The  100b port is actually just a copy of the 100a build.
Quote
1. Reset command seems to crash camera (powers off)
  - I put this first since having it available would be a workaround for other bugs
Do you mean reboot? I admit I don't think I ever tried reboot when I did the port, I'll check it out when I have a moment.

If you can get a ROMLOG http://chdk.wikia.com/wiki/Debugging#Camera_crash_logs_.28romlog.29 that might provide some information.

Quote
2. When I leave the timelapse script running, after 30 shots or so, shoot() stops working. Nothing is saved; get_exp_count doesn't increase. I had my script doing a press("shoot_half") repeat sleep(50) until get_shooting() but it kept getting stuck there after so many shots - it seems the camera is unwilling to lock focus.
This can happen. shoot() will timeout eventually, while if you wait for get_shooting() it will never become true.

Is the lighting or scene changing?

Do you have flash enabled? If so (and you don't need it) try turning it off.

What Canon mode are you shooting in? In my experience full auto will simply refused to focus in some cases, while P will not.

Does your subject need autofocus? If not, you could try using set_mf() and set_focus(), or the cameras "focus at infinity" setting. You will need to use chdk 1.3 development branch to use set_mf().
Quote
Or the button presses and shoot command are not getting through. When I look at the camera once it's in this state, it seems like the shutter button presses are reaching the ALT mode screen instead of actually shooting.
I don't think this is it. When you run code over PTP, CHDK enters alt mode to run the script, so you see the <alt> indicator, but scripted keypresses always go to the canon firmware.

Quote
3. RemoteShoot works fine (as long as camera not in the state as mentioned above) but on entering play mode the camera crashes. Powering back on is the only solution.
This is a known issue with remoteshoot on some cameras unfortunately.
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 14117
Re: Ixus 140 CHDK bugs
« Reply #3 on: 28 / May / 2014, 02:16:04 »
I confirmed on my 100a camera that reboot crashes without a romlog, and switching to play after rs crashes with an assert in MetaCtgParser.c

I'll try to look into these when I have some time.
Don't forget what the H stands for.


Re: Ixus 140 CHDK bugs
« Reply #4 on: 28 / May / 2014, 13:10:15 »
Excellent, thanks for responding. Nice to know it's not just me being a noob.
I'll try the set_focus idea, or in P mode. Maybe that'll help. It's on a tripod pointing out of a window; so the only thing changing is the light as it gets dark. But perhaps it's trying to focus on the glass, though, if it sees its own reflection or something.
I tried the 1.3 build but that crashes after shoot when returning to play mode. I'll stick with 1.2 since I'm almost there with the script. I looked into set_resolution, too, but gave up with that. I managed to do a set prop but the camera seemed to ignore the setting. Might end up clicking buttons if I can get it predictable.

*

Offline reyalp

  • ******
  • 14117
Re: Ixus 140 CHDK bugs
« Reply #5 on: 28 / May / 2014, 17:04:55 »
Excellent, thanks for responding. Nice to know it's not just me being a noob.
I'll try the set_focus idea, or in P mode. Maybe that'll help. It's on a tripod pointing out of a window; so the only thing changing is the light as it gets dark. But perhaps it's trying to focus on the glass, though, if it sees its own reflection or something.
I think P mode should help with the shoot failing, but the shots might be out of focus if it's refusing shoot because it can't find anything to lock on.

I have found AF performance on the camera isn't a great. Also beware that the "focus at infinity" mode in the canon firmware is only a hint, the camera still does an AF scan and may decide to focus somewhere else  >:(

In 1.2, I think set_focus will only work if you use set_aflock() and set propcase AF_LOCK to 1, or set AF lock manually in the canon UI.
Quote
I tried the 1.3 build but that crashes after shoot when returning to play mode.
You mean without using remote shoot? It shouldn't... I'm not aware of any bugs that affect the trunk but not the stable release.
Quote
I'll stick with 1.2 since I'm almost there with the script. I looked into set_resolution, too, but gave up with that. I managed to do a set prop but the camera seemed to ignore the setting. Might end up clicking buttons if I can get it predictable.
Don't forget what the H stands for.

Re: Ixus 140 CHDK bugs
« Reply #6 on: 30 / May / 2014, 04:53:50 »
I think P mode should help with the shoot failing, but the shots might be out of focus if it's refusing shoot because it can't find anything to lock on.
Not sure if it helped or not... left the script running yesterday and it took 85 shots before giving up.

Quote
In 1.2, I think set_focus will only work if you use set_aflock() and set propcase AF_LOCK to 1, or set AF lock manually in the canon UI.

Thanks for the pointers. I did manage to get set_focus working. With it still in I-wont-shoot mode, I can get get_focus to return different values once I've pressed shoot. Get_focus won't return a different value unless you press shoot or shoot_half, but I've read that's normal. In fact it confirms the camera is trying to take a photo. But nothing is saved. And I still can't get get_shooting to return true when pressing shoot_half.

Here's what I've done:
Code: [Select]
con 2673> luar release("shoot_half")     
con 2674> play
con 2675> rec
con 2676> luar return set_prop(11,1)
con 2677> luar return set_focus(50)
con 2678> luar set_aflock(1)
con 2679> luar return get_focus()
2680:return:-1
con 2680> luar return set_focus(50)
con 2681> luar return get_focus()
2682:return:-1
con 2682> shoot   
con 2683> luar return get_focus()
2684:return:-1
con 2684> luar return set_focus(95)
con 2685> shoot
con 2686> luar return get_focus()
2687:return:-1
con 2687> luar return set_focus(95)
con 2688> luar set_aflock(1)
con 2689> shoot
con 2690> luar return get_focus()
2691:return:2846
con 2691> luar return get_exp_count()
2692:return:415
con 2692> shoot
con 2693> luar get_exp_count()
con 2694> luar return get_exp_count()
2695:return:415
con 2695> luar set_focus(2846)
con 2696> luar set_aflock(1)
con 2697> shoot
con 2698> luar return get_focus()
2699:return:4486
con 2699> luar return get_exp_count()
2700:return:415
con 2700> luar press("shoot_half")
con 2701> luar return get_shooting()
2702:return:false
con 2702> luar release("shoot_half")
con 2703> luar return get_focus()
2704:return:4486
con 2704> luar set_focus(5000)
con 2705> luar set_aflock(1)
con 2706> luar return set_prop(11,1)
con 2707> shoot
con 2708> luar return get_focus()
2709:return:3469
con 2709> luar return get_exp_count()
2710:return:415

Re: Ixus 140 CHDK bugs
« Reply #7 on: 30 / May / 2014, 10:50:11 »
Update:
Shoot has no effect on focus, and returns 1 (timeout) when running the lua shoot() function.

Only set_focus followed by set_aflock(1)  actually puts a value in get_focus. Judging from the time taken by the command, it's set_aflock that does the focusing and probably tries to lock somewhere near what is given in set_focus.
But, considering the focus value should then be set, something else must be making it fail to shoot. It's not lighting. I've tried emptying the SD card (even though get_jpg_count said there was lots of space left). Wondering if it's file descriptors or memory... or the fact I have it going from play to record mode and back between shots...


Re: Ixus 140 CHDK bugs
« Reply #8 on: 30 / May / 2014, 11:14:46 »
Ah, I think I've got it. My initial suspicions were almost correct.
I found this post: http://chdk.setepontos.com/index.php?topic=11035.0 where a camera was timing out in a similar way.
Reyalp, you debugged it and said:
Quote
After some extensive debugging on IRC, the root cause appears to be the alt state getting confused, which causes shoot to fail. The "confused" state involves the alt OSD being displayed, but key presses going to the original canon firmware (and chdk?), and scripted presses of shoot etc not going to the canon firmware.

Using enter_alt() before running the shooting sequence appears to avoid this.

I should have found this earlier, really.

I've added this section in my code which may work next time it dies:

Code: [Select]
$CHDK -c -erec -e"luar set_zoom($zoom)" -e"luar press(\"shoot_half\")"
  sleep 1
  shooting=`$CHDK -c -e"luar return get_shooting()" | cut -d: -f3`
  if [ shooting == 'false' ]
  then
$CHDK -c -e"luar enter_alt()"
log "---- ALT mode confused; resetting"
$CHDK -c -e"luar exit_alt()"
  fi

*

Offline srsa_4c

  • ******
  • 4451
Re: Ixus 140 CHDK bugs
« Reply #9 on: 30 / May / 2014, 11:17:13 »
I confirmed on my 100a camera that reboot crashes without a romlog
I just remembered: nafraf had to fix the address of 'Restart' for the sx510: it is being misdetected for new cameras. The correct function is the one immediately preceding the detected one. I think.
The detected function does a normal poweroff btw.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal