Motion Detection - time for a second look ? - page 7 - General Discussion and Assistance - CHDK Forum

Motion Detection - time for a second look ?

  • 81 Replies
  • 26016 Views
Re: Motion Detection - time for a second look ?
« Reply #60 on: 11 / February / 2013, 00:23:38 »
Advertisements
I used camera_set_led since that's what's called from ubasic and Lua, and seemed to have the highest chance of working across all cameras.
Well ... ummm .. . ahhh .... considering I had to fix that function for 2 of my 3 cameras it seems the chance was not so high.  And grep tells me that there is a lot of C&P code out there that is suspiciously identical.  This project really need to find better people to do the ports.  But I agree that using that function is the best way to make your code work across all cams - people can fix that as they implement it.

Quote
It did occur to me there might be delays using the firmware functions rather than going direct; but I didn't think they would be significant.
Do you think they would be longer than one context switch?  Most things seem to happen in 10 mSec or less at that level.  That's  a 10% to  20% measurement error in MD response speed at the most.  I think we can live with that.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 13673
Re: Motion Detection - time for a second look ?
« Reply #61 on: 11 / February / 2013, 00:44:26 »
I tried switching my d10 to poke the LED directly and the no shoot results are identical over 100 tests, so it looks like there's nothing to worry about there.
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 13673
Re: Motion Detection - time for a second look ?
« Reply #62 on: 11 / February / 2013, 00:57:22 »
Regarding the LED code, there's other problems beyond copy and paste. I think originally it was made so the numbers would be generic (matching the Canon numbers of some early camera) but that wasn't maintained so the CHDK numbers are just as meaningless as the underlying Canon numbers. Plus different models don't all have the equivalent LEDs.

The underlying functions also have different capabilities, e.g. the print LED on many cameras has variable brightness, and LEDDrv can do various blink patterns on the others (see comments in D10 lib.c).
Don't forget what the H stands for.

*

Online philmoz

  • *****
  • 3407
    • Photos
Re: Motion Detection - time for a second look ?
« Reply #63 on: 16 / February / 2013, 05:15:51 »
I've added the AF LED testing for live view & motion detect to the trunk (revision 2574).

This doesn't need a special build anymore; but the CAM_AF_LED value does need to be set correctly for each camera (only G12, G1X, SX30, SX40 and IXU310 done so far).

The MD_Tune.bas script will enable the extra AF LED test code as needed (controlled with the new 'md_af_on_time' script function).

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)


Re: Motion Detection - time for a second look ?
« Reply #64 on: 16 / February / 2013, 11:53:09 »
I've added the AF LED testing for live view & motion detect to the trunk (revision 2574).
Thanks for doing this.

Just curious - are there uses for this for anything beyond porting?  Seems a change to build this into the core instead of a build option for use during porting?  But I guess with flt modules it really doesn't hurt to do so.

Quote
This doesn't need a special build anymore; but the CAM_AF_LED value does need to be set correctly for each camera (only G12, G1X, SX30, SX40 and IXU310 done so far).
I snuck the A1200 in as well  :D

Quote
The MD_Tune.bas script will enable the extra AF LED test code as needed (controlled with the new 'md_af_on_time' script function).
Once its decide what to do with the md_get_cell_val() patch I just posted,  I'll update the wiki page. I also hope to get moving on an "expanded" description of how the md_detect_motion parameter settings affect performance.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Online philmoz

  • *****
  • 3407
    • Photos
Re: Motion Detection - time for a second look ?
« Reply #65 on: 16 / February / 2013, 16:17:43 »
I've added the AF LED testing for live view & motion detect to the trunk (revision 2574).
Thanks for doing this.

Just curious - are there uses for this for anything beyond porting?  Seems a change to build this into the core instead of a build option for use during porting?  But I guess with flt modules it really doesn't hurt to do so.

It wasn't much code so I thought it would be more accessible if anyone could use it - especially with nafraf doing so many blind ports now.

Quote
Quote
The MD_Tune.bas script will enable the extra AF LED test code as needed (controlled with the new 'md_af_on_time' script function).

I realised when I read your post that 'md_af_on_time' is a bad name for this function - sort of implies it controls the camera autofocus not the AF LED. I'll change the function name to something more sensible.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

*

Offline msl

  • *****
  • 1276
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: Motion Detection - time for a second look ?
« Reply #66 on: 16 / February / 2013, 18:03:19 »
My results for the new AF LED test function:

SX220(probably also SX230)
Code: [Select]
#define CAM_AF_LED                          1The test script works fine (avg 30 ms).

A720
Code: [Select]
#define CAM_AF_LED                          9 or 10The A720 uses _PostLEDMessage instead _LEDDrive.

The test script starts. After a while the screen freezes.  No measured results will be displayed. With grid option the camera tries to draw a grid. After a few seconds freezes the LCD. The AF LED will not be activated.

A normal md script works fine.

msl
CHDK-DE:  CHDK-DE links

*

Online philmoz

  • *****
  • 3407
    • Photos
Re: Motion Detection - time for a second look ?
« Reply #67 on: 16 / February / 2013, 18:11:39 »
A720
Code: [Select]
#define CAM_AF_LED                          9 or 10The A720 uses _PostLEDMessage instead _LEDDrive.

The test script starts. After a while the screen freezes.  No measured results will be displayed. With grid option the camera tries to draw a grid. After a few seconds freezes the LCD. The AF LED will not be activated.

Can you control the AF LED using 'set_led' in a simple script without it crashing?

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)


*

Offline msl

  • *****
  • 1276
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: Motion Detection - time for a second look ?
« Reply #68 on: 16 / February / 2013, 18:19:34 »
Can you control the AF LED using 'set_led' in a simple script without it crashing?

Yes, this is not a problem.

msl
CHDK-DE:  CHDK-DE links

*

Online philmoz

  • *****
  • 3407
    • Photos
Re: Motion Detection - time for a second look ?
« Reply #69 on: 16 / February / 2013, 19:06:35 »
Can you control the AF LED using 'set_led' in a simple script without it crashing?

Yes, this is not a problem.

msl

It probably doesn't like something messing with the AF LED with the shutter half pressed.

Can you test this with a script to see if it's the problem?

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

 

Related Topics