;-----------------------------------------------------------------------------
; ET5410A+ Electronic Load
;
; Revision 1.0   3 Jun 2022      Inital release
;          1.1   7 Jul 2022      Fixed USB connection problem
;          1.2  31 Dec 2022      Support currect device ID for newer Firmware 
;
; Remarks:
;  - SCPI modifications to optimize the poor USB device I/O performance
;  - GUI adaptions, change selector to optimize I/O performance
;  - add channel on/off/state button
;  - add trigger button
;  - add #interface definitons
;  - add energy readout
;
; FIRMWARE BUGS (V1.02 V1.00.2213.012 V1.00.2213.01):
;  - *idn? command not supported, *IDN? parameters reversed without comma seperator
;  - RESI:BCR (now RESI2:BCR) and VOLT:BCR (now VOLT2:BCR?) are not supported
;  - LIST:PARA does not accept indices beyound 5 (page 1 only)
;  - SYST:LOCA seems not to have any effect
;  - No flow control: do not send command while previouse command is beeing processed.
;  - RS232 baudrate seems to be limited to 14400 bps
;  - The SCPI commands have to be spaced (300 ms for writes, 150 ms for reads).
;  - The FW seems not to be interrupt driven and therefor the command response time varies
;    depending on the mode. If the qualify mode is turned on and you display
;    the current values or the logging table, you can hear that the buzzer frequency lowers due
;    to system load when polling measurement data (!).
;
; Driver (not yet implemented functions):
;  - QUAL:OUT?
;  - SELF:FAN? 
;  - SYSSet:STARt, COMM:BAUD 
;  - FILE:*
;
;-----------------------------------------------------------------------------

#author PL (based on ET5410 driver released by jmurray@jmaudio.com.au)


;------------------------------------------------------------
; Devices
;------------------------------------------------------------

; Buggy FW which response with ET5420
#metadef
#idString ET5420
#name     East Tester ET5410A+
#handle   ET5410A
#port     com

#metadef
#idString ET5410A+
#name     East Tester ET5410A+
#handle   ET5410A
#port     com

#meta
#idString ET5410A+
#name     East Tester ET5410A+
#handle   ET5410A
#port     com

#driver   SCPIx


;------------------------------------------------------------------------------------
; Emulation Layer
;------------------------------------------------------------------------------------

; End of Line
#eol \n |.\n

; *IDN? returns: <model>,<SN>,<software>,<NL>
;  <ET5410 01234567890 V1.12.1234.123 V1.12.1234.123>
;   ET5420 V1.02 V1.00.2213.012 V1.00.2213.012
; BUGFIX: *idn? by adding commas and swapping serial number and version
#scpiCmd *idn? *IDN?
:readmath: var v=split(value," ");v[0]+","+v[2]+","+v[1]+","+v[3];

; BUGFIX: fimrware does not support the RESI:BCR command
#scpiCmd RESI:BCR? RESI2:BCR?
#scpiCmd RESI:BCR RESI2:BCR (value)

; BUGFIX: fimrware does not support the VOLT:BCR command
#scpiCmd VOLT:BCR? VOLT2:BCR?
#scpiCmd VOLT:BCR VOLT2:BCR (value)

; Internal: used to display more than one list page
#scpiCmd LIST:SHOW none
:setvar: listshow=inputValue
#scpiCmd LIST:SHOW? none?
:readmath: varExists("listshow")?(listshow):(0)

#scpiCmd LIST:ENTRY? LIST:PARA? (listshow+value),(listshow+value)

; Internal: delay load of qualify parameters
#scpiCmd QUAL:SHOW none
:setvar: qualshow=inputValue
#scpiCmd QUAL:SHOW? none?
:readmath: varExists("qualshow")?(qualshow):(0)

; Internal: delay load of load parameters
#scpiCmd LOAD:SHOW none
:setvar: loadshow=inputValue
#scpiCmd LOAD:SHOW? none?
:readmath: varExists("loadshow")?(loadshow):(0)


;------------------------------------------------------------
; Low-Level Interface
;------------------------------------------------------------

; Data type definitions
; A list of possible column name with unit and formatter (SI, Time, Int, D0..D6)

#value Current A D3
#value Voltage V D3
#value Power W D2
#value Resistance Ω D3
#value Capacity Ah D3
#value Energy Wh D3

; Basic communication
; 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 (single line command)
#askValues MEAS:ALL?;[200];BATT:CAPA?;[200];BATT:ENER?;[200]
#askValuesMathFormat trim(replace(replace(value,"R",""),"  "," "))

