-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
185 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
{ | ||
"settings": { | ||
"general": { | ||
"projectVersion": "v2", | ||
"masterProject": "..\\..\\modular-psu-firmware.eez-project" | ||
}, | ||
"build": { | ||
"configurations": [ | ||
{ | ||
"name": "Default" | ||
} | ||
], | ||
"files": [] | ||
} | ||
}, | ||
"data": [ | ||
{ | ||
"name": "voltage", | ||
"type": "float", | ||
"defaultValue": "3.0 V" | ||
}, | ||
{ | ||
"name": "can_set_voltage", | ||
"type": "boolean", | ||
"defaultValue": "0" | ||
} | ||
], | ||
"actions": [ | ||
{ | ||
"name": "set_voltage" | ||
}, | ||
{ | ||
"name": "input_voltage" | ||
}, | ||
{ | ||
"name": "close" | ||
} | ||
], | ||
"gui": { | ||
"pages": [ | ||
{ | ||
"name": "main", | ||
"widgets": [ | ||
{ | ||
"type": "Container", | ||
"style": { | ||
"inheritFrom": "default" | ||
}, | ||
"left": 138, | ||
"top": 75, | ||
"width": 204, | ||
"height": 90, | ||
"widgets": [ | ||
{ | ||
"type": "Text", | ||
"style": { | ||
"inheritFrom": "default_M_left" | ||
}, | ||
"left": 0, | ||
"top": 0, | ||
"width": 84, | ||
"height": 40, | ||
"text": "Voltage:" | ||
}, | ||
{ | ||
"type": "Text", | ||
"style": { | ||
"inheritFrom": "edit_value_active_S_center" | ||
}, | ||
"data": "voltage", | ||
"action": "input_voltage", | ||
"left": 84, | ||
"top": 0, | ||
"width": 120, | ||
"height": 40, | ||
"text": "" | ||
}, | ||
{ | ||
"type": "Button", | ||
"style": { | ||
"inheritFrom": "button_M" | ||
}, | ||
"action": "set_voltage", | ||
"left": 84, | ||
"top": 50, | ||
"width": 120, | ||
"height": 40, | ||
"text": "Set", | ||
"enabled": "can_set_voltage", | ||
"disabledStyle": { | ||
"inheritFrom": "button_M_disabled" | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "Container", | ||
"style": { | ||
"inheritFrom": "default" | ||
}, | ||
"left": 0, | ||
"top": 240, | ||
"width": 480, | ||
"height": 32, | ||
"name": "Status line", | ||
"widgets": [ | ||
{ | ||
"type": "Text", | ||
"style": { | ||
"inheritFrom": "status_icon_enabled" | ||
}, | ||
"action": "close", | ||
"left": 0, | ||
"top": 0, | ||
"width": 41, | ||
"height": 32, | ||
"text": "E" | ||
}, | ||
{ | ||
"type": "Text", | ||
"style": { | ||
"inheritFrom": "status_title" | ||
}, | ||
"data": "", | ||
"left": 41, | ||
"top": 0, | ||
"width": 439, | ||
"height": 32, | ||
"text": "Hello World" | ||
} | ||
] | ||
} | ||
], | ||
"left": 0, | ||
"top": 0, | ||
"width": 480, | ||
"height": 272 | ||
} | ||
], | ||
"styles": [], | ||
"fonts": [], | ||
"bitmaps": [], | ||
"colors": [], | ||
"themes": [] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Hello, World! | ||
|
||
from eez import scpi | ||
|
||
def input_voltage(): | ||
global voltage, max_voltage | ||
value = scpi('DISP:INPUT? "",NUMBER,VOLT,0.0,' + str(max_voltage) + '.0,' + str(voltage)) | ||
if value != None: | ||
voltage = float(value) | ||
scpi('DISP:DIALog:DATA "voltage",FLOAT,VOLT,' + str(voltage)) | ||
scpi('DISP:DIALog:DATA "can_set_voltage",INT,1') | ||
|
||
def set_voltage(): | ||
scpi("INST ch1") | ||
scpi("VOLT " + str(voltage)) | ||
|
||
def main(): | ||
global voltage, max_voltage | ||
scpi("INST ch1") | ||
voltage = scpi("VOLT?") | ||
max_voltage = scpi("VOLT? MAX") | ||
|
||
scpi("DISP:DIAL:OPEN \"/Scripts/Hello World.res\"") | ||
try: | ||
scpi('DISP:DIAL:DATA "voltage",FLOAT,VOLT,' + str(voltage)) | ||
|
||
while True: | ||
action = scpi("DISP:DIALog:ACTIon?") | ||
if action == "input_voltage": | ||
input_voltage() | ||
elif action == "set_voltage": | ||
set_voltage() | ||
break | ||
elif action == "close" or action == 0: | ||
break | ||
finally: | ||
scpi("DISP:DIAL:CLOS") | ||
|
||
main() |
Binary file not shown.