Skip to content

Commit

Permalink
fuji focus testing with new driver
Browse files Browse the repository at this point in the history
  • Loading branch information
elijahparker committed Nov 12, 2019
1 parent 76fe778 commit b2f78a1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion camera/ptpjs/common/ptp-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ exports.PTP_RC_SessionAlreadyOpened = 0x201E;
exports.PTP_RC_TransactionCanceled = 0x201F;
exports.PTP_RC_SpecificationOfDestinationUnsupported = 0x2020;

var LOG_LEVEL = 0;
var LOG_LEVEL = 1;
var LOG_USB = false;

function _logD() {
Expand Down
8 changes: 4 additions & 4 deletions camera/ptpjs/drivers/fuji.js
Original file line number Diff line number Diff line change
Expand Up @@ -739,22 +739,22 @@ driver.moveFocus = function(camera, steps, resolution, callback, absPos) {
currentPos *= FUJI_FOCUS_RESOLUTION;
if(target && Math.abs(parseInt(currentPos) - parseInt(target)) < FUJI_FOCUS_RESOLUTION) {
camera.fujiFocusPosCache = parseInt(target);
console.log("PTP: focusFuji: target reached:", currentPos, ", targetPos", target, "(" + camera.status.focusPos + ")");
_logD("focus: target reached:", currentPos, ", targetPos", target, "(" + camera.status.focusPos + ")");
if (cb) cb(null, Math.round(camera.fujiFocusPosCache / FUJI_FOCUS_RESOLUTION));
} else {
var targetPos = target || parseInt(currentPos) + relativeMove;
if(targetPos == 0) targetPos = 2;
var targetOffset = 0;
if(attempts > 0) targetOffset = sign(targetPos - currentPos) * attempts;
console.log("PTP: focusFuji: currentPos", currentPos, ", targetPos", targetPos, "targetOffset", targetOffset);
_logD("focus: currentPos", currentPos, ", targetPos", targetPos, "targetOffset", targetOffset);
try {
ptp.setProp16(camera._dev, 0xD171, -Math.round(targetPos + targetOffset), function(err) {
if(err) _logE("focus move error:", err);
attempts++;
if(attempts < 5) {
doFocus(targetPos, cb);
} else {
console.log("PTP: focusFuji: error: target failed:", currentPos, ", targetPos", targetPos);
_logD("focus: error: target failed:", currentPos, ", targetPos", targetPos);
if (cb) cb("failed to reach focus target", camera.status.focusPos);
}
});
Expand Down Expand Up @@ -787,7 +787,7 @@ driver.moveFocus = function(camera, steps, resolution, callback, absPos) {
if(attempts < 5) {
startFocus(cb);
} else {
console.log("PTP: focusFuji: error: failed to switch focus control");
_logE("failed to switch focus control");
if (cb) cb("failed to switch focus control");
}
}
Expand Down

0 comments on commit b2f78a1

Please sign in to comment.