; 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


; String to ask about actual meter mode, it is mostly used for DMM's (single line command)
#askMode CH:MODE?;[200]

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

; Switch meter to this mode during start, leave empty to avoid any switching
#initialMode


; Initial commands to meter when establishing connection, used to disable local control
;#initCmd SYST:PC;[200]
#initCmd LIST:SHOW 0;QUAL:SHOW 0;LOAD:SHOW 0

; Used to turn output off for power supplies, generators and electronic loads
#outputOff CH:SW OFF;[200]

; Final command to meter before breaking connection, used to restore local control
#finalCmd CH:SW OFF;[200];SYST:LOCA


;------------------------------------------------------------
; Interface
;------------------------------------------------------------

#interfaceType Load

; Set
#interface setOn          CH:SW (getElement("OFF ON",value));[300]
#interface setMode        CH:MODE (value);[200]
#interface setRemoteSense LOAD:SENSE (getElement("OFF ON",value));[300]
#interface setVoltage     VOLT:CV (value);[300]
#interface setCurrent     CURR:CC (value);[300]
#interface setPower       POWE:CP (value);[300]
#interface setResistance  RESI:CR (value);[300]
#interface setMaxCurrent  CURR:IMAX (value);[300]
#interface setMaxVoltage  VOLT:VMAX (value);[300]
#interface setMaxPower    POWE:PMAX (value);[300]

; Get
#interface getOn          CH:SW?;[200]
:readmath: (replace(replace(value,"ON","1"),"OFF","0"))
#interface getMode        CH:MODE?;[200]
:string:
#interface getRemoteSense LOAD:SENSE?
:readmath: (replace(replace(value,"ON","1"),"OFF","0"))
#interface getVoltage     VOLT:CV?;[200]
:readmath: trim(replace(value,"R",""))
#interface getCurrent     CURR:CC?;[200]
:readmath: trim(replace(value,"R",""))
#interface getPower       POWE:CP?;[200]
:readmath: trim(replace(value,"R",""))
#interface getResistance  RESI:CR?;[200]
:readmath: trim(replace(value,"R",""))
#interface getMaxCurrent  CURR:IMAX?;[200]
:readmath: trim(replace(value,"R",""))
#interface getMaxVoltage  VOLT:VMAX?;[200]
:readmath: trim(replace(value,"R",""))
#interface getMaxPower    POWE:PMAX?;[200] 
:readmath: trim(replace(value,"R",""))

; Read
#interface readCurrent    0
#interface readVoltage    1
#interface readPower      2
#interface readResistance 3
#interface readCapacity   4
#interface readEnergy     5


;------------------------------------------------------------------------------------
; Mode
;------------------------------------------------------------------------------------

; REMOVED: created timing problems and slow GUI


;------------------------------------------------------------------------------------
; Channel
;------------------------------------------------------------------------------------

#cmdSetup comboboxhot Mode Channel
:write: CH1:MODE #;[300]
:read: CH1:MODE?;[300];
Constant_Current_(CC)               CC
Constant_Voltage_(CV)               CV
Constant_Power_(CP)                 CP
Constant_Resistance_(CR)            CR
Constant_Current/Voltage_(CC+CV)    CCCV
Constant_Resistance/Voltage_(CR+CV) CRCV
Short_Test                          SHOR
LED_Test                            LED
Transient_Test                      TRAN
Battery_Test                        BATT
Scan_Test                           SCAN
List_Test                           LIST
:update: Select Input_

#cmdSetup selector Select Channel
:read: CH:MODE?;[200]
:string:
CC   CC_.   TIME_. LIMIT_. 
CV   CV_.   TIME_. LIMIT_.
CP   CP_.   TIME_. LIMIT_.
CR   CR_.   TIME_. LIMIT_.
CCCV CCCV_. LIMIT_.
CRCV CRCV_. LIMIT_.
SHOR SHOR_. LIMIT_.
LED  LED_.
TRAN TRAN_.
LIST LIST_.
SCAN SCAN_.
BATT BATT_.


;------------------------------------------------------------------------------------
; Settings
;------------------------------------------------------------------------------------

#cmdSetup Info Load Settings

#cmdSetup separator - Settings
2 100 Solid

#cmdSetup radio Range_I Settings
:read:    LOAD:CRANge?;[200]
:write:   LOAD:CRANge #;[350];CURR:IMAX (value=="HIGH"?42:3.1);[350];
:update:  Imax Set_I Set_Io Set_I1 Set_I2
:string:
:tip: Set the range of current
3_A  LOW
42_A HIGH

