Rearranged state dictionary
This commit is contained in:
parent
904703b581
commit
20e49ad65c
2 changed files with 23 additions and 12 deletions
|
|
@ -51,7 +51,7 @@ function deleteCapture(capture_id) {
|
||||||
}
|
}
|
||||||
var r = confirm("Warning! This will delete all copies of this capture from the Raspberry Pi. Click OK to proceed.");
|
var r = confirm("Warning! This will delete all copies of this capture from the Raspberry Pi. Click OK to proceed.");
|
||||||
if (r == true) {
|
if (r == true) {
|
||||||
safeRequest("DELETE", baseURI+"/capture/"+capture_id+"/", null, deleteCaptureCallback, false)
|
safeRequest("DELETE", baseURI+"/camera/capture/"+capture_id+"/", null, deleteCaptureCallback, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -62,7 +62,7 @@ function deleteAllCaptures() {
|
||||||
}
|
}
|
||||||
var r = confirm("Warning! This will delete all copies of all captures from the Raspberry Pi. Click OK to proceed.");
|
var r = confirm("Warning! This will delete all copies of all captures from the Raspberry Pi. Click OK to proceed.");
|
||||||
if (r == true) {
|
if (r == true) {
|
||||||
safeRequest("DELETE", baseURI+"/capture/", null, deleteAllCapturesCallback, false)
|
safeRequest("DELETE", baseURI+"/camera/capture/", null, deleteAllCapturesCallback, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -71,7 +71,7 @@ function getCaptures() {
|
||||||
console.log(status);
|
console.log(status);
|
||||||
updateCaptureList(response);
|
updateCaptureList(response);
|
||||||
}
|
}
|
||||||
safeRequest("GET", baseURI+"/capture", null, updateCapturesCallback, false)
|
safeRequest("GET", baseURI+"/camera/capture", null, updateCapturesCallback, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateCaptureList(response) {
|
function updateCaptureList(response) {
|
||||||
|
|
@ -84,7 +84,7 @@ function updateCaptureList(response) {
|
||||||
// For each capture in the response array
|
// For each capture in the response array
|
||||||
response.forEach(function(element) {
|
response.forEach(function(element) {
|
||||||
// Store the capture object URI
|
// Store the capture object URI
|
||||||
element_uri = `${baseURI}/capture/${element.id}`
|
element_uri = `${baseURI}/camera/capture/${element.id}`
|
||||||
|
|
||||||
// Generate inner HTML from capture object
|
// Generate inner HTML from capture object
|
||||||
html = `
|
html = `
|
||||||
|
|
@ -131,7 +131,7 @@ function getStagePositions() {
|
||||||
console.log(status, response);
|
console.log(status, response);
|
||||||
updateStagePositions(response);
|
updateStagePositions(response);
|
||||||
}
|
}
|
||||||
safeRequest("GET", baseURI+"/position", null, updatePositionCallback, false)
|
safeRequest("GET", baseURI+"/stage/position", null, updatePositionCallback, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Capture methods
|
// Capture methods
|
||||||
|
|
@ -159,7 +159,7 @@ function newCapture(filename, keep_on_disk, use_video_port, resizeWidth=null, re
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(payload);
|
console.log(payload);
|
||||||
safeRequest("POST", baseURI+"/capture/", payload, newCaptureCallback);
|
safeRequest("POST", baseURI+"/camera/capture/", payload, newCaptureCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
function newCaptureFromInput() {
|
function newCaptureFromInput() {
|
||||||
|
|
@ -211,7 +211,7 @@ function setStagePositions(x_abs, y_abs, z_abs) {
|
||||||
console.log(status, response);
|
console.log(status, response);
|
||||||
updateStagePositions(response);
|
updateStagePositions(response);
|
||||||
}
|
}
|
||||||
safeRequest("POST", baseURI+"/position", { "absolute": true, "x": x_abs, "y": y_abs, "z": z_abs}, absMoveCallback)
|
safeRequest("POST", baseURI+"/stage/position", { "absolute": true, "x": x_abs, "y": y_abs, "z": z_abs}, absMoveCallback)
|
||||||
}
|
}
|
||||||
|
|
||||||
function moveStagePositions(x_rel, y_rel, z_rel) {
|
function moveStagePositions(x_rel, y_rel, z_rel) {
|
||||||
|
|
@ -223,7 +223,7 @@ function moveStagePositions(x_rel, y_rel, z_rel) {
|
||||||
console.log(status, response);
|
console.log(status, response);
|
||||||
updateStagePositions(response);
|
updateStagePositions(response);
|
||||||
}
|
}
|
||||||
safeRequest("POST", baseURI+"/position", { "absolute": false, "x": x_rel, "y": y_rel, "z": z_rel}, relMoveCallback)
|
safeRequest("POST", baseURI+"/stage/position", { "absolute": false, "x": x_rel, "y": y_rel, "z": z_rel}, relMoveCallback)
|
||||||
}
|
}
|
||||||
|
|
||||||
function setStagePositionsFromInput() {
|
function setStagePositionsFromInput() {
|
||||||
|
|
@ -266,7 +266,7 @@ window.addEventListener('wheel', function(e) {
|
||||||
console.log(z_delta);
|
console.log(z_delta);
|
||||||
console.log(e.target.parentNode.classList.value);
|
console.log(e.target.parentNode.classList.value);
|
||||||
// Make a position request
|
// Make a position request
|
||||||
safeRequest("POST", baseURI+"/position", { "absolute": false, "z": z_delta}, keyMoveCallback)
|
safeRequest("POST", baseURI+"/stage/position", { "absolute": false, "z": z_delta}, keyMoveCallback)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,17 +90,28 @@ class Microscope(object):
|
||||||
Return:
|
Return:
|
||||||
dict: Dictionary containing position data, and :py:attr:`openflexure_microscope.camera.base.BaseCamera.state`
|
dict: Dictionary containing position data, and :py:attr:`openflexure_microscope.camera.base.BaseCamera.state`
|
||||||
"""
|
"""
|
||||||
state = {}
|
state = {
|
||||||
|
'camera': {},
|
||||||
|
'stage': {},
|
||||||
|
'plugin': {}
|
||||||
|
}
|
||||||
|
|
||||||
# Add stage position
|
# Add stage position
|
||||||
position = self.stage.position
|
position = self.stage.position
|
||||||
state['position'] = {
|
state['stage']['position'] = {
|
||||||
'x': position[0],
|
'x': position[0],
|
||||||
'y': position[1],
|
'y': position[1],
|
||||||
'z': position[2],
|
'z': position[2],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
backlash = self.stage.backlash.tolist()
|
||||||
|
state['stage']['backlash'] = {
|
||||||
|
'x': backlash[0],
|
||||||
|
'y': backlash[1],
|
||||||
|
'z': backlash[2],
|
||||||
|
}
|
||||||
|
|
||||||
# Add camera state
|
# Add camera state
|
||||||
state.update(self.camera.state)
|
state['camera'] = self.camera.state
|
||||||
|
|
||||||
return state
|
return state
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue