; TestController must be restarted before any changes in this file will be used.
; Manual is here: https://lygte-info.dk/project/TestControllerConfigDevice%20UK.html

; UNTESTED
#metadef
#author TheDefpom http://www.TheDefpom.com
#idString Siglent Technologies,SDL1020X-E,
#name Siglent SDL1020X-E
#handle SDL1020X-E
#replaceText MaxPower 200

; UNTESTED
#metadef
#author TheDefpom http://www.TheDefpom.com
#idString Siglent Technologies,SDL1020X,
#name Siglent SDL1020X
#handle SDL1020X
#replaceText MaxPower 200

; UNTESTED
#metadef
#author TheDefpom http://www.TheDefpom.com
#idString Siglent Technologies,SDL1020X,
#name Siglent SDL1020
#handle SDL1020X
#replaceText MaxPower 200

; UNTESTED
#metadef
#author TheDefpom_ http://www.TheDefpom.com
#idString Siglent Technologies,SDL1030X-E,
#name Siglent SDL1030X-E
#handle SDL1030X-E
#replaceText MaxPower 300

; NOTE currently the SDL1030X is returned as SDL1030 !
#metadef
#author TheDefpom http://www.TheDefpom.com
#idString Siglent Technologies,SDL1030X,
#name Siglent SDL1030X
#handle SDL1030X
#replaceText MaxPower 300

; NOTE currently the SDL1030X is returned as SDL1030 !
#metadef
#author TheDefpom http://www.TheDefpom.com
#idString Siglent Technologies,SDL1030X,
#name Siglent SDL1030
#handle SDL1030X
#replaceText MaxPower 300


#meta
#author TheDefpom http://www.TheDefpom.com
#idString Siglent Technologies,SDL10xxXxx,
#name Siglent SDL10xxXxx
#handle SDL10xxXxx
#port 5025
#driver SCPIx




;***********************************************************************************
; Rev 1.2 Released 12th August 2023
; Written by Scott - TheDefpom 
; Website: http://www.TheDefpom.com 
; Electronics Repair Videos: https://www.youtube.com/TheDefpom
;***********************************************************************************
; V1.1 Bug fix for mAh battery capacity value and incorrect labelling of CR panel resistance setting.
; V1.2 Minor change to prevent instrument changing modes to CC & locking front panel on connection (panel still locks on setting changes)
;
; Please add any notes about 3rd party changes or future definition updates below:
;
;
;
;
;
;***********************************************************************************

#notes 
Rev 1.2 Released 12th August 2023
- V1.2 Minor change to prevent instrument changing modes to CC & locking front panel on connection (panel still locks on setting changes)

Rev 1.1 Released 27th May 2022
- Bug fix for mAh battery capacity value and incorrect labelling of CR panel resistance setting.

Rev 1.0 Released 17th October 2021
Written by Scott - TheDefpom
Website: http://www.TheDefpom.com 
Electronics Repair Videos: https://www.youtube.com/TheDefpom

Currently only tested with the SDL1030X, which is returned as SDL1030, the SDL1030X-E may be the same.
The SDL1020X-E and SDL1020X may return as SDL1020, testing will verify this.

No other variants of SDL10xxXxx have been tested at the time of release, but they should work !



; 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 D5 Constant_Current,Constant_Voltage,Constant_Resistance,Constant_Power,LED
#value Current A D5 Constant_Current,Constant_Voltage,Constant_Resistance,Constant_Power,LED
#value Power W D3 Constant_Current,Constant_Voltage,Constant_Resistance,Constant_Power,LED
#value Resistance R D4 Constant_Current,Constant_Voltage,Constant_Resistance,Constant_Power,LED
#value Capacity Ah D3
#value Discharge_Time s Int


; added this in V1.1 to correct mAh display in logging table
#scpiCmd getCapacity? txrx? :SOUR:BATT:DISCHA:CAP?
:readmath: value/1000.0


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

; Format of answer: f=float, u=remove trailing letters, x=skip, *=Zero upper case values if this value is 0
#askValuesReadFormat ffffff

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

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

; String to ask about actual meter mode, it is mostly used for DMM's
; This is a single line command
#askMode :SOUR:FUNC?

; When one of these commands are used through the command interface a new configuration will be done before using #askMode
; Only one word for each #mayModifyMode
; Specify command without initial colon and in the shortest possible form
;#mayModifyMode 

; Prepare the meter to response to #askValues
;#prepareSample arm:sour imm;:arm:count 1;:trig:sour imm;:trig:count 1;:trig:samp:count 1;init