#cmdSetup radio Range_V Settings
:read:    LOAD:VRANge?;[200]
:write:   LOAD:VRANge #;[350];VOLT:VMAX (value=="HIGH"?155:21.0);[350];
:update:  Vmax Set_V Set_Vo Set_V1 Set_V2 Vcutoff Vmin Vth
:string:
:tip: Set the voltage range
21_V   LOW
155_V HIGH


#cmdSetup selector SelectLoad Settings
:read: LOAD:SHOW?
0 Settings_Button.
1 Settings_Edit.

#cmdSetup button More Settings_Button
:write:   LOAD:SHOW 1
:update:  SelectLoad

#cmdSetup radio Sense Settings_Edit
:read:    LOAD:SENSE?;[200]
:write:   LOAD:SENSE #;[300]
:string:
:tip: Set the range of current
Off OFF
On  ON

#cmdSetup number Von Settings_Edit
:read:    VOLT:ON?;[200]
:readmath: trim(replace(value,"R",""))
:write:   VOLT:ON #;[300]
:tip: Set turn-on voltage
V 0 155

#cmdSetup number Voff Settings_Edit
:read:    VOLT:OFF?;[200]
:readmath: trim(replace(value,"R",""))
:write:   VOLT:OFF #;[300]
:tip: Set turn-off voltage
V 0 155

#cmdSetup comboboxhot Trigger_ Settings_Edit
:read:    LOAD:TRIGger?;[200]
:write:   LOAD:TRIGger #;[400]
:tip: Set the trigger mode of the trigger source
Manual   MAN
External EXT
Software TRG

#cmdSetup button Trigger Settings_Edit
:enable:  Settings_Edit.Trigger_=="TRG"
:write:   *TRG


;------------------------------------------------------------------------------------
; Qualify
;------------------------------------------------------------------------------------

#cmdSetup selector SelectQualify Qualify
:read: QUAL:SHOW?
0 Qualify.
1 Qualify_Edit.

#cmdSetup button More Qualify
:write:   QUAL:SHOW 1
:update:  SelectQualify

#cmdSetup radio Test Qualify_Edit
:read:    QUAL:TEST?;[200]
:write:   QUAL:TEST #;[350]
:string:
Off OFF
On  ON


#cmdSetup separator - Qualify_Edit
2 100 Solid

#cmdSetup number Imax Qualify_Edit
:read:    QUAL:CHIGh?;[200]
:readmath: replace(getElement(value,0),"R","")
:write:   QUAL:CHIGh #;[300]
A 0 42

#cmdSetup number Imin Qualify_Edit
:read:    QUAL:CLOW?;[200]
:readmath: replace(getElement(value,0),"R","")
:write:   QUAL:CLOW #;[300]
A 0 42


#cmdSetup separator - Qualify_Edit
1 100 Empty

#cmdSetup number Vmax Qualify_Edit
:read:    QUAL:VHIGh?;[200]
:readmath: replace(getElement(value,0),"R","")
:write:   QUAL:VHIGh #;[300];
V 0.1 150

#cmdSetup number Vmin Qualify_Edit
:read:    QUAL:VLOW?;[200]
:readmath: replace(getElement(value,0),"R","")
:write:   QUAL:VLOW #;[300]
V 0.1 150


#cmdSetup separator - Qualify_Edit
1 100 Empty

#cmdSetup number Pmax Qualify_Edit
:read:    QUAL:PHIGh?;[200]
:readmath: replace(getElement(value,0),"R","")
:write:   QUAL:PHIGh #;[300]
W 0 400

#cmdSetup number Pmin Qualify_Edit
:read:    QUAL:PLOW?;[200]
:readmath: replace(getElement(value,0),"R","")
:write:   QUAL:PLOW #;[300]
W 0 400


;------------------------------------------------------------------------------------
; CC
;------------------------------------------------------------------------------------

#cmdSetup info CC CC_
:read:    LOAD:ABNO?;[200]
:readmath: trim(replace(value,"NONE",""))

#cmdSetup separator - CC_
2 100 Solid

#cmdSetup number Set_I CC_
:read:    CURR:CC?;[200]
:readmath: trim(replace(value,"R",""))
:write:   CURR:CC #;[300];
:tip: Set CC mode current value
A 0 40


;------------------------------------------------------------------------------------
; CV
;------------------------------------------------------------------------------------

