Shot Histogram Request - page 30 - CHDK Releases - CHDK Forum

Shot Histogram Request

  • 467 Replies
  • 128997 Views
*

Offline ahull

  • *****
  • 634
Re: Shot Histogram Request
« Reply #290 on: 17 / April / 2013, 08:04:08 »
Advertisements
Most impressive results, as ever.
 
I may have some spare time later on today if you would like me to test on the Ixus 40

*

Offline lapser

  • *****
  • 1093
Re: Shot Histogram Request
« Reply #291 on: 17 / April / 2013, 11:42:12 »
I may have some spare time later on today if you would like me to test on the Ixus 40
Sound good. Attached is the latest CHDK build, and the latest script.

Reload the script like it's a new one, and then choose the option to reset to default parameters. That should set them for your camera, I think.

I still need to work on the focus part of the script to get it to work for older cameras. Just do the same thing you did before to focus, for now.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

*

Offline ahull

  • *****
  • 634
Re: Shot Histogram Request
« Reply #292 on: 17 / April / 2013, 15:28:57 »
Thanks lapser, that installed without a hitch. I have set up the camera pointing out of the window at the weather scudding past.  We can add these pictures to your fog ones if you like.  :P

I forgot to check if the battery was 100% charged, so I may only get a short sequence. I'll post the results later, probably tomorrow afternoon.

*

Offline ahull

  • *****
  • 634
Re: Shot Histogram Request
« Reply #293 on: 17 / April / 2013, 18:12:03 »
Well we got a good result, camera kept going till the card was full. The exposure is glitch free.  :D

I put the frames together at 16fps

http://youtu.be/tCB8IlDBBv4

Now all we need is for the weather to improve.
« Last Edit: 17 / April / 2013, 18:16:28 by ahull »


*

Offline reyalp

  • ******
  • 14082
Re: Shot Histogram Request
« Reply #294 on: 18 / April / 2013, 00:02:04 »
Before the Lua update to 5.5, the Lres value was apparently a pointer to a string on the Lua stack, because the error message would be "display" or "set", which came from the script calling is_key("display") or is_key("set") before the lua yield that triggered the bug.
The lua error message is the value on the top of the stack. The lres value is not the value on the top of the stack. It *should* be the return status of resume which would be one of a handful of predefined constants mentioned earlier. In all the cases where we've had sufficient information to tell, it's an address inside the lua module. It doesn't have the low bit set, so it's not a return address.

It appears to me that what is happening is lua_resume is returning a garbage value when it should be returning LUA_YIELD (1). This means that whatever happened to be on top of the lua stack is treated as the error message, which would explain occasionally seeing things like "set".

This does suggest a really horrible workaround... if nothing else is wrong, we could just detect values outside of the acceptable range, and switch them to LUA_YIELD
Don't forget what the H stands for.

*

Offline lapser

  • *****
  • 1093
Re: Shot Histogram Request
« Reply #295 on: 22 / April / 2013, 17:20:25 »
This does suggest a really horrible workaround... if nothing else is wrong, we could just detect values outside of the acceptable range, and switch them to LUA_YIELD
I'll give that a try. Do you think this would work?

Code: [Select]
  if (Lres == LUA_YIELD)return SCRIPT_RUN_RUNNING; //yielded
//print Lres and message here
  if ((Lres >5)||(Lres<0))return SCRIPT_RUN_RUNNING; //TESTING

Do you think this info in asmsafe.h is relevant?

macros to safely call C functions from most inline ASM
these should replace the use of __attribute__((naked)) functions for C code,
because C code is not actually legal in naked functions and can break in obscure ways.
see http://chdk.wikia.com/wiki/CHDK_Coding_Guidelines#Naked_functions
usage

This is where I added my pre-shot delay. Is it possible that an interrupt at just the wrong time could mess up a register that Lua is using?
Code: [Select]
void __attribute__((naked,noinline)) capt_seq_hook_set_nr()
{
 asm volatile("STMFD   SP!, {R0-R12,LR}\n");
 
     shot_histogram_shot_delay(); //wait delay interval, if any, right before taking shot
    //note: must delay BEFORE setting NR values

    switch (conf.raw_nr){
    case NOISE_REDUCTION_AUTO_CANON:
        // leave it alone
#if defined(NR_AUTO) // If value defined store it (e.g. for G12 & SX30 need to reset back to 0 to enable auto)
        *nrflag = NR_AUTO;
#endif
        break;
    case NOISE_REDUCTION_OFF:
        *nrflag = NR_OFF;
        break;
    case NOISE_REDUCTION_ON:
        *nrflag = NR_ON;
        break;
    };

 camera_info.state.shutter_open_time = _time((void*)0);
 camera_info.state.shutter_open_tick_count = get_tick_count();

 asm volatile("LDMFD   SP!, {R0-R12,PC}\n");
}

EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

*

Offline lapser

  • *****
  • 1093
Crater Lake Time Lapsing
« Reply #296 on: 22 / April / 2013, 17:40:01 »
I camped out in a wet, windy blizzard on Friday night hoping that the weather would clear the next day as the forecast promised.  It did, and I did several time lapses, including sunrise Saturday morning, and all night Saturday night.

I turned off logging and used wait_shot_ready() to avoid the Lua bug. Everything worked great. The G1X maxed out at 1/4000 shutter time on Saturday morning with the sun in the frame. Adding automatic ND filter control is on my list to do next.

Here are 3 of the time lapses I did. First is the sunrise on Saturday morning, and then the all night video starting Saturday evening. The third video was taken with the SX50 zoomed in on Mount Scott, until the ISS was about to show up, and I zoomed all the way out to capture it.

http://www.youtube.com/watch?v=nhhYVKMKnC8#ws
http://www.youtube.com/watch?v=luIXZWJUFvw#ws
http://www.youtube.com/watch?v=N4X8mxuvQ4A#ws
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

*

Offline reyalp

  • ******
  • 14082
Re: Shot Histogram Request
« Reply #297 on: 22 / April / 2013, 17:48:21 »
This does suggest a really horrible workaround... if nothing else is wrong, we could just detect values outside of the acceptable range, and switch them to LUA_YIELD
I'll give that a try. Do you think this would work?

Code: [Select]
  if (Lres == LUA_YIELD)return SCRIPT_RUN_RUNNING; //yielded
//print Lres and message here
  if ((Lres >5)||(Lres<0))return SCRIPT_RUN_RUNNING; //TESTING
No. I would do this in lua_resume()
Code: [Select]
  status = luaD_rawrunprotected(L, resume, L->top - nargs);
+  if(status > 5)  // LUA_ERRERR
+   status = 0
You might also want to add a console log or something so you know it happened and whether the script continued to run after that. Note that this is *not* a fix, even if it appears to work, it is terribly wrong and could have other unforeseen consequences down the road. But whether it "works" or not might give us some clue about the nature of the problem.

Quote
Do you think this info in asmsafe.h is relevant?
Off the top of my head, I think it's unlikely:
1) capt_seq_hook_set_nr happens in the capt_seq task, not the kbd task. Even if it was hosing kbd_task, it's hard to see it always causing this exact symptom
2) capt_seq_hook_set_nr is generally set up safely (for most ports), adding additional function calls is probably OK.

If you are making any lua calls in shot_histogram_shot_delay(), that would be a Bad Thing. Don't do that.

edit:
I messed this up originally. Status should be set to 0, because it's only used as the return status if it's non-zero. LUA_YIELD is set later from L->status if applicable.
« Last Edit: 22 / April / 2013, 23:51:48 by reyalp »
Don't forget what the H stands for.


Re: Shot Histogram Request
« Reply #298 on: 22 / April / 2013, 22:51:17 »
I camped out in a wet, windy blizzard on Friday night hoping that the weather would clear the next day as the forecast promised.  It did, and I did several time lapses, including sunrise Saturday morning, and all night Saturday night.
Off topic but I have to acknowledge being impressed.  My kids go camping in Northern Ontario Provincial Parks in the dead of winter but its always a "big deal" to get prepared and organized.  You just seem to casually hike up a mountain and sleep in the snow just so you can get a unique timelapse.  Simply amazing.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline lapser

  • *****
  • 1093
Re: Shot Histogram Request
« Reply #299 on: 23 / April / 2013, 00:08:09 »
You just seem to casually hike up a mountain and sleep in the snow just so you can get a unique timelapse.  Simply amazing.
"Seem to" is the operative word here. All the preparation was "off topic."

Having lived in Michigan, the winter temperatures in Ontario are brutal compared to Oregon. The coldest night I've camped in here was 0 Fahrenheit, which is a mild spring day in Ontario.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

 

Related Topics