; Initial commands to meter when establishing connection, used to disable local control - Sets Instrument and local flag to CC on app connection
;#initCmd :SOUR:FUNC CURR;[*OPC];ModeCC
#initCmd :SOUR:FUNC?

; Final command to meter before breaking connection, used to restore local control
;#finalCmd *CLS;*RST

; Used to turn output off for power supplies, generators and electronic loads
#outputOff :SOUR:INP::STAT OFF

; This type will specify the handle name for the first device with this type
; This makes it possible to easy get generic handle names for a setup, that will work with a script
#interfaceType LOAD

; These function will adjust settings
; These may not even be needed, as I am not referencing the interface variables anywhere, BUT TC might use them internally ?
#interface setVoltage :SOUR:VOLT:LEV:IMM (value)
#interface setCurrent :SOUR:CURR:LEV:IMM (value)
#interface setPower :SOUR:POW:LEV:IMM (value)
#interface setResistance :SOUR:RES:LEV:IMM (value)
#interface setRemoteSense SYST:SENS:STAT (value)
#interface setOn :SOUR:INP:STAT (value)
#interface setMode :SOUR:FUNC (value)

; These function will return the value applied with the set function
; These may not even be needed, as I am not referencing the interface variables anywhere, BUT TC might use them internally ?
#interface getVoltage :SOUR:VOLT:LEV:IMM?
#interface getCurrent :SOUR:CURR:LEV:IMM?
#interface getPower :SOUR:POW:LEV:IMM?
#interface getResistance :SOUR:RES:LEV:IMM?
#interface getRemoteSense SYST:SENS:STAT?
#interface getOn :SOUR:INP:STAT?
#interface getMode :SOUR:FUNC?

; These functions will read the actual values
; These can either contain a number that will reference to a data column or they can contain a command to read the value
; These may not even be needed, as I am not referencing the interface variables anywhere, BUT TC might use them internally ?
#interface readVoltage 0
#interface readCurrent 1
#interface readPower 2





;********************************************************
; Handle mode selection tracking
;********************************************************
; Hack to determine and track what mode the instrument is in as there are several parallel modes,
; Siglents weird arrangement makes it impossible to just ask the instrument !
; It intercepts the ModeCC, ModeCV etc. SCPI command sent to the intrument,
; blocks it, and sets a local variable so we can track the last selected mode.
; I am setting the mode in two variables, to allow for switching to the utility pane and back again.
; :SOUR:FUNC - Constant modes - CC,CV,CR,CP,LED
; :SOUR:FUNC:TRAN - Dynamic modes - CC,CV,CR,CP
; :SOUR:BATT:FUNC - Battery mode
; :SOUR:OCP:FUNC - Over Current Protection Test mode
; :SOUR:OPP:FUNC - Over Power Protection Test mode
;********************************************************
#scpiCmd ModeCC none?
:setvar: myMode="CC",myMode2="CC"

#scpiCmd ModeCV none?
:setvar: myMode="CV",myMode2="CV"

#scpiCmd ModeCR none?
:setvar: myMode="CR",myMode2="CR"

#scpiCmd ModeCP none?
:setvar: myMode="CP",myMode2="CP"

#scpiCmd ModeDynCC none?
:setvar: myMode="Dyn_CC",myMode2="Dyn_CC"

#scpiCmd ModeDynCV none?
:setvar: myMode="Dyn_CV",myMode2="Dyn_CV"

#scpiCmd ModeDynCR none?
:setvar: myMode="Dyn_CR",myMode2="Dyn_CR"

#scpiCmd ModeDynCP none?
:setvar: myMode="Dyn_CP",myMode2="Dyn_CP"

#scpiCmd ModeLED none?
:setvar: myMode="LED",myMode2="LED"

#scpiCmd ModeBatt none?
:setvar: myMode="Batt",myMode2="Batt"

#scpiCmd ModeOCPT none?
:setvar: myMode="OCPT",myMode2="OCPT"

#scpiCmd ModeOPPT none?
:setvar: myMode="OPPT",myMode2="OPPT"



; switch to handle switching to the utility pane in the setup window, and back again to the active mode settings
#scpiCmd MyUtilOn none?
:setvar: myMode="Utility"

#scpiCmd MyUtilOff none?
:setvar: myMode=myMode2



; handle the myMode query, killing it, and returning the value
#scpiCmd myMode? none?
:readmath: myMode