#cmdSetup info CV CV_
:read:    LOAD:ABNO?;[200]
:readmath: trim(replace(value,"NONE",""))

#cmdSetup separator - CV_
2 100 Solid


#cmdSetup number Set_V CV_
:read:    VOLT:CV?;[200]
:readmath: trim(replace(value,"R",""))
:write:   VOLT:CV #;[300];
:tip: Set the voltage value of CV mode
V 0 150


;------------------------------------------------------------------------------------
; CP
;------------------------------------------------------------------------------------

#cmdSetup info CP CP_
:read:    LOAD:ABNO?;[200]
:readmath: trim(replace(value,"NONE",""))

#cmdSetup separator - CP_
2 100 Solid

#cmdSetup number Set_P CP_
:read:    POWE:CP?;[200]
:readmath: trim(replace(value,"R",""))
:write:   POWE:CP #;[300];
:tip: Set CP mode power value
W 0 400

;------------------------------------------------------------------------------------
; CR
;------------------------------------------------------------------------------------

#cmdSetup info CR CR_
:read:    LOAD:ABNO?;[200]
:readmath: trim(replace(value,"NONE",""))

#cmdSetup separator - CR_
2 100 Solid


#cmdSetup number Set_R CR_
:read:    RESI:CR?;[200]
:readmath: trim(replace(value,"R",""))
:write:   RESI:CR #;[300];
:tip: Set the resistance value of CR mode
Ω 1 5000


;------------------------------------------------------------------------------------
; CC-CV
;------------------------------------------------------------------------------------

#cmdSetup info CC+CV CCCV_
:read:    LOAD:ABNO?;[200]
:readmath: trim(replace(value,"NONE",""))

#cmdSetup separator - CCCV_
2 100 Solid


#cmdSetup number Set_I CCCV_
:read:    CURR:CCCV?;[200]
:readmath: trim(replace(value,"R",""))
:write:   CURR:CCCV #;[300]
:tip: Set CC mode current value
A 0 40

#cmdSetup number Set_V CCCV_
:read:    VOLT:CCCV?;[200]
:readmath: trim(replace(value,"R",""))
:write:   VOLT:CCCV #;[300];
:tip: Set the voltage value of CV mode
V 0 150


;------------------------------------------------------------------------------------
; CR-CV
;------------------------------------------------------------------------------------

#cmdSetup info CR+CV CRCV_
:read:    LOAD:ABNO?;[200]
:readmath: trim(replace(value,"NONE",""))

#cmdSetup separator - CRCV_
2 100 Solid


#cmdSetup number Set_R CRCV_
:read:    RESI:CRCV?;[200]
:readmath: trim(replace(value,"R",""))
:write:   RESI:CRCV #;[300]
:tip: Set the resistance value of CR mode
Ω 1 5000

#cmdSetup number Set_V CRCV_
:read:    VOLT:CRCV?;[200]
:readmath: trim(replace(value,"R",""))
:write:   VOLT:CRCV #;[300]
:tip: Set the voltage value of CV mode
V 0 150


;------------------------------------------------------------------------------------
; SHORT
;------------------------------------------------------------------------------------

#cmdSetup info Short SHOR_
:read:    LOAD:ABNO?;[200]
:readmath: trim(replace(value,"NONE",""))

#cmdSetup separator - SHOR_
2 100 Solid


#cmdSetup Info N/A SHOR_


;------------------------------------------------------------------------------------
; LED
;------------------------------------------------------------------------------------

#cmdSetup info LED LED_
:read:    LOAD:ABNO?;[200]
:readmath: trim(replace(value,"NONE",""))

#cmdSetup separator - LED_
2 100 Solid


#cmdSetup number Set_Vo LED_
:read:    VOLT:LED?;[200]
:readmath: trim(replace(value,"R",""))
:write:   VOLT:LED #;[300];
:tip: Steady working voltage of LED constant current source with LED lamp
V 0 150

#cmdSetup number Set_Io LED_
:read:    CURR:LED?;[200]
:readmath: trim(replace(value,"R",""))
:write:   CURR:LED #;[300]
:tip: Output current of LED constant current source
A 0 40

#cmdSetup number Set_Coeff LED_
:read:    LED:COEFf?;[200]
:readmath: trim(replace(value,"R",""))
:write:   LED:COEFf #;[300];
:tip: Ratio of Rd voltage to the total voltage: Rd =(Vo/Io)*Coeff; V=Vo*(1-Coeff)
_ 0.001 1.000


