+++ /dev/null
-// mds
-var $exeParams = { "mag": 0, "spot":0, "int":0, "shift":{"x":0, "y":0}, "defocus":0 }
-var $currentParams = { "mag": 0, "spot":0, "int":0, "shift":{"x":0, "y":0}, "defocus":0 }
-
-$(function () {
- $( "#search_button" ).click({mode: "search"}, onMode );
- $( "#focus_button" ).click({mode: "focus"}, onMode );
- $( "#exposure_button" ).click({mode: "exposure"}, onMode );
- $( "#getparams_button" ).click( getCurrentParams );
- $( "#sizech_button" ).toggle( smallScreenSize, bigScreenSize );
- $( "#512_button" ).click({size:0}, changeImageSize );
- $( "#256_button" ).click({size:1}, changeImageSize );
- $( "#plus_defocus_button" ).click({params:1}, changeDefocus );
- $( "#minus_defocus_button" ).click({params:-1}, changeDefocus );
- $( "#reset_defocus_button" ).click( resetDefocus );
-});
-
-// changeScreenSize
-function smallScreenSize () {
- $( "#camera_screen" ).attr( "width", "256");
- $( "#camera_screen" ).attr( "height", "256");
-}
-
-function bigScreenSize () {
- $( "#camera_screen" ).attr( "width", "512");
- $( "#camera_screen" ).attr( "height", "512");
-}
-
-// onMode
-function onMode (event) {
- var mode = event.data.mode;
- console.log(mode);
- changeColor(mode);
- getConfigParams(mode);
- changeParams();
- //getCurrentParams();
- displayCurrentParams();
-}
-
-// changeColor
-function changeColor (mode) {
- resetColor();
- $( "#"+mode+"_button" ).attr( "class", "btn btn-default btn-lg btn-danger");
-}
-
-function resetColor () {
- $( "#search_button" ).attr( "class", "btn btn-default btn-lg btn-default");
- $( "#focus_button" ).attr( "class", "btn btn-default btn-lg btn-default");
- $( "#exposure_button" ).attr( "class", "btn btn-default btn-lg btn-default");
-}
-
-// changeImageSize
-function changeImageSize (event) {
- var size = event.data.size;
- controlCameraParams(size);
- switch (size) {
- case 0:
- $( "#512_button" ).attr( "class", "btn btn-default btn-danger");
- $( "#256_button" ).attr( "class", "btn btn-default btn-default");
- break;
- case 1:
- $( "#256_button" ).attr( "class", "btn btn-default btn-danger");
- $( "#512_button" ).attr( "class", "btn btn-default btn-default");
- break;
- }
-}
-
-// getConfigParams
-function getConfigParams(mode){
- $exeParams["mag"] = params[mode]["mag"];
- $exeParams["spot"] = params[mode]["spot"];
- $exeParams["int"] = params[mode]["int"];
- $exeParams["shift"] = params[mode]["shift"];
- $exeParams["defocus"] = params[mode]["defocus"];
-}
-
-// changeParams
-function changeParams () {
- controlMag($exeParams["mag"]);
- controlSpotSize($exeParams["spot"]);
- // controlShift($exeParams["shift"]);
-}
-
-// getCurrentParams
-function getCurrentParams () {
- getAllParams();
-}
-
-// displayCurrentParams
-function displayCurrentParams (mode) {
- console.log( "display"+$currentParams["spot"] );
- $( "#mag" ).html( $currentParams["mag"]);
- $( "#spot" ).html( $currentParams["spot"]);
- $( "#int" ).html( $currentParams["int"]);
- $( "#shift" ).html( $currentParams["shift"]["x"]+", "+$currentParams["shift"]["y"]);
- $( "#defocus" ).html( $currentParams["defocus"]+" nm");
-}
-
-// changeDefocus
-function changeDefocus (event) {
- var params = event.data.params;
- controlDefocus(params);
-}