; handle the myMode2 query, killing it, and returning the value
#scpiCmd myMode2? none?
:readmath: myMode2

;#initCmd :SOUR:FUNC CURR







;********************************************************
; Create the MODE window and functions
;********************************************************
; The ModeCC, ModeCV etc. are used to set the local variable myMode, and are sent out via SCPI, 
; these are then intercepted by SCPIx on the way out and filtered, 
; which then sets the myMode variable value to flag the last selected mode.
; Yes its a hack, but it works !
;********************************************************
; define the Mode button layout
#cmdModeLayout 4 4

; Strings to configure device in different modes
; First parameter must match a #value (4 parameter) and second parameter must match what #askMode returns
; First parameter is also used in shortcut menu

#cmdMode Constant_Current CURRENT
:SOUR:FUNC CURR;[*OPC];ModeCC

#cmdMode Constant_Voltage VOLTAGE
:SOUR:FUNC VOLT;[*OPC];ModeCV

#cmdMode Constant_Resistance RESISTANCE
:SOUR:FUNC RES;[*OPC];ModeCR

#cmdMode Constant_Power POWER
:SOUR:FUNC POW;[*OPC];ModeCP


#cmdMode Dynamic_Current CURRENT
:SOUR:FUNC:TRAN CURR;[*OPC];ModeDynCC

#cmdMode Dynamic_Voltage VOLTAGE
:SOUR:FUNC:TRAN VOLT;[*OPC];ModeDynCV

#cmdMode Dynamic_Resistance RESISTANCE
:SOUR:FUNC:TRAN RES;[*OPC];ModeDynCR

#cmdMode Dynamic_Power POWER
:SOUR:FUNC:TRAN POW;[*OPC];ModeDynCP


#cmdMode LED LED
:SOUR:FUNC LED;[*OPC];ModeLED

#cmdMode Battery 1
:SOUR:BATT:FUNC;[*OPC];ModeBatt

#cmdMode OCPT 1
:SOUR:OCP:FUNC;[*OPC];ModeOCPT

#cmdMode OPPT 1
:SOUR:OPP:FUNC;[*OPC];ModeOPPT



#cmdModeCheck Utility_Pane UtOption 0
MyUtilOn
MyUtilOff






;*********************************************************
; View selectors for the setup window,
; triggered from the Mode window
; :SOUR:FUNC - Constant modes - CC,CV,CR,CP,LED
; :SOUR:FUNC:TRAN - Dynamic modes - CC,CV,CR,CP
; :SOUR:BATT:FUNC - Battery mode
; :SOUR:OCP:FUNC - Over Current Protection Test mode
; :SOUR:OPP:FUNC - Over Power Protection Test mode
;*********************************************************

; reads the myMode2 variable and uses that to show/hide the utilies pane in the Setup window to reduce clutter.
;#cmdSetup selector Mode_settings2
;:read: myMode2?
;:update: Utility,Hide
;Utility Utility.
;Hide Hide.


; reads the myMode variable and uses that to change the Setup window views when modes are changed to reduce clutter.
#cmdSetup selector Mode_settings
:read: myMode?
:updatemodechange:
CC CC.
CV CV.
CR CR.
CP CP.
LED LED.
Dyn_CC Dyn_CC.
Dyn_CV Dyn_CV.
Dyn_CR Dyn_CR.
Dyn_CP Dyn_CP.
Batt Batt.
OCPT OCPT.
OPPT OPPT.
Utility Utility.






;*******************************************************************
; Create the SETUP window and functions
;*******************************************************************


#cmdSetup info Active_Mode Info
:read: myMode2?
:readmath: getElement("Constant Current;Constant Voltage;Constant Resistance;Constant Power;LED;Dynamic CC;Dynamic CV;Dynamic CR;Dynamic CP;Battery;OCPT;OPPT",listIndex(unQuote(value),"CC CV CR CP LED Dyn_CC Dyn_CV Dyn_CR Dyn_CP Batt OCPT OPPT"," "),";")
:updatemodechange:
:layout:

;The first number is thickness of line, the second number is percentage of window width.
;The third value is: Solid, Dual, DashedShort, DashedLong, Raised, Sunken
#cmdSetup separator Line Info
2 95 Sunken






;*********************************************************
; Utility panel
;*********************************************************
#cmdSetup radio Current_Limit_Protection Utility
:read: :SOUR:CURR:PROT:STAT?
:write: :SOUR:CURR:PROT:STAT
;:updatemodechange:
Off 0
On 1

