jchaos
Version:
module to access chaos resources
78 lines (71 loc) • 2.23 kB
JavaScript
export function show(opts){
var refresh=1000;
var channel=0;
var wname=this.uid;
if(typeof opts === "object"){
if(opts.hasOwnProperty("refresh")){
refresh=opts['refresh'];
}
if(opts.hasOwnProperty("channel")){
channel=opts['channel'];
}
if(opts.hasOwnProperty("name")){
wname=opts['name'];
}
}
jqccs.showPicture(wname,this.uid,refresh,channel);
}
export function triggerMode(mode,ok,bad){
var tmode=0;
switch(mode){
case "continuous":
tmode=0;
break;
case "pulse":
tmode=2;
break;
case "noacquire":
tmode=5;
break;
case "lohi":
tmode=3;
break;
case "hilo":
tmode=4;
break;
default:
}
this.set("TRIGGER_MODE", tmode, ok, bad);
}
export function showLastCalibration(){
return this.show({name:"Calibration of "+this.uid,channel:2,refresh:0});
}
export function setRoi(x,y,width,height){
var cu=this.uid;
width=width-(width&0x1);
height=height-(height&0x1);
x=x-(x&0x1)
y=y-(y&0x1)
jchaos.setAttribute(cu, "OFFSETX", "0", function(){
setTimeout(() => {
jchaos.setAttribute(cu, "OFFSETY", "0", function(){
setTimeout(() => {
jchaos.setAttribute(cu, "WIDTH", String(width), function () {
jchaos.setAttribute(cu, "HEIGHT", String(height), function () {
setTimeout(() => {
console.log("setting OFFSETX:"+x);
jchaos.setAttribute(cu, "OFFSETX", String(x), function () {
setTimeout(() => {
console.log("setting OFFSETY:"+y);
jchaos.setAttribute(cu, "OFFSETY", String(y), function () {
jqccs.instantMessage("ROI " + cu, "(" + x + "," + y + ") " + width + "x" + height, 3000, true);
});},200);
});},200);
});
});
},200);
});
},200);
}
);
}