CHDK Forum

Using CHDK => Script Writing => Completed and Working Scripts => Topic started by: Geezer on 07 / September / 2014, 17:22:02

Title: Trouble with fast motion detect and/or CHDK on ELPH 310HS
Post by: Geezer on 07 / September / 2014, 17:22:02
I have used fast MD on A 590IS for years, both the lua version and Fudgey's original.  I can't get it working on my ELPH 310HS.  I am getting an odd (to me) error.

Thoughts?

Please see attachments.

Thanks,
Terry
Title: Re: Trouble with fast motion detect and/or CHDK on ELPH 310HS
Post by: waterwingz on 07 / September / 2014, 17:27:20
Looks like you do not have CHDK properly installed on the SD card of your ELPH310HS.  There is at least one file missing ( A/CHDK/LUALIB/propcase.lua ). 

How did you setup and configure your SD card?  The currently recommended method is to use STICK (http://zenoshrdlu.com/stick/stick.html)

Note that if it's a large card > 4G you do not need and can't use dual partitions like you did for your A590. You probably want to low level format any dual partition card prior to using in with your 310.
Title: Re: Trouble with fast motion detect and/or CHDK on ELPH 310HS
Post by: Geezer on 08 / September / 2014, 21:45:12
This evening I "started over."  Format SD, use STICK to install CHDK, made card bootable, re-downloaded MDFB2013_1v1.ZIP then extracted motion detect lua file to SCRIPTS.

Motion detect script now working!  Shocking, I know.  Ha, ha.

I don't know where I went wrong.  Appreciate the help.  Next will try to get some hummingbird shots.

Thanks,
Terry
Title: Re: Trouble with fast motion detect and/or CHDK on ELPH 310HS - New Info
Post by: Geezer on 17 / September / 2014, 12:14:11
OK, I have better determined the circumstance of the script error.

If the camera does not display an image on startup the script runs as it should.

(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FU5YI1V3.png&hash=d7276297c94c1a84ddc038e166b6702f)

If at least one image type file exists in DCIM\Subfolder\ then the script fails with the "prop" error.

(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FdTrAWAz.png&hash=c4194e86e9ee4250176b1c5fe78be2f2)

If you have an "easy" solution let me know.  Otherwise I would not spend too much time on it.  After all, I am the only person in the world experiencing this problem. :-[

Thanks again,
Terry
Anyway, I can work around the error. 
Title: Re: Trouble with fast motion detect and/or CHDK on ELPH 310HS
Post by: fabri22 on 17 / September / 2014, 12:50:43
Faulty SD ?
Title: Re: Trouble with fast motion detect and/or CHDK on ELPH 310HS
Post by: Geezer on 17 / September / 2014, 18:03:45
I just tried another SD card, same behavior.  FWIW, interval.lua runs normal under the same condition that causes the error in motion detect.lua.

Puzzled,
Terry
Title: Re: Trouble with fast motion detect and/or CHDK on ELPH 310HS
Post by: waterwingz on 17 / September / 2014, 18:38:20
I just tried another SD card, same behavior.  FWIW, interval.lua runs normal under the same condition that causes the error in motion detect.lua.
It certainly seems very strange that you only see the problem after images have been added to your SD card.

However, interval.lua does not use (or try to access) the file that is causing your error (A/CHDK/LUALIB/propcase.lua) so I would not expect it to fail the way the other script does.

Update :  try the simple little script attached here?
Title: Re: Trouble with fast motion detect and/or CHDK on ELPH 310HS
Post by: srsa_4c on 17 / September / 2014, 19:14:48
If the script is set to "autorun", it might somehow clash with camera routines that open image files, resulting in fopen() failure.
Title: Re: Trouble with fast motion detect and/or CHDK on ELPH 310HS
Post by: Geezer on 17 / September / 2014, 21:37:26
No autorun.

Terry
Title: Re: Trouble with fast motion detect and/or CHDK on ELPH 310HS
Post by: Geezer on 17 / September / 2014, 21:43:11
testprop runs no problem motion detect same error.

Weird,
Terry
Title: Re: Trouble with fast motion detect and/or CHDK on ELPH 310HS
Post by: waterwingz on 17 / September / 2014, 22:20:20
Just for grins, right after the error happens,  take a look at the Show Memory Info values in the Miscellaneous menu and report them here ?

It's not a very big script but it might be pushing you over a memory limit.  We could try using rudi's script loader script if so.
Title: Re: Trouble with fast motion detect and/or CHDK on ELPH 310HS
Post by: Geezer on 18 / September / 2014, 14:17:53
Looks like you are on to something...

(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fi.imgur.com%2F5ICmj72.png&hash=8bfbe89333cd79cf839bb23250d990de)
about 348k memory with empty image folder

(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FkbGmjMc.png&hash=03f11fa7bd7e403af8e899b991717263)
about 188k memory with image (one or more) in folder

(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FycPZKzs.png&hash=65951b079483aac92ea7d4c8143ef42e)
down to 82k after script crash

(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fi.imgur.com%2Fb7ivvRH.png&hash=2514c1aeb1024bcf9a0b373c6d9df5c4)
mem with script running normally (no image in folder at startup) and has stored at least one image in folder

So, if I understand, if there is an image in the folder at startup then there is not enough mem to run the script.  However, if the script gets to start with an empty folder, it stores images without running out of memory.  Until next time you use the camera!  Pretty clever!  Gotta luv computers!  Ha, ha.

Whaddya think?
Terry
Title: Re: Trouble with fast motion detect and/or CHDK on ELPH 310HS
Post by: waterwingz on 18 / September / 2014, 14:59:29
I think you are running out of memory. And the startup order of doing things probably produces different memory fragmentation and thus different results.

Somebody needs to look at the code and see if there is a better memory model that can be used with your camera.
Title: Re: Trouble with fast motion detect and/or CHDK on ELPH 310HS
Post by: srsa_4c on 18 / September / 2014, 16:29:49
a better memory model that can be used with your camera.
The CHDK 1.3 release for this camera has ARAM enabled (+136kB).
Title: Re: Trouble with fast motion detect and/or CHDK on ELPH 310HS
Post by: Geezer on 18 / September / 2014, 17:15:06
I will "test" that release.

Terry
Title: Re: Trouble with fast motion detect and/or CHDK on ELPH 310HS
Post by: Geezer on 18 / September / 2014, 18:28:22
Ver 1.3 fixed the problem.  It did not increase the amount of mem, but it sure eliminated the "prop" error.

As part of my testing I reverted to ver 1.2 and the error immediately returned.  Re-installed ver 1.3 and error corrected again.  I'm convinced it is fixed.

I don't know enough about computers to explain why it is fixed. :-[

(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fi.imgur.com%2F6RVNb3x.png&hash=8fb56a2fd7694a51ba32a821cacbc8ab)

(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FlghWdrF.png&hash=529c510c35092483cba82fb977dcaf9a)

Sorry, can't post mem pic after script crash. :D

Many thanks,
Terry
Title: Re: Trouble with fast motion detect and/or CHDK on ELPH 310HS
Post by: waterwingz on 18 / September / 2014, 19:59:15
I don't know enough about computers to explain why it is fixed. :-[
Once you start to run our of memory, on pretty much any computer, strange things can happen.   It's good to know there was a common solution to these two problems.