if we fail to spot a direction, use single stepping instead.

https://github.com/gphoto/libgphoto2/issues/694
This commit is contained in:
Marcus Meissner
2022-12-19 13:55:03 +01:00
parent 0fc36ea617
commit 4e212b3df3

View File

@@ -5281,11 +5281,24 @@ _put_Sony_ShutterSpeed(CONFIG_PUT_ARGS) {
break;
}
// Calculating jump width
if (direction > 0)
value.u8 = 0x00 + position_new - position_current;
else
value.u8 = 0x100 + position_new - position_current;
/* If something failed, fall back to single step, https://github.com/gphoto/libgphoto2/issues/694 */
if (position_current == position_new) {
GP_LOG_D ("posNew and pos_current both %d, fall back to single step", position_current);
if (old > new) {
value.u8 = 0x01;
direction = 1;
}
else {
value.u8 = 0xff;
direction = -1;
}
} else {
// Calculating jump width
if (direction > 0)
value.u8 = 0x00 + position_new - position_current;
else
value.u8 = 0x100 + position_new - position_current;
}
a = dpd->CurrentValue.u32>>16;
b = dpd->CurrentValue.u32&0xffff;