Skip to content

Instantly share code, notes, and snippets.

@mvladic
Created February 28, 2019 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mvladic/63449906bd1633168b282ce2d3f6ac29 to your computer and use it in GitHub Desktop.
Save mvladic/63449906bd1633168b282ce2d3f6ac29 to your computer and use it in GitHub Desktop.
var defaultValues = storage.getItem("EezDlogValues", {
ch1voltage: true,
ch1current: true,
ch1power: false,
ch2voltage: true,
ch2current: true,
ch2power: false,
period: 0.02,
time: 10,
file: "file.dlog"
});
var values = await input({
title: "Start Dlog",
fields: [
{
name: "ch1voltage",
displayName: "Log channel 1 voltage",
type: "boolean"
},
{
name: "ch1current",
displayName: "Log channel 1 current",
type: "boolean"
},
{
name: "ch1power",
displayName: "Log channel 1 power",
type: "boolean"
},
{
name: "ch2voltage",
displayName: "Log channel 2 voltage",
type: "boolean"
},
{
name: "ch2current",
displayName: "Log channel 2 current",
type: "boolean"
},
{
name: "ch2power",
displayName: "Log channel 2 power",
type: "boolean"
},
{
name: "period",
unit: "time",
validators: [validators.rangeInclusive(0.02, 120)]
},
{
name: "time",
unit: "time",
validators: [validators.rangeInclusive(1, 86400000)]
},
{
name: "file",
type: "string",
validators: [validators.required]
}
]
}, defaultValues);
if (!values) {
session.deleteScriptLogEntry();
return;
}
storage.setItem("EezDlogValues", values);
session.scriptParameters = values;
connection.acquire();
connection.command(`SENS:DLOG:FUNC:VOLT ${values.ch1voltage ? "ON" : "OFF"}, ch1`);
connection.command(`SENS:DLOG:FUNC:CURR ${values.ch1current ? "ON" : "OFF"}, ch1`);
connection.command(`SENS:DLOG:FUNC:POW ${values.ch1power ? "ON" : "OFF"}, ch1`);
connection.command(`SENS:DLOG:FUNC:VOLT ${values.ch2voltage ? "ON" : "OFF"}, ch2`);
connection.command(`SENS:DLOG:FUNC:CURR ${values.ch2current ? "ON" : "OFF"}, ch2`);
connection.command(`SENS:DLOG:FUNC:POW ${values.ch2power ? "ON" : "OFF"}, ch2`);
connection.command(`SENS:DLOG:PER ${values.period}`);
connection.command(`SENS:DLOG:TIME ${values.time}`);
connection.command("TRIG:DLOG:SOUR IMM");
connection.command(`INIT:DLOG "${values.file}"`);
connection.release();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment