Now that I have two S110's, the SX40 rig project will be put on the backburner for a few weeks. But fortunantly, as I'm pretty much doing the exact same thing, all that will be changing is the camera I'm testing the code with.
Firstly, as I would like to play with the S110 rig this weekend (high hopes there
), I won't be transfering any data just yet, I just want to sync the shutter for today. Which I don't have any questions about yet.
But I have run into another problem though. When using the modified _wait_until_remote_button_is_released code, which works fine on the SX40, I run into an E26 error on both of my S110's. A quick search revealed that this is WbCaptureTimeOut, which would make sense, but how should I get around this error?
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
// #ifdef USB_REMOTE_PRECISION_SYNC
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)); //Old
if ( conf.remote_input == 0 )
{
do { } while( get_usb_bit() && ((int)get_tick_count()-tick < DELAY_TIMEOUT));
}
if ( conf.remote_input == 1 )
{
prevent_kbd_read = 1; // to make sure only my_kbd_read_keys_alt runs
msleep(10);
// *((volatile int *) 0xc022c200) = 0x93d800;
// do { } while( (*(short*)0xc090004a < 300) && ((int)get_tick_count()-tick < DELAY_TIMEOUT));
do
{
msleep(5);
} while( (kbd_is_key_pressed_alt(KEY_SHOOT_FULL)) && ((int)get_tick_count()-tick < DELAY_TIMEOUT));
// *((volatile int *) 0xc022c200) = 0x83dc00;
prevent_kbd_read = 0;
}
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);
// #else
// #endif
sync_counter++ ;
usb_sync_wait = 0 ;
usb_remote_status_led(0); // alert the user that we are all done
}
edit: I just realised I don't have the address for the AF LED. I know the power LED is 0xC022C30C from the 110 porting thread, and that it's the same for the S100, so if anyone knows either the S110 or S100 AF LED address either will do.
Thanks