#cmdSetup number Current_Limit Utility
:read: :SOUR:CURR:PROT:LEV?
:write: :SOUR:CURR:PROT:LEV
;:updatemodechange:
:buttontext: Set
Amps 0.0001 30

#cmdSetup number Current_Limit_Delay Utility
:read: :SOUR:CURR:PROT:DEL?
:write: :SOUR:CURR:PROT:DEL
;:updatemodechange:
:buttontext: Set
Seconds 0.00 60

;The first number is thickness of line, the second number is percentage of window width.
;The third value is: Solid, Dual, DashedShort, DashedLong, Raised, Sunken
#cmdSetup separator - Utility
2 80 Sunken

#cmdSetup radio Power_Limit_Protection Utility
:read: :SOUR:POW:PROT:STAT?
:write: :SOUR:POW:PROT:STAT
;:updatemodechange:
Off 0
On 1

#cmdSetup number Power_Limit Utility
:read: :SOUR:POW:PROT:LEV?
:write: :SOUR:POW:PROT:LEV
;:updatemodechange:
:buttontext: Set
Watts 0.0001 MaxPower

#cmdSetup number Power_Limit_Delay Utility
:read: :SOUR:POW:PROT:DEL?
:write: :SOUR:POW:PROT:DEL
;:updatemodechange:
:buttontext: Set
Seconds 0.00 60

;The first number is thickness of line, the second number is percentage of window width.
;The third value is: Solid, Dual, DashedShort, DashedLong, Raised, Sunken
#cmdSetup separator - Utility
2 80 Sunken

#cmdSetup comboboxHot Averaging Utility
:read: SENS:AVER:COUN?
:write: SENS:AVER:COUN
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14

#cmdSetup radio Current_Monitor_Output Utility
:read: SYST:IMONI:STAT?
:write: SYST:IMONI:STAT
;:updatemodechange:
Off 0
On 1

#cmdSetup radio Voltage_Monitor_Output Utility
:read: SYST:VMONI:STAT?
:write: SYST:VMONI:STAT
;:updatemodechange:
Off 0
On 1

#cmdSetup radio Remote_Sense Utility
:read: SYST:SENS:STAT?
:write: SYST:SENS:STAT
:updatemodechange:
Off 0
On 1







;*********************************************************
; CC panel
;*********************************************************
;#cmdSetup info CC_Mode_Settings CC
;:layout:

#cmdSetup radio Current_Range CC
:read: :SOUR:CURR:IRANG?
:write: :SOUR:CURR:IRANG
5A 5
30A 30

#cmdSetup radio Voltage_Range CC
:read: :SOUR:CURR:VRANG?
:write: :SOUR:CURR:VRANG
36V 36
150V 150

#cmdSetup number Current_Setting CC
:read: :SOUR:CURR:LEV:IMM?
:write: :SOUR:CURR:LEV:IMM
:update: Current
:buttontext: Set
Amps 0 30

#cmdSetup number Positive_Slew_Setting CC
:read: :SOUR:CURR:SLEW:POS?
:write: :SOUR:CURR:SLEW:POS
:buttontext: Set
A/us 0.001 2.50

#cmdSetup number Negative_Slew_Setting CC
:read: :SOUR:CURR:SLEW:NEG?
:write: :SOUR:CURR:SLEW:NEG
:buttontext: Set
A/us 0.001 2.50






;*********************************************************
; CV panel
;*********************************************************
;#cmdSetup info CV_Mode_Settings CV
;:layout:

#cmdSetup radio Current_Range CV
:read: :SOUR:VOLT:IRANG?
:write: :SOUR:VOLT:IRANG
;:updatemodechange:
5A 5
30A 30

#cmdSetup radio Voltage_Range CV
:read: :SOUR:VOLT:VRANG?
:write: :SOUR:VOLT:VRANG
;:updatemodechange:
36V 36
150V 150

#cmdSetup number Voltage_Setting CV
:read: :SOUR:VOLT:LEV:IMM?
:write: :SOUR:VOLT:LEV:IMM
;:updatemodechange:
:update: Voltage
:buttontext: Set
Volts 0.000 150.000






;*********************************************************
; CR panel
;*********************************************************
;#cmdSetup info CR_Mode_Settings CR
;:layout:

#cmdSetup radio Current_Range CR
:read: :SOUR:RES:IRANG?
:write: :SOUR:RES:IRANG
;:updatemodechange:
5A 5
30A 30

