another rare bug - General Help and Assistance on using CHDK stable releases - CHDK Forum

another rare bug

  • 48 Replies
  • 21436 Views
*

Offline timgor

  • ***
  • 150
another rare bug
« on: 25 / March / 2015, 21:49:06 »
Advertisements
There is another rare bug that happens to my script.
This is the part of my script:
Code: [Select]

....
set_aflock(1)     
sleep(1000)
fout = io.open("A/out.txt", "a") fout:write(tostring(zones)," ",tostring(get_vbatt())," ",tostring(collectgarbage("count"))," ",tostring(get_mode()),"  flag34   ",os.date("%X"),"\n")  fout:close()

zones = md_detect_motion( a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)

fout = io.open("A/out.txt", "a") fout:write(tostring(zones)," ",tostring(get_vbatt())," ",tostring(collectgarbage("count"))," ",tostring(get_mode()),"  flag35   ",os.date("%X"),"\n")  fout:close()

set_aflock(0)
...


In other words this is just a motion detection function. lock-unlock functions needed to prevent false triggering during motion detection.

This part of script works good for 500-1000 times and after that it ends in a play mode and camera continues to work. SO it behaves like it suddenly called set_record(0) function in place of md_detect_motion(...)
This is fragment of out.txt file (that I inserted for debugging purpose).

0   4018   144   true  flag34   15:39:19
0   4069   144   false  flag35   15:39:24

This case doesn't produce ROMLOG file.

I can investigate this case in details by using Debug version of CHDK, or I can insert flags into C++ code of md_detect_motion(...) function. What would be the best way to do that?
Do you know what can cause this problem? (question for experienced developers)




« Last Edit: 25 / March / 2015, 21:55:40 by timgor »

Re: another rare bug
« Reply #1 on: 25 / March / 2015, 23:11:41 »
Please post your complete script. It is very hard to help debug a script fragment.

In particular, it would be good to know what parameters you are passing to the motion function.

Additionally, I don't know of a "debug" version of CHDK. However, adding flags to the C (not C++) motion detection detection code is one way to debug.

Does your issue occur without the file I/O statements? As written, you may be trying to write to the SD card while an image is being written. That can cause problems.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: another rare bug
« Reply #2 on: 25 / March / 2015, 23:12:16 »
Duplicate post removed.
« Last Edit: 25 / March / 2015, 23:14:49 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline timgor

  • ***
  • 150
Re: another rare bug
« Reply #3 on: 25 / March / 2015, 23:33:19 »
It's very hard to post whole script because it's 30 kB in size. May be next time I think I can use just standard example for MD function to represent a full script. I just posted the piece of code that works in a wrong way and this is what is not supposed to be. This also happens without I/O statements.
For motion detector parameters I use
   a=16       
   b=12       
   c=1         
   d=300000   
   e=200
   f = 5
   g=1       
   h=0         
   i=0         
   j=0         
   k=0       
   l=0         
   m=0       
   n =0
   o=2         
   p=2000
For "debug" version of CHDK I assumed this compilation from philmoz
http://chdk.setepontos.com/index.php?topic=12098.10
but it requires  ROMLOG file that can be studied.  In my case no formal crash happened so it would be reasonable to use flags to figure out where the bug happened.

In the previous post I just wanted to ask - Is it possible theoretically that function set_record(0) or its "immitation" would be called accidentally from md_detect_motion(...) function?
« Last Edit: 25 / March / 2015, 23:57:40 by timgor »

*

Offline reyalp

  • ******
  • 14128
Re: another rare bug
« Reply #4 on: 26 / March / 2015, 00:40:50 »
It's very hard to post whole script because it's 30 kB in size
Attach it?

Quote
. May be next time I think I can use just standard example for MD function to represent a full script.
If you can come up with the minimal script that reproduces the problem, that would be a big help.

Quote
In the previous post I just wanted to ask - Is it possible theoretically that function set_record(0) or its "immitation" would be called accidentally from md_detect_motion(...) function?
For all practical purposes.... No.

The camera might switch to playback if it thinks the battery is low or it has been idle long enough for the power saving to kick in.
Don't forget what the H stands for.

*

Offline timgor

  • ***
  • 150
Re: another rare bug
« Reply #5 on: 26 / March / 2015, 10:04:42 »
Quote
If you can come up with the minimal script that reproduces the problem, that would be a big help.
I will post minimal full script and its output.

Quote
The camera might switch to playback if it thinks the battery is low or it has been idle long enough for the power saving to kick in.
The low battery was my first idea but it's not the battery because I print get_vbatt() value and it's stable as you can see.
Is there any mode in CHDK when it retract lens when it's idle long enough instead of set_record(0)? I know that this is only a function of normal factory camera operation and menu setting.
Every time it happens only at the md_detect_motion(...) function like it's shown in the out.txt file so md_detect_motion(...) is responsible for it.
Ok, let's wait...



*

Offline timgor

  • ***
  • 150
Re: another rare bug
« Reply #6 on: 26 / March / 2015, 11:42:01 »
By the way, can somebody explain me what is going on in the action_stack_AS_MOTION_DETECTOR() function.
Does it makes something with autofocussing?

Re: another rare bug
« Reply #7 on: 26 / March / 2015, 12:26:55 »
Before we dive into core code with you, it's probably worth checking that you have the Disable LCD option in the CHDK Settings  menu set to Always ?
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline timgor

  • ***
  • 150
Re: another rare bug
« Reply #8 on: 26 / March / 2015, 13:59:07 »
Before we dive into core code with you, it's probably worth checking that you have the Disable LCD option in the CHDK Settings  menu set to Always ?
Yes, that's exactly set to "Always".
Let's wait for simplified script before we dive into the code.
Is there any overheating sensor inside of the Canon camera?

Re: another rare bug
« Reply #9 on: 26 / March / 2015, 14:13:27 »
Is there any overheating sensor inside of the Canon camera?
There are several temperature sensor - typically three that can be accessed from CHDK.  You can monitor those in your script get_temperature()
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics


SimplePortal © 2008-2014, SimplePortal