;------------------------------------------------------------------------------------
; TRAN
;------------------------------------------------------------------------------------

#cmdSetup info Transient TRAN_
:read:    LOAD:ABNO?;[200]
:readmath: trim(replace(value,"NONE",""))

#cmdSetup separator - TRAN_
2 100 Solid


#cmdSetup comboboxhot Type TRAN_
:read:    TRAN:STATe?;[200]
:readmath: trim(value)
:write:   TRAN:STATe #;[300]
:tip: Set the dynamic state of dynamic test
:string:
:update: TRAN_Select
CC CC
CV CV

#cmdSetup comboboxhot Mode TRAN_
:read:    TRAN:MODE?;[200]
:write:   TRAN:MODE #;[300];
:tip: Set dynamic test dynamic mode
Continuous COUT
Trigger    TRIG
Pulse      PULS
; Pulse Width only enabled when: && TRAN_.Mode!="TRIG"


#cmdSetup selector TRAN_Select TRAN_
:read: TRAN:STATe?;[200]
CC TRAN_CC_.
CV TRAN_CV_.

#cmdSetup multi Set_I1 TRAN_CC_
:read:    CURR:TA?;[200];TIME:WA?;[200]
:readmath: replace(getElement(value,0),"R","")+" "+(replace(getElement(value,1),"R","")/1000.0)
:write:   CURR:TA #;[200];TIME:WA #;[350];
:tip: Set the dynamic test A value
Number I A 0 40
Number T s 0 60

#cmdSetup multi Set_I2 TRAN_CC_
:read:    CURR:TB?;[200];TIME:WB?;[200]
:readmath: replace(getElement(value,0),"R","")+" "+(replace(getElement(value,1),"R","")/1000.0)
:write:   CURR:TB #;[200];TIME:WB #;[350];
:tip: Set the dynamic test B value
Number I A 0 40
Number T s 0 60

#cmdSetup multi Set_V1 TRAN_CV_
:read:    VOLT:TA?;[200];TIME:WA?;[200]
:readmath: replace(getElement(value,0),"R","")+" "+(replace(getElement(value,1),"R","")/1000.0)
:write:   VOLT:TA #;[200];TIME:WA #;[350];
:tip: Set the dynamic test A value
Number V V 0.1 150
Number T s 0 60

#cmdSetup multi Set_V2 TRAN_CV_
:read:    VOLT:TB?;[200];TIME:WB?;[200]
:readmath: replace(getElement(value,0),"R","")+" "+(replace(getElement(value,1),"R","")/1000.0)
:write:   VOLT:TB #;[200];TIME:WB #;[350];
:tip: Set the dynamic test B value
Number V V 0.1 150
Number T s 0 60


;------------------------------------------------------------------------------------
; SCAN
;------------------------------------------------------------------------------------

#cmdSetup info Scan SCAN_
:read:    LOAD:ABNO?;[200]
:readmath: trim(replace(value,"NONE",""))

#cmdSetup separator - SCAN_
2 100 Solid


#cmdSetup comboboxhot Type SCAN_
:read:    SCAN:TYPE?;[200]
:write:   SCAN:TYPE #;[350]
:string:
:update:  SCAN_SelectType
:tip: Set scan type of scan test
CC_-_Vary_current CC
CV_-_Vary_voltage CV
CP_-_Vary_power   CP

#cmdSetup selector SCAN_SelectType SCAN_
:read: SCAN:TYPE?;[200]
CC SCAN_CC_.
CV SCAN_CV_.
CP SCAN_CP_.

#cmdSetup multi Set_I SCAN_CC_
:read:    CURR:STARt?;[200];CURR:END?;[200];CURR:STEP?;[200]
:readmath: trim(replace(value,"R",""))
:write:   CURR:STARt #;[200];CURR:END #;[200];CURR:STEP #;[350];
:tip: Set the scan test current values
Number Start A 0 40
Number End A 0 40
Number Step A 0 40

#cmdSetup multi Set_V SCAN_CV_
:read:    VOLT:STARt?;[200];VOLT:END?;[200];VOLT:STEP?;[200]
:readmath: trim(replace(value,"R",""))
:write:   VOLT:STARt #;[200];VOLT:END #;[200];VOLT:STEP #;[350];
:tip: Set voltage values of scanning test
Number Start V 0.1 150
Number End V 0.1 150
Number Step V 0.1 150