#cmdSetup radio Voltage_Range CR
:read: :SOUR:RES:VRANG?
:write: :SOUR:RES:VRANG
;:updatemodechange:
36V 36
150V 150

; THIS DOESNT SEEM TO CONTROL ANYTHING - but is listed in the Remote SCPI Manual?
;#cmdSetup comboboxHot Resistance_Range CR
;:read: :SOUR:RES:RRANG?
;:write: :SOUR:RES:RRANG
;:updatemodechange:
;Low LOW
;Middle MIDDLE
;High HIGH
;Upper UPPER

#cmdSetup number Resistance_Setting CR
:read: :SOUR:RES:LEV:IMM?
:write: :SOUR:RES:LEV:IMM
;:updatemodechange:
:update: Resistance
:buttontext: Set
Ohms 0.03 10000





;*********************************************************
; CP panel
;*********************************************************
;#cmdSetup info CP_Mode_Settings CP
;:layout:

#cmdSetup radio Current_Range CP
:read: :SOUR:POW:IRANG?
:write: :SOUR:POW:IRANG
;:updatemodechange:
5A 5
30A 30

#cmdSetup radio Voltage_Range CP
:read: :SOUR:POW:VRANG?
:write: :SOUR:POW:VRANG
;:updatemodechange:
36V 36
150V 150

#cmdSetup number Power_Setting CP
:read: :SOUR:POW:LEV:IMM?
:write: :SOUR:POW:LEV:IMM
;:updatemodechange:
:update: Power
:buttontext: Set
Watts 0 MaxPower






;*********************************************************
; Dynamic CC panel
;*********************************************************
;#cmdSetup info Dynamic_CC_Settings Dyn_CC
;:layout:

#cmdSetup comboboxHot Dynamic_Mode Dyn_CC
:read: :SOUR:CURR:TRAN:MODE?
:write: :SOUR:CURR:TRAN:MODE
Continuous CONTINUOUS
Pulse PULSE
Toggle TOGGLE

#cmdSetup radio Current_Range Dyn_CC
:read: :SOUR:CURR:TRAN:IRANG?
:write: :SOUR:CURR:TRAN:IRANG
;:updatemodechange:
5A 5
30A 30

#cmdSetup radio Voltage_Range Dyn_CC
:read: :SOUR:CURR:TRAN:VRANG?
:write: :SOUR:CURR:TRAN:VRANG
;:updatemodechange:
36V 36
150V 150

#cmdSetup number A_Level Dyn_CC
:read: :SOUR:CURR:TRAN:ALEV?
:write: :SOUR:CURR:TRAN:ALEV
;:updatemodechange:
:buttontext: Set
Amps 0.0000 30

#cmdSetup number B_Level Dyn_CC
:read: :SOUR:CURR:TRAN:BLEV?
:write: :SOUR:CURR:TRAN:BLEV
;:updatemodechange:
:buttontext: Set
Amps 0.0000 30

#cmdSetup number A_Width Dyn_CC
:read: :SOUR:CURR:TRAN:AWID?
:write: :SOUR:CURR:TRAN:AWID
;:updatemodechange:
:buttontext: Set
Seconds 0.000022 999.0

#cmdSetup number B_Width Dyn_CC
:read: :SOUR:CURR:TRAN:BWID?
:write: :SOUR:CURR:TRAN:BWID
;:updatemodechange:
:buttontext: Set
Seconds 0.000022 999.0

#cmdSetup number Positive_Slew Dyn_CC
:read: :SOUR:CURR:TRAN:SLEW:POS?
:write: :SOUR:CURR:TRAN:SLEW:POS
;:updatemodechange:
:buttontext: Set
A/us 0.0001 30

#cmdSetup number Negative_Slew Dyn_CC
:read: :SOUR:CURR:TRAN:SLEW:NEG?
:write: :SOUR:CURR:TRAN:SLEW:NEG
;:updatemodechange:
:buttontext: Set
A/us 0.0001 30




;*********************************************************
; Dynamic CV panel
;*********************************************************
;#cmdSetup info Dynamic_CV_Settings Dyn_CV
;:layout:

#cmdSetup comboboxHot Dynamic_Mode Dyn_CV
:read: :SOUR:VOLT:TRAN:MODE?
:write: :SOUR:VOLT:TRAN:MODE
;:updatemodechange:
Continuous CONTINUOUS
Pulse PULSE
Toggle TOGGLE

#cmdSetup radio Current_Range Dyn_CV
:read: :SOUR:VOLT:TRAN:IRANG?
:write: :SOUR:VOLT:TRAN:IRANG
;:updatemodechange:
5A 5
30A 30

