
; TestController must be restarted before any changes in this file will be used.

; Manual is here: https://lygte-info.dk/project/TestControllerConfigDevice%20UK.html


; ------------------- OWON P4603 ----------------
#metadef
#idString OWON,P4603, 
#name Owon P4603
#handle P4603
#replaceText MaxVoltage 61
#replaceText MaxCurrent 3.1
#removeLine 5A
; -----------------------------------------------

; ------------------- OWON P4305 -----------------
#metadef
#idString OWON,P4305, 
#name Owon P4305
#handle P4305
#replaceText MaxVoltage 31
#replaceText MaxCurrent 5.1
#removeLine 48V
#removeLine 3A
; -----------------------------------------------

#meta
#author DiplIngenieur
#idString OWON,P4xxxx,
#name OWON P4xxxx
#handle P4xxxx
#port com
; Alternate port types: comnobaud or com, com lets the user define baudrate on the "Load devices" page
#driver SCPIx
#help Owon P4xxxx
#forceUpperCase 1

#notes Only tested with an Owon P4603.

; A list of possible column name with unit and formatter (SI, Time, Int, D0..D6) 
; Format: #value ColumnName Unit Format {Selector}
; Selector is only used when column layout varies with mode, this often require the use of #cmdMode
#value Voltage V D3
#value Current A D3


; How to poll for data, this is used for table and #values?
; a #askMode, #cmdMode and #prepareSample is used before this is string is used.
; Number of returned values must match number of columns defined with #value
; This is a single line command
#askValues MEAS:VOLT?;MEAS:CURR?

; Accept this delay when reading values (seconds)
#readingDelay 1

; Mode change have a longer delay on reading values (seconds)
#modeChangeDelay 3


; Initial commands to meter when establishing connection, used to disable local control
;#initCmd LOCK1

; Final command to meter before breaking connection
#finalCmd OUTP 0
#outputOff OUTP 0

#interfaceType PS
#interface setVoltage VOLT (value)
#interface setCurrent CURR (value)
#interface setOVP OVP (value)
#interface setOCP OCP (value)
#interface setOn OUTP (value)
#interface getVoltage VOLT?
#interface getCurrent CURR?
#interface getOVP VOLT:LIM?
#interface getOCP CURR:LIM?
#interface getOn OUTP?
#interface readVoltage 0
#interface readCurrent 1

; Setup menu functions
; The parameters on the first line is: type name page 
; Settings on the following lines are:
; read: SCPI to read value from device, is used to synchronize when opening setup page or setting equal named fields. Not always used
; readformat: Parse read value.
; write: Send the value to device, this field is used in combination with data fields in the details to send updates to device.
; tip: Add this tip to all components for this input field.
#cmdSetup radio Voltage Main
:read: VOLT?
:write: VOLT #
:update: Output
:tip: Setup this voltage, turn output on
3.3V 3.3
5V 5.0
9V 9.0
12V 12.0
24V 24.0
48V 48.0

#cmdSetup radio Current Main
:read: CURR?
:write: CURR #
:tip: Output will current limit at this current
50mA 0.05
100mA 0.1
250mA 0.250
500mA 0.5
1A 1.0
3A 3.0
5A 5.0

#cmdSetup buttonsOn Output Main
:read: OUTP?
:write: OUTP #
:color: blue
:tip: Turn output on or off
:updatealloff:
Off 0
On 1

#cmdSetup number Voltage Main
:read: VOLT?
:write: VOLT #
:tip: Setup this voltage, does not turn output on/off
Volt 0 MaxVoltage

#cmdSetup number Current Main
:read: CURR?
:write: CURR #
:tip: Setup this current, does not turn output on/off
Amps 0 MaxCurrent

#cmdSetup number OVP Limits
:read: VOLT:LIM?
:write: VOLT:LIM #
Volt 0 MaxVoltage

#cmdSetup number OCP Limits
:read: CURR:LIM?
:write: CURR:LIM #
Amps 0 MaxCurrent