#cmdSetup multi Set_P SCAN_CP_
:read:    POWE:STARt?;[200];POWE:END?;[200];POWE:STEP?;[200]
:readmath: trim(replace(value,"R",""))
:write:   POWE:STARt #;[200];POWE:END #;[200];POWE:STEP #;[350];
:tip: Set the power value of scanning test
Number Start W 0 400
Number End W 0 400
Number Step W 0 400

#cmdSetup numberInt Time SCAN_
:read:    TIME:STEP?;[200]
:readmath: trim(replace(value,"R",""))
:write:   TIME:STEP #;[300];
:tip: Set the scan test step delay value
s 0 9999


#cmdSetup separator - SCAN_
1 100 Empty

#cmdSetup comboboxhot Capture SCAN_
:read:    SCAN:THTYpe?;[200]
:write:   SCAN:THTYpe #;[350]
:string:
:update:  SCAN_SelectCapture
:tip: Set the threshold type of the scan test
DROP_-_Voltage_drops_sharply_close_to_0       DROP
Vth_-_Voltage_is_higher_than_treshold_setting VTH
Vmin_-_Voltage_is_lower_than_capture_setting  VMIN

#cmdSetup selector SCAN_SelectCapture SCAN_
:read: SCAN:THTYpe?;[200]
DROP SCAN_DROP_.
VTH  SCAN_Vth_.
VMIN SCAN_Vmin_.

#cmdSetup info N/A SCAN_DROP_

#cmdSetup number Vth SCAN_Vth_
:read:    VOLT:VTH?;[200]
:readmath: trim(replace(value,"R",""))
:write:   VOLT:VTH #;[300];
:tip: Set the threshold of scan test voltage transition
V 0.1 150

#cmdSetup number Vmin SCAN_Vmin_
:read:    VOLT:VMIN?;[200]
:readmath: trim(replace(value,"R",""))
:write:   VOLT:VMIN #;[300];
:tip: Set the minimum voltage threshold for scanning test
V 0.1 150


#cmdSetup separator - SCAN_
1 100 Empty

#cmdSetup Info Limit SCAN_

#cmdSetup separator - SCAN_
2 100 Solid

#cmdSetup comboboxhot Compare SCAN_
:read:    SCAN:COMPare?;[200]
:write:   SCAN:COMPare #;[350]
:string:
:update:  SCAN_SelectCompare
:tip: Sets the comparison type of the scan test to query the comparison type of the scan test
Off(*)                     SCAN
Ic_-_Current_within_limits INCURR
Vc_-_Voltage_within_limits INVOLT
Pc_-_Power_within_limits   INPOW
;OFF -> SCAN (but cannot be written again, VMIN did not work)

#cmdSetup selector SCAN_SelectCompare SCAN_
:read: SCAN:COMPare?;[200]
SCAN   SCAN_OFF_.
INCURR SCAN_Ic_.
INVOLT SCAN_Vc_.
INPOW  SCAN_Pc_.

#cmdSetup info N/A SCAN_OFF_

#cmdSetup multi Ic SCAN_Ic_
:read:     CURR:LOW?;[200];CURR:HIGH?;[200]
:readmath: trim(replace(value,"R",""))
:write:    CURR:LOW #;[200];CURR:HIGH #;[350];
:tip: Set the scan test current limit
Number Low A 0 42
Number High A 0 42

#cmdSetup multi Vc SCAN_Vc_
:read:    VOLT:LOW?;[200];VOLT:HIGH?;[200]
:readmath: trim(replace(value,"R",""))
:write:   VOLT:LOW #;[200];VOLT:HIGH #;[350];
:tip: Set the scan test voltage limit
Number Low V 0.1 150
Number High V 0.1 150

#cmdSetup multi Pc SCAN_Pc_
:read:    POWE:LOW?;[200];POWE:HIGH?;[200]
:readmath: trim(replace(value,"R",""))
:write:   POWE:LOW #;[200];POWE:HIGH #;[350];
:tip: Set the scan test power limit
Number Low W 0 400
Number High W 0 400


;------------------------------------------------------------------------------------
; LIST
;------------------------------------------------------------------------------------

#cmdSetup info List LIST_

#cmdSetup info List LIST_
:read:    LOAD:ABNO?;[200]
:readmath: trim(replace(value,"NONE",""))

#cmdSetup separator - LIST_
2 100 Solid


#cmdSetup comboboxhot Type LIST_
:read:    LIST:MODE?;[200]
:write:   LIST:MODE #;[300]
:string:
Auto    AUTO
Trigger TRIGGER