#cmdSetup radio Voltage_Range Dyn_CV
:read: :SOUR:VOLT:TRAN:VRANG?
:write: :SOUR:VOLT:TRAN:VRANG
;:updatemodechange:
36V 36
150V 150

#cmdSetup number A_Level Dyn_CV
:read: :SOUR:VOLT:TRAN:ALEV?
:write: :SOUR:VOLT:TRAN:ALEV
;:updatemodechange:
:buttontext: Set
Volts 0.0000 150

#cmdSetup number B_Level Dyn_CV
:read: :SOUR:VOLT:TRAN:BLEV?
:write: :SOUR:VOLT:TRAN:BLEV
;:updatemodechange:
:buttontext: Set
Volts 0.0000 150

#cmdSetup number A_Width Dyn_CV
:read: :SOUR:VOLT:TRAN:AWID?
:write: :SOUR:VOLT:TRAN:AWID
;:updatemodechange:
:buttontext: Set
Seconds 1.0 999.0

#cmdSetup number B_Width Dyn_CV
:read: :SOUR:VOLT:TRAN:BWID?
:write: :SOUR:VOLT:TRAN:BWID
;:updatemodechange:
:buttontext: Set
Seconds 1.0 999.0




;*********************************************************
; Dynamic CR panel
;*********************************************************
;#cmdSetup info Dynamic_CR_Settings Dyn_CR
;:layout:

#cmdSetup comboboxHot Dynamic_Mode Dyn_CR
:read: :SOUR:RES:TRAN:MODE?
:write: :SOUR:RES:TRAN:MODE
;:updatemodechange:
Continuous CONTINUOUS
Pulse PULSE
Toggle TOGGLE


#cmdSetup radio Current_Range Dyn_CR
:read: :SOUR:RES:TRAN:IRANG?
:write: :SOUR:RES:TRAN:IRANG
;:updatemodechange:
5A 5
30A 30

#cmdSetup radio Voltage_Range Dyn_CR
:read: :SOUR:RES:TRAN:VRANG?
:write: :SOUR:RES:TRAN:VRANG
;:updatemodechange:
36V 36
150V 150

#cmdSetup number A_Level Dyn_CR
:read: :SOUR:RES:TRAN:ALEV?
:write: :SOUR:RES:TRAN:ALEV
;:updatemodechange:
:buttontext: Set
Ohms 0.03 10000

#cmdSetup number B_Level Dyn_CR
:read: :SOUR:RES:TRAN:BLEV?
:write: :SOUR:RES:TRAN:BLEV
;:updatemodechange:
:buttontext: Set
Ohms 0.03 10000

#cmdSetup number A_Width Dyn_CR
:read: :SOUR:RES:TRAN:AWID?
:write: :SOUR:RES:TRAN:AWID
;:updatemodechange:
:buttontext: Set
Seconds 0.001 999.0

#cmdSetup number B_Width Dyn_CR
:read: :SOUR:RES:TRAN:BWID?
:write: :SOUR:RES:TRAN:BWID
;:updatemodechange:
:buttontext: Set
Seconds 0.001 999.0




;*********************************************************
; Dynamic CP panel
;*********************************************************
;#cmdSetup info Dynamic_CP_Settings Dyn_CP
;:layout:

#cmdSetup comboboxHot Dynamic_Mode Dyn_CP
:read: :SOUR:POW:TRAN:MODE?
:write: :SOUR:POW:TRAN:MODE
;:updatemodechange:
Continuous CONTINUOUS
Pulse PULSE
Toggle TOGGLE

#cmdSetup radio Current_Range Dyn_CP
:read: :SOUR:POW:TRAN:IRANG?
:write: :SOUR:POW:TRAN:IRANG
;:updatemodechange:
5A 5
30A 30

#cmdSetup radio Voltage_Range Dyn_CP
:read: :SOUR:POW:TRAN:VRANG?
:write: :SOUR:POW:TRAN:VRANG
;:updatemodechange:
36V 36
150V 150

#cmdSetup number A_Level Dyn_CP
:read: :SOUR:POW:TRAN:ALEV?
:write: :SOUR:POW:TRAN:ALEV
;:updatemodechange:
:buttontext: Set
Watts 0.0000 MaxPower

#cmdSetup number B_Level Dyn_CP
:read: :SOUR:POW:TRAN:BLEV?
:write: :SOUR:POW:TRAN:BLEV
;:updatemodechange:
:buttontext: Set
Watts 0.0000 MaxPower

