Did you leave this line in ?
*(volatile int*)(GPIO_VSYNC_MAX) = sync_period; // write the length of the extended period to the register
It's writing to the same address.
Yep, everything is still there except the line that's commented out.
void _wait_until_remote_button_is_released(void)
{
int tick;
if ( ( conf.remote_enable ) // menu : USB remote enabled - bracket everything in this function
&& ( conf.synch_enable ) // menu : Sync enabled - tells us to wait for USB to disconnect
&& ( usb_sync_wait ) ) // only sync when USB remote is active - don't trap normal shooting
{
usb_remote_status_led(1); // indicate to user we are waiting for remote button to release - this happens every time the camera takes a picture
tick = get_tick_count(); // timestamp so we don't hang here forever if something goes wrong
int std_period = _EngDrvRead(GPIO_VSYNC_MAX);
int sync_time = std_period * 3; // schedule the end of extended period at t = t(synch pulse) + sync_time
do { } while( get_usb_bit() && ((int)get_tick_count()-tick < DELAY_TIMEOUT));
int cur_cnt = *(volatile int*)(GPIO_VSYNC_CURRENT) & 0xffff; // get the counter state at the time of sync
int sync_period = sync_time - (std_period - cur_cnt);
if (std_period - cur_cnt < 10)
{
// too close to overflow, wait for the next period
sync_period -= std_period;
while ((*(volatile int*)(GPIO_VSYNC_CURRENT) & 0xffff) >= cur_cnt) {};
}
*(volatile int*)(GPIO_VSYNC_MAX) = sync_period; // write the length of the extended period to the register
*(volatile int*)(GPIO_VSYNC_UPDATE) = 1;
while (*(volatile int*)(GPIO_VSYNC_UPDATE)) {}; // wait until the new value is applied
//now we are at the beginning of extended period
// *(volatile int*)(GPIO_VSYNC_MAX) = std_period; // back to standard timing on next period
*(volatile int*)(GPIO_VSYNC_UPDATE) = 1;
msleep(40);
sync_counter++ ;
usb_sync_wait = 0 ;
usb_remote_status_led(0); // alert the user that we are all done
}
}
How did you measure this? And what does it look like without the precision sync patch when measured the same way?
Same as last time, with the analog oscilloscope. Without the precision sync patch, around half were within a millisecond or two or three, and the rest may have been 10 to 20 ms out of sync. Probably more sometimes, I didn't do that many trials. But with the (modified) precision patch, sync was quite good, about as good as it is on my other cameras. I did quite a few trials with it enabled.
Yes - from what I understand about how this works, you will have changed the video sync timing. But you are probably not pointed at the right register. It is definitely needed.
As far as I'm concerned, if it works, it works. But it would be interesting to know why it doesn't seem to cause any problems. Tomorrow I'll probably give it a more rigorous test in different lighting conditions just to make sure though.
Also, as the value at this address (on both the S110 and SX40) goes back to zero after the shot, shoudn't everything return to normal anyway?
BTW, I just remembered that there is already
another thread about using the precision sync on the S110. mr.burns, if you're reading this, did you end up trying the precision sync code with the S110 yet?