#cmdSetup comboboxhot Loop LIST_
:read:    LIST:LOOP?;[200]
:write:   LIST:LOOP #;[300]
:string:
On  ON
Off OFF

#cmdSetup numberInt Entries LIST_
:read:    LIST:NUM?;[200]
:readmath: trim(replace(value,"R",""))
:write:   LIST:NUM #;[300]
:textwidth: 6
_ 1 50

#cmdSetup separator - LIST_
1 100 Empty

#cmdSetup comboboxhot List LIST_
:read:    LIST:SHOW?
:write:   LIST:SHOW #
:string:
1-5 0
6-9 1
10-14  10
15-19  15
20-24  20
25-29  25
30-34  30
35-39  35
40-44  40
45-49  45

#cmdSetup separator - LIST_
:color:  (160,197,233)
2 100 Solid

#cmdSetup multi _ LIST_
:read:    LIST:ENTRY? 1;[200]
:readmath: trim(replace(replace(value,"R",""),"------","0"))
:write:   LIST:PARA #,#,#,#,#,#,#;[300]
:string:
:textwidth: 6
info _
Combobox CC 0 CV 1 CP 2 CR 3 Open 4 Short 5
Number _ _ 0 7000
Number T s 0 60k
Combobox -- 0 I 1 V 2 P 3 R 4
Number Max _ 0 7000
Number Min _ 0 7000

#cmdSetup multi _ LIST_
:read:    LIST:ENTRY? 2;[200]
:readmath: trim(replace(replace(value,"R",""),"------","0"))
:write:   LIST:PARA #,#,#,#,#,#,#;[300]
:string:
:textwidth: 6
info _
Combobox CC 0 CV 1 CP 2 CR 3 Open 4 Short 5
Number _ _ 0 7000
Number T s 0 60k
Combobox -- 0 I 1 V 2 P 3 R 4
Number Max _ 0 7000
Number Min _ 0 7000

#cmdSetup multi _ LIST_
:read:    LIST:ENTRY? 3;[200]
:readmath: trim(replace(replace(value,"R",""),"------","0"))
:write:   LIST:PARA #,#,#,#,#,#,#;[300]
:string:
:textwidth: 6
info _
Combobox CC 0 CV 1 CP 2 CR 3 Open 4 Short 5
Number _ _ 0 7000
Number T s 0 60k
Combobox -- 0 I 1 V 2 P 3 R 4
Number Max _ 0 7000
Number Min _ 0 7000

#cmdSetup multi _ LIST_
:read:    LIST:ENTRY? 4;[200]
:readmath: trim(replace(replace(value,"R",""),"------","0"))
:write:   LIST:PARA #,#,#,#,#,#,#;[300]
:string:
:textwidth: 6
info _
Combobox CC 0 CV 1 CP 2 CR 3 Open 4 Short 5
Number _ _ 0 7000
Number T s 0 60k
Combobox -- 0 I 1 V 2 P 3 R 4
Number Max _ 0 7000
Number Min _ 0 7000

#cmdSetup multi _ LIST_
:read:    LIST:ENTRY? 5;[200]
:readmath: trim(replace(replace(value,"R",""),"------","0"))
:write:   LIST:PARA #,#,#,#,#,#,#;[300]
:string:
:textwidth: 6
info _
Combobox CC 0 CV 1 CP 2 CR 3 Open 4 Short 5
Number _ _ 0 7000
Number T s 0 60k
Combobox -- 0 I 1 V 2 P 3 R 4
Number Max _ 0 7000
Number Min _ 0 7000


;------------------------------------------------------------------------------------
; BATT
;------------------------------------------------------------------------------------

#cmdSetup info Battery BATT_
:read:    LOAD:ABNO?;[200]
:readmath: trim(replace(value,"NONE",""))

#cmdSetup separator - BATT_
2 100 Solid


#cmdSetup comboboxhot Type BATT_
:read:    BATT:MODE?;[200]
:write:   BATT:MODE #;[200];CH:MODE BATT;[350]
:tip: Set the Type mode of the battery test
:string:
:update: BATT_Select
CR CR
CC CC


#cmdSetup selector BATT_Select BATT_
:read: BATT:MODE?;[200]
CR BATT_CR_.
CC BATT_CC_.

#cmdSetup multi Set_R BATT_CR_
:read:    RESI:BCR?;[200];VOLT:BCR?;[200]
:readmath: trim(replace(value,"R",""))
:write:   RESI:BCR #;[200];VOLT:BCR #;[350]
:tip: Set the constant resistance cut-off voltage value of battery test mode
Number R Ω 0 4000
Number V V 0 150