#cmdSetup number A_Width Dyn_CP
:read: :SOUR:POW:TRAN:AWID?
:write: :SOUR:POW:TRAN:AWID
;:updatemodechange:
:buttontext: Set
Seconds 0.000048 999.0

#cmdSetup number B_Width Dyn_CP
:read: :SOUR:POW:TRAN:BWID?
:write: :SOUR:POW:TRAN:BWID
;:updatemodechange:
:buttontext: Set
Seconds 0.000048 999.0




;*********************************************************
; LED panel
;*********************************************************
;#cmdSetup info LED_Mode_Settings LED
;:layout:

#cmdSetup radio Current_Range LED
:read: :SOUR:LED:IRANG?
:write: :SOUR:LED:IRANG
;:updatemodechange:
5A 5
30A 30

#cmdSetup radio Voltage_Range LED
:read: :SOUR:LED:VRANG?
:write: :SOUR:LED:VRANG
;:updatemodechange:
36V 36
150V 150

#cmdSetup number Vo_Setting LED
:read: :SOUR:LED:VOLT?
:write: :SOUR:LED:VOLT
;:updatemodechange:
:buttontext: Set
Volts 0.01 150

#cmdSetup number Io_Setting LED
:read: :SOUR:LED:CURR?
:write: :SOUR:LED:CURR
;:updatemodechange:
:buttontext: Set
Amps 0 MaxPower

#cmdSetup number Rco_Setting LED
:read: :SOUR:LED:RCO?
:write: :SOUR:LED:RCO
;:updatemodechange:
:buttontext: Set
_ 0.01 1.0




;*********************************************************
; Battery panel
;*********************************************************
;#cmdSetup info Battery_Mode_Settings Batt
;:layout:

#cmdSetup comboboxHot Discharge_Mode Batt
:read: :SOUR:BATT:MODE?
:write: :SOUR:BATT:MODE
:update: Discharge_Level
Current CURRENT
Power POWER
Resistance RESISTANCE

#cmdSetup radio Current_Range Batt
:read: :SOUR:BATT:IRANG?
:write: :SOUR:BATT:IRANG
5A 5
30A 30

#cmdSetup radio Voltage_Range Batt
:read: :SOUR:BATT:VRANG?
:write: :SOUR:BATT:VRANG
:update: Discharge_Level
36V 36
150V 150

; THIS DOESNT SEEM TO CONTROL ANYTHING - but is listed in the Remote SCPI Manual?
;#cmdSetup comboboxHot Resistance_Range Batt
;:read: :SOUR:BATT:RRANG?
;:write: :SOUR:BATT:RRANG
;:updatemodechange:
;Low LOW
;Middle MIDDLE
;High HIGH
;Upper UPPER

#cmdSetup number Discharge_Level Batt
:read: :SOUR:BATT:LEV?
:write: :SOUR:BATT:LEV
:tip: Field is used for Amps, Watts, and Ohms, recheck the value if you change the discharge mode.
:buttontext: Set
A/W/R 0.0 10000

#cmdSetup number Cutoff_Voltage Batt
:read: :SOUR:BATT:VOLT?
:write: :SOUR:BATT:VOLT
:buttontext: Set
Volts 0.0 150.0

#cmdSetup number Cutoff_Capacity Batt
:read: :SOUR:BATT:CAP?
:write: :SOUR:BATT:CAP
:buttontext: Set
mAh 0 999999

#cmdSetup number Cutoff_Time Batt
:read: :SOUR:BATT:TIM?
:write: :SOUR:BATT:TIM
:buttontext: Set
Seconds 0 999999

#cmdSetup radio Voltage_Cutoff Batt
:read: :SOUR:BATT:VOLT:STAT?
:write: :SOUR:BATT:VOLT:STAT
Off 0
On 1

#cmdSetup radio Capacity_Cutoff Batt
:read: :SOUR:BATT:CAP:STAT?
:write: :SOUR:BATT:CAP:STAT
Off 0
On 1

#cmdSetup radio Time_Cutoff Batt
:read: :SOUR:BATT:TIM:STAT?
:write: :SOUR:BATT:TIM:STAT
Off 0
On 1






;*********************************************************
; OCPT panel
;*********************************************************
;#cmdSetup info OCPT_Mode_Settings OCPT
;:layout:

#cmdSetup radio Current_Range OCPT
:read: :SOUR:OCP:IRANG?
:write: :SOUR:OCP:IRANG
5A 5
30A 30

#cmdSetup radio Voltage_Range OCPT
:read: :SOUR:OCP:VRANG?
:write: :SOUR:OCP:VRANG
:update: Protection_Voltage
36V 36
150V 150

#cmdSetup number Protection_Voltage OCPT
:read: :SOUR:OCP:VOLT?
:write: :SOUR:OCP:VOLT
Volts 0.0 150

#cmdSetup number Start_Current OCPT
:read: :SOUR:OCP:STAR?
:write: :SOUR:OCP:STAR
:buttontext: Set
Amps 0.0 30

#cmdSetup number Stop_Current OCPT
:read: :SOUR:OCP:END?
:write: :SOUR:OCP:END
:buttontext: Set
Amps 0.0 30

#cmdSetup number Steps OCPT
:read: :SOUR:OCP:STEP?
:write: :SOUR:OCP:STEP
:buttontext: Set
Amps 0.0 30

#cmdSetup number Step_Delay OCPT
:read: :SOUR:OCP:STEP:DEL?
:write: :SOUR:OCP:STEP:DEL
:buttontext: Set
Seconds 0.01 999

#cmdSetup number Min_Current OCPT
:read: :SOUR:OCP:MIN?
:write: :SOUR:OCP:MIN
:buttontext: Set
Amps 0.0 30

#cmdSetup number Max_Current OCPT
:read: :SOUR:OCP:MAX?
:write: :SOUR:OCP:MAX
:buttontext: Set
Amps 0.0 30






;*********************************************************
; OPPT panel
;*********************************************************
;#cmdSetup info OPPT_Mode_Settings OPPT
;:layout:

#cmdSetup radio Current_Range OPPT
:read: :SOUR:OPP:IRANG?
:write: :SOUR:OPP:IRANG
5A 5
30A 30

#cmdSetup radio Voltage_Range OPPT
:read: :SOUR:OPP:VRANG?
:write: :SOUR:OPP:VRANG
:update: Protection_Voltage
36V 36
150V 150

#cmdSetup number Protection_Voltage OPPT
:read: :SOUR:OPP:VOLT?
:write: :SOUR:OPP:VOLT
Volts 0.0 150

#cmdSetup number Start_Power OPPT
:read: :SOUR:OPP:STAR?
:write: :SOUR:OPP:STAR
:buttontext: Set
Watts 0.0 MaxPower

#cmdSetup number Stop_Power OPPT
:read: :SOUR:OPP:END?
:write: :SOUR:OPP:END
:buttontext: Set
Watts 0.0 MaxPower

#cmdSetup number Steps OPPT
:read: :SOUR:OPP:STEP?
:write: :SOUR:OPP:STEP
:buttontext: Set
Watts 0.0 MaxPower

#cmdSetup number Step_Delay OPPT
:read: :SOUR:OPP:STEP:DEL?
:write: :SOUR:OPP:STEP:DEL
:buttontext: Set
Seconds 0.01 999

#cmdSetup number Min_Power OPPT
:read: :SOUR:OPP:MIN?
:write: :SOUR:OPP:MIN
:buttontext: Set
Watts 0.0 MaxPower

#cmdSetup number Max_Power OPPT
:read: :SOUR:OPP:MAX?
:write: :SOUR:OPP:MAX
:buttontext: Set
Watts 0.0 MaxPower









;*********************************************************
; General window contents
;*********************************************************
;The first number is thickness of line, the second number is percentage of window width.
;The third value is: Solid, Dual, DashedShort, DashedLong, Raised, Sunken
#cmdSetup separator - 
2 99 Dual


#cmdSetup buttonsOn Load_Status
:read: :SOUR:INP:STAT?
:write: :SOUR:INP:STAT
:updatemodechange:
Off 0
On 1

#cmdSetup buttonsOn Short_Status
:read: :SOUR:SHOR:STAT?
:write: :SOUR:SHOR:STAT
:updatemodechange:
Off 0
On 1



;*********************************************************
; Active Modes - needs improving as the SDL does not use
; a unique mode flag for the actual mod it is currently in
; it has different mode systems all in parallel !
; :SOUR:FUNC - Constant modes - CC,CV,CR,CP,LED
; :SOUR:FUNC:TRAN - Dynamic modes - CC,CV,CR,CP
; :SOUR:BATT:FUNC - Battery mode
; :SOUR:OCP:FUNC - Over Current Protection Test mode
; :SOUR:OPP:FUNC - Over Power Protection Test mode
;*********************************************************