#cmdSetup multi Set_I BATT_CC_
:read:    CURR:BCC1?;[200];CURR:BCC2?;[200];CURR:BCC3?;[200]
:readmath: trim(replace(value,"R",""))
:write:   CURR:BCC1 #;[200];CURR:BCC2 #;[200];CURR:BCC3 #;[350]
:tip: Set the constant current current value
Number 1 I 0 40
Number 2 I 0 40
Number 3 I 0 40

#cmdSetup multi Vcutoff BATT_CC_
:read:    VOLT:BCC1?;[200];VOLT:BCC2?;[200];VOLT:BCC3?;[200]
:readmath: trim(replace(value,"R",""))
:write:   VOLT:BCC1 #;[200];VOLT:BCC2 #;[200];VOLT:BCC3 #;[350]
:tip: Set the constant current cut-off voltage value
Number 1 V 0 150
Number 2 V 0 150
Number 3 V 0 150


;------------------------------------------------------------------------------------
; TIME (CC, CV, CP, CR)
;------------------------------------------------------------------------------------

#cmdSetup numberInt Time TIME_
:read:    TIME:OFFDelay?;[200]
:readmath: trim(replace(value,"R",""))
:write:   TIME:OFFDelay #;[300];
:tip: Set the delay shutdown time to query the current delay shutdown time value
s 0 60000


;------------------------------------------------------------------------------------
; LIMIT (CC, CV, CP, CR, CC+CV, CR+CV)
;------------------------------------------------------------------------------------

#cmdSetup separator - LIMIT_
1 100 Empty

#cmdSetup Info Limit LIMIT_

#cmdSetup separator - LIMIT_
2 100 Solid

#cmdSetup number Imax LIMIT_
:read:    CURR:IMAX?;[200]
:readmath: trim(replace(value,"R",""))
:write:   CURR:IMAX #;[300]
:tip: Set protection value
A 0 42

#cmdSetup number Vmax LIMIT_
:read:    VOLT:VMAX?;[200]
:readmath: trim(replace(value,"R",""))
:write:   VOLT:VMAX #;[300]
:tip: Set protection value
V 0.1 155

#cmdSetup number Pmax LIMIT_
:read:    POWE:PMAX?;[200]
:readmath: trim(replace(value,"R",""))
:write:   POWE:PMAX #;[300]
:tip: Set protection value
W 0 420


;------------------------------------------------------------------------------------
; Global
;------------------------------------------------------------------------------------

#cmdSetup buttonsOn Input_
:read:    CH:SW?;[200]
:write:   CH:SW (value);[300]
:color:   (235,50,50)
:string:
:updatealloff:
Off OFF
On  ON

;NOTE: the device is too slow for live updates
;#cmdSetup Updater update
;:update:  Input_
;1.0


;------------------------------------------------------------------------------------
; Other
;------------------------------------------------------------------------------------

#otherList

#otherImage

#otherData


;------------------------------------------------------------------------------------
; Help
;------------------------------------------------------------------------------------

#notes 
 FIRMWARE BUGS (V1.02 V1.00.2213.012 V1.00.2213.01):
  - The device identifies itself as an ET5420.
  - *idn? command not supported, *IDN? parameters reversed without comma seperator
  - RESI:BCR (now RESI2:BCR) and VOLT:BCR (now VOLT2:BCR?) are not supported
  - LIST:PARA does not accept indices beyound 5 (page 1 only)
  - SYST:LOCA seems not to have any effect
  - No flow control: do not send command while previouse command is beeing processed.
  - RS232 baudrate seems to be limited to 14400 bps
  - The SCPI commands have to be spaced (300 ms for writes, 150 ms for reads).
  - The FW seems not to be interrupt driven and therefor the command response time varies
    depending on the mode. If the qualify mode is turned on and you display
    the current values or the logging table, you can hear that the buzzer frequency lowers due
    to system load when polling measurement data (!).

 Devices with newer firmware exist. Not all bugs listed above may apply.

 Driver (not yet implemented functions):
  - QUAL:OUT?
  - SELF:FAN? 
  - SYSSet:STARt, COMM:BAUD 
  - FILE:*

#helpurl


;------------------------------------------------------------------------------------
; Debug
;------------------------------------------------------------------------------------

;#DEBUG ET5410A  +modeComm +valueComm +otherComm +commHex

