Jump to content

Gui buttons slow with mouse


weirddave
 Share

Recommended Posts

I have created a Gui with a number of GUICtrlCreateButton()

When I click on them with the mouse, the response by my script is very slow (1-2 secs), but if I navigate the buttons using the arrow keys and activate them with the Enter key, the response is fairly instant. Has anyone else seen this, and perhaps solved it?

Dave

Link to comment
Share on other sites

  • Moderators

weirddave,

Perhaps posting your script so we can test it might be good idea. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I can, but it's not going to be easy for anyone to run it as it is pulling in data over USB. it also relies on some ini files.

Global $GUIHandle = 0
Global $GUI2Handle = 0
Global $bb = 1
Global $repeats = 0
Global $Do
HotKeySet("{ESC}", "_ExitLoop")
Global $hDll_ntdll = DllOpen("ntdll.dll")
Dim $bitarray[8]=[1,2,4,8,16,32,64,128]
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <ColorConstants.au3>
#include <ButtonConstants.au3>
#include <Math.au3>
#include <Timers.au3>
#include <FTD2XX.dll_UDF.au3>

$IniFile = @ScriptDir&"\FPGA_Comms.ini"
$Combined =  Number(IniRead ($IniFile,"Settings","Combined",1))
$IniArray = IniReadSection($IniFile, "Ini_List")
$NoInis = $IniArray[0][0]
$buttonHeight = 20
$width = 150
$height = $NoInis * $buttonHeight
$GUIHandle = GUICreate ( "FPGA Comms (Esc to quit)" , $width , $height ,-1,-1,BitOR($WS_MINIMIZEBOX , $WS_CAPTION))
Dim $IniButtonArray[$NoInis +1]
For $b = 1 to $NoInis
    $IniButtonArray[$b] = GUICtrlCreateButton($IniArray[$b][0],0,($b-1)*$buttonHeight,$width,$buttonHeight)
Next
GUISetState(@SW_SHOW, $GUIHandle)
$IniFile = ""
while $IniFile = ""
    $msg = GUIGetMsg()
    if $msg = $GUI_EVENT_CLOSE then _Terminate()
    For $b = 1 to $NoInis
        if $msg = $IniButtonArray[$b] then
            $IniFile = @ScriptDir&"\"&$IniArray[$b][1]
        endif
    next
    if $bb = $repeats then _Terminate()
    sleep(1)
wend
GUIDelete($GUIHandle)
Dim $ButtonArray = IniReadSection($IniFile, "Buttons")
if Not @error then
    $NoButs = $ButtonArray[0][0]
else
    $NoButs = 0
endif

$Ini_Name = @ScriptDir&"\"&IniRead ($IniFile,"Settings","DataIniFile","")
$repeats = Number(IniRead ($IniFile,"Settings","repeats",0))
$outstring = IniRead ($IniFile,"Settings","outstring","T")
$interval = Number(IniRead ($IniFile,"Settings","interval",1000))*1000
$datalength = Number(IniRead ($IniFile,"Settings","datalength",1))
$PartName = IniRead ($IniFile,"Settings","Part","")
$LabelsPerCol = Number(IniRead ($IniFile,"Settings","LabelsPerCol",40))
$stepping = 1
if $repeats = 0 then
    $repeats = 1
    $stepping = 0
endif
$IniSectionArray = IniReadSectionNames($Ini_Name)
$LabelHeight = 16
$ListWidth = 32
$ListHeight = $LabelHeight

if Mod($IniSectionArray[0],$LabelsPerCol)>0 then
    $t=1
Else
    $t=0
endif
$Columns = int($IniSectionArray[0]/$LabelsPerCol)+$t
$GUIHandle = GUICreate ( "" , 10 , 10)
Dim $LabelWidths[$Columns]
Dim $ColumnWidths[$Columns+1]
$ColumnWidths[0]=0

$width = 160
if $Combined <> 1 Then
    $width = 0
EndIf
if $NoButs = 0 then
    $width = 0
EndIf
For $b = 0 to $Columns-1
    $LabelWidths[$b]=0
    For $a=$LabelsPerCol*$b +1 to _Min($LabelsPerCol*($b+1),$IniSectionArray[0])
        $tt = GUICtrlCreateLabel ( $IniSectionArray[$a], 0, 0)
        $t = ControlGetPos ( $GUIHandle, "", $tt)
        GUICtrlDelete ($tt)
        If $t[2] > $LabelWidths[$b] Then
            $LabelWidths[$b] = $t[2]
        EndIF
    Next
    $ColumnWidths[$b+1] = $ListWidth + $LabelWidths[$b]
    $width = $width + $ColumnWidths[$b+1]
Next
$GUIHandle = GUIDelete($GUIHandle)
$height = _Min($IniSectionArray[0],$LabelsPerCol) * $LabelHeight
if $Combined = 1 Then
    $height = _Max($NoButs*40,_Min($IniSectionArray[0],$LabelsPerCol) * $LabelHeight)
endif
$GUIHandle = GUICreate ( "FPGA Data (Esc to quit)" , $width , $height ,-1,-1,BitOR($WS_MINIMIZEBOX , $WS_CAPTION))
Dim $Data_Array[$IniSectionArray[0]]
Dim $Label_Array[$IniSectionArray[0]]
For $a = 1 to $IniSectionArray[0]
    $Column = int(($a-1)/$LabelsPerCol)
    $X = 0
    for $b = 0 to $Column
        $X = $X + $ColumnWidths[$b]
    next
    $Row = $a - ($LabelsPerCol*$Column)-1
    $Label_Array[$a-1] = GUICtrlCreateLabel ( $IniSectionArray[$a], $X, $Row*$LabelHeight, $LabelWidths[$Column] , $LabelHeight ,BitOR($SS_SUNKEN,$SS_CENTER))
    $Data_Array[$a-1] = GUICtrlCreateLabel ( "", $X + $LabelWidths[$Column], $Row*$LabelHeight , $ListWidth, $ListHeight, BitOR($SS_SUNKEN,$SS_CENTER))
    GUICtrlSetColor($Data_Array[$a-1], $COLOR_RED)
    GUICtrlSetBkColor($Data_Array[$a-1], $COLOR_WHITE)
    $t=ControlGetPos ( $GUIHandle, "", $Label_Array[$a-1])
Next
GUISetState(@SW_SHOW, $GUIHandle)

if $NoButs > 0 then
    if $Combined <> 1 Then
        $GUI2Handle = GUICreate ( "Control" , 150 , $NoButs*40 ,-1,-1,$WS_MINIMIZEBOX + $WS_CAPTION + $WS_POPUP)
    EndIf
    $buttonX = $width-150
    If $Combined <> 1 Then
        $buttonX = 0
    EndIf
    Dim $GUIButtonArray[$NoButs +1]
    For $b = 1 to $NoButs
        $GUIButtonArray[$b] = GUICtrlCreateButton($ButtonArray[$b][0],$buttonX+0,($b-1)*40,150,40)
    next
    if $Combined <> 1 Then
        GUISetState(@SW_SHOW, $GUI2Handle)
    EndIf
endif
$Do = _FT_CreateDeviceInfoList($lpdwNumDevs)
If $Do <> 0 then
    msgbox(0,"","Something wrong!")
    _Terminate()
endif
$Do = _FT_GetDeviceInfoList($pDest, $lpdwNumDevs)
$NumDevices = DllStructGetData($lpdwNumDevs, 1)
If  $NumDevices < 1 then
    msgbox(0,"","No part attached")
    _Terminate()
Else
    $iDevice = -1
    for $pvArg1 = 0 to $NumDevices - 1
        $pvArg2 = DllStructCreate('char[100]')
        $Do = _FT_ListDevices($pvArg1, $pvArg2, BitOR($FT_LIST_BY_INDEX, $FT_OPEN_BY_SERIAL_NUMBER))
        $Part = DllStructGetData($pvArg2,1)
        if $Part = $PartName Then
            if $iDevice = -1 Then
                $iDevice = $pvArg1
                ;msgbox(0,$iDevice,$Part)
            Else
                msgbox(0,"","More than 1 Device found!")
                _Terminate()
            EndIf
        EndIf
    Next
    If $iDevice = -1 Then
        msgbox(0,"","Part "&$PartName&" Not Found")
        _Terminate()
    EndIf
EndIf
$Do = _FT_Open($iDevice, $fthandle)

If $Do <>0 then 
    msgbox(0,"","Failed to Open Port," & _USBFT_ErrorDescription($Do))
    _Terminate()
endif
$Do = _FT_SetBaudRate($FT_HANDLE, 250000)
$uWordLength = $FT_BITS_8
$uStopBits = $FT_STOP_BITS_1
$uParity = $FT_PARITY_NONE
$Do = _FT_SetDataCharacteristics($FT_HANDLE, $uWordLength, $uStopBits, $uParity)
$usFlowControl = $FT_FLOW_NONE
$uXon = 'A'
$uXoff = 'C'
$Do = _FT_SetFlowControl($FT_HANDLE, $usFlowControl, $uXon, $uXoff)
$framcounter = 0
    _FT_Purge($FT_HANDLE,  BitOR($FT_PURGE_RX, $FT_PURGE_TX))
$starttime = _Timer_Init()
for $bb = $stepping to $repeats step $stepping
    $t=""
    $msg = GUIGetMsg()
    if $msg = $GUI_EVENT_CLOSE then _ExitLoop()
    if $NoButs > 0 then
        For $b = 1 to $NoButs
            if $msg = $GUIButtonArray[$b] then
                $t = $ButtonArray[$b][1]
            endif
        next
    endif
    $t=$t&$outstring
    ;msgbox(0,"","["&$t&"]")
    _FT_Purge($FT_HANDLE,  BitOR($FT_PURGE_RX, $FT_PURGE_TX))
    DllStructSetData($lpBuffer, 1, $t)
    $dwBytesToWrite = StringLen($t)
    $Do = _FT_Write($FT_HANDLE, $lpBuffer, $dwBytesToWrite, $lpdwBytesWritten)

    $framcounter = $framcounter + 1
    $starttime2 = _Timer_Init()
    $Do = _FT_GetStatus($FT_HANDLE, $lpdwAmountInRxQueue, $lpdwAmountInTxQueue, $lpdwEventStatus)
    ;msgbox(0,"", DllStructGetData($lpdwAmountInTxQueue, 1))

    $dwBytesToRead = 0
    while $dwBytesToRead <$datalength
        $Do = _FT_GetStatus($FT_HANDLE, $lpdwAmountInRxQueue, $lpdwAmountInTxQueue, $lpdwEventStatus)
        $dwBytesToRead = DllStructGetData($lpdwAmountInRxQueue, 1)
        ;msgbox(0,"",$dwBytesToRead)
        if _Timer_Diff($starttime)>5000 then
            msgbox(0,"Rx issue","Rx Timeout")
            _ExitLoop()
            exitloop
        endif
        sleep(1)
    wend
    if DllStructGetData($lpdwAmountInRxQueue, 1) > $datalength then
        msgbox(0,"Rx Issue",DllStructGetData($lpdwAmountInRxQueue, 1)&" Bytes, expected: "&$datalength)
    endif
    if $bb < $repeats then  
        $dwBytesToRead = DllStructGetData($lpdwAmountInRxQueue, 1)
        DllStructSetData($lpBuffer, 1, '')
        $Do = _FT_Read($FT_HANDLE, $lpBuffer, $dwBytesToRead, $lpdwBytesReturned)
        if $Do <> 0 then msgbox(0,"","oh")
        ;msgbox(0,"",$dwBytesToRead)
        ;msgbox(0,"",DllStructGetData($lpdwBytesReturned,1))
        $data=DllStructGetData($lpBuffer, 1)
        ;msgbox(0,"",$data)
        for $a = 0 to $IniSectionArray[0]-1
            $Sect = $IniSectionArray[$a+1]
            $Bytes = IniRead ( $Ini_Name, $Sect, "Bytes",0)
            $SectData=""
            If $Bytes = 0 Then
                $ByteNum = IniRead ( $Ini_Name,$Sect,"Byte",-1)
                $Bits = IniRead ( $Ini_Name,$Sect,"Bits",-1)
                If $Bits = -1 Then
                    If BitAND ($bitarray[IniRead ( $Ini_Name,$Sect,"Bit",-1)] , Dec(StringMid($data,($ByteNum*2)+3,2))) >0 Then
                        $SectData = 1
                    Else
                        $SectData = 0
                    EndIf
                Else
                    For $b = $Bits to 1 step -1
                        If BitAND ($bitarray[IniRead ( $Ini_Name,$Sect,"Bit"&$b,-1)] , Dec(StringMid($data,($ByteNum*2)+3,2))) >0 Then
                            $SectData = $SectData + 2^($b-1)
                        EndIf
                    Next
                EndIf
            Else
                For $b = $Bytes to 1 step -1
                    $ByteNum = IniRead ( $Ini_Name,$Sect,"Byte"&$b,-1)
                    $SectData = $SectData & StringMid($data,($ByteNum*2)+3,2)
                Next
            EndIf
            GUICtrlSetData ($Data_Array[$a], $SectData)
        Next
        $t = int(_Timer_Diff($starttime)*1000)
        If $t < $interval Then
            _HighPrecisionSleep(($interval-$t))
        EndIf
        $starttime = _Timer_Init()
    Else
        ExitLoop
    endif
next
_Terminate()

Func _ExitLoop()
    $bb = $repeats
EndFunc
Func _Terminate()
    ;if $Do <> 0 then 
    _FT_Close($FT_HANDLE)
    If $GUIHandle > 1 Then
        GUIDelete($GUIHandle)
    EndIf
    If $GUI2Handle > 1 Then
        GUIDelete($GUI2Handle)
    EndIf
    DllClose($hDll_ntdll)
    Exit
EndFunc

Func _HighPrecisionSleep($iSleep)
    DllCall($hDll_ntdll, "dword", "NtDelayExecution", "int", 0, "int64*", -10 * $iSleep)
 EndFunc

here's FPGA_Comms.ini

[Settings]
Combined = 1

[Ini_List]
GLM_V1 = GLM_Lone_Test_settings.ini
73_Digital_OP_Test = 73_Digital_OP_Settings.ini
73_Digital = 73_Digital_Settings.ini

73_Digital_settings.ini

[Settings]
DataIniFile = 73_Digital_data.ini
LabelsPerCol = 46
repeats = 0
interval = 500
datalength = 128
outstring = T
Part = GLM_V1

[Buttons]
Reset Faults = R
MTU Control = M
MTU Up = N
MTU Down = P
O/P Test Mode Enable = o
Next = N
Previous = P
Toggle Output = t
Loadbank Mode = L
Ammeter Test = A
Speedo Test = S
Probe Sim = p
Probe 1 Speed Toggle = 1
Probe 2 Speed Toggle = 2
Probe 3 Speed Toggle = 3
Probe 4 Speed Toggle = 4

And here's 73_Digital_data.ini

[Speedo Test Active]
Byte = 30
Bit = 6
OK = 1
[Probe Sim Active]
Byte = 39
Bit = 7
OK = 1
[Probe 1 Speed]
Byte = 38
Bit = 4
[Probe 2 Speed]
Byte = 38
Bit = 5
[Probe 3 Speed]
Byte = 38
Bit = 6
[Probe 4 Speed]
Byte = 38
Bit = 7
[Ammeter Test Active]
Byte = 30
Bit = 7
OK = 1
[Loadbank Mode Active]
Byte = 39
Bit = 0
OK = 1
[MTU Mode Active]
Byte = 39
Bit = 1
OK = 1
[O/P Test Mode Active]
Byte = 19
Bit = 7
OK = 1
[Output Selected]
Bytes = 1
Byte1 = 27
;[FIELD I LIMITED]
;Byte = 14
;Bit = 6
;Flt = 1
;[AUX I LIMITED]
;Byte = 12
;Bit = 5
;Flt = 1
;[ARM1 I LIMITED]
;Byte = 12
;Bit = 7
;Flt = 1
;[ARM2 I LIMITED]
;Byte = 13
;Bit = 0
;Flt = 1
;[ARM3 I LIMITED]
;Byte = 13
;Bit = 1
;Flt = 1
;[ARM4 I LIMITED]
;Byte = 13
;Bit = 2
;Flt = 1
;[FIELD SERVO FAULT]
;Byte = 14
;Bit = 3
;Flt = 1
;[AUX SERVO FAULT]
;Byte = 14
;Bit = 4
;Flt = 1
;[ARM1 SERVO FAULT]
;Byte = 13
;Bit = 7
;Flt = 1
;[ARM2 SERVO FAULT]
;Byte = 14
;Bit = 0
;Flt = 1
;[ARM3 SERVO FAULT]
;Byte = 14
;Bit = 1
;Flt = 1
;[ARM4 SERVO FAULT]
;Byte = 14
;Bit = 2
;Flt = 1
;[Field ILOCK]
;Byte = 14
;Bit = 5
;Flt = 0
;[AUX ILOCK]
;Byte = 12
;Bit = 4
;Flt = 0
;[PROT ILOCK]
;Byte = 12
;Bit = 6
;Flt = 0
;[A1 ILOCK]
;Byte = 13
;Bit = 3
;Flt = 0
;[A2 ILOCK]
;Byte = 13
;Bit = 4
;Flt = 0
;[A3 ILOCK]
;Byte = 13
;Bit = 5
;Flt = 0
;[A4 ILOCK]
;Byte = 13
;Bit = 6
;Flt = 0
;[Probe 1 Supply OK]
;Byte = 18
;Bit = 4
;Flt = 0
;[Probe 2 Supply OK]
;Byte = 18
;Bit = 5
;Flt = 0
;[Probe 3 Supply OK]
;Byte = 18
;Bit = 6
;Flt = 0
;[Probe 4 Supply OK]
;Byte = 18
;Bit = 7
;Flt = 0
[Current Balance Relay]
Byte = 0
Bit = 7
Flt = 0
[Field Overload relay]
Byte = 1
Bit = 1
Flt = 0
[Arm1 Overload]
Byte = 2
Bit = 3
Flt = 0
[Arm 2 Overload]
Byte = 2
Bit = 4
Flt = 0
[Arm 3 Overload]
Byte = 2
Bit = 5
Flt = 0
[Arm 4 Overload]
Byte = 2
Bit = 6
Flt = 0

[TM1 Isolation Switch]
Byte = 1
Bit = 3
OK = 1
[O/P 04 Close TM1 Armature]
Byte = 20
Bit = 4
OK = 1
[Armature  Contactor 1 Proving]
Byte = 1
Bit = 7
OK = 1
[O/P 08 Motor 1 Isolate Indicator]
Byte = 21
Bit = 0
Flt = 1
[O/P 14 TM1 Field Isolator]
Byte = 22
Bit = 4
Flt = 0
[Field 4 Isolator Proving]
Byte = 2
Bit = 7
Flt = 0

[TM2 Isolation Switch]
Byte = 1
Bit = 4
OK = 1
[O/P 05 Close TM2 Armature]
Byte = 20
Bit = 5
OK = 1
[Armature  Contactor 2 Proving]
Byte = 2
Bit = 0
OK = 1
[O/P 09 Motor 2 Isolate Indicator]
Byte = 21
Bit = 1
Flt = 1
[O/P 15 TM2 Field Isolator]
Byte = 22
Bit = 5
Flt = 0
[Field 2 Isolator Proving]
Byte = 3
Bit = 0
Flt = 0

[TM3 Isolation Switch]
Byte = 1
Bit = 5
OK = 1
[O/P 06 Close TM3 Armature]
Byte = 20
Bit = 6
OK = 1
[Armature  Contactor 3 Proving]
Byte = 2
Bit = 1
OK = 1
[O/P 0A Motor 3 Isolate Indicator]
Byte = 21
Bit = 2
Flt = 1
[O/P 16 TM3 Field Isolator]
Byte = 22
Bit = 6
Flt = 0
[Field 3 Isolator Proving]
Byte = 3
Bit = 1
Flt = 0

[TM4 Isolation Switch]
Byte = 1
Bit = 6
OK = 1
[O/P 07 Close TM4 Armature]
Byte = 20
Bit = 7
OK = 1
[Armature  Contactor 4 Proving]
Byte = 2
Bit = 2
OK = 1
[O/P 0B Motor 4 Isolate Indicator]
Byte = 21
Bit = 3
Flt = 1
[O/P 17 TM4 Field Isolator]
Byte = 22
Bit = 7
Flt = 0
[Field 4 Isolator Proving]
Byte = 3
Bit = 2
Flt = 0

[O/P 38 Fan Stop]
Byte = 28
Bit = 0
[O/P 26 Derate]
Byte = 24
Bit = 6
[O/P 25 Power Earth Fault]
Byte = 24
Bit = 5
[O/P 23 Either Cab Active]
Byte = 24
Bit = 3
OK = 1
[O/P 22 Wheelslip Indicator]
Byte = 24
Bit = 2
Flt = 1
[O/P 20 General Fault]
Byte = 24
Bit = 0
Flt = 1
[O/P 21 ETS ON indicator]
Byte = 24
Bit = 1
OK = 1
[O/P 1F Automatic Sanding]
Byte = 23
Bit = 7
PK = 1
[O/P 1D Gx ON]
Byte = 23
Bit = 5
OK = 1
[Gx Contactor Proving]
Byte = 4
Bit = 2
OK = 1
[O/P 12 Engine Stop]
Byte = 22
Bit = 2
[O/P 0C SSF]
Byte = 21
Bit = 4
[NVR]
Byte = 0
Bit = 0
[O/P 37 Close HSCB]
Byte = 26
Bit = 7
OK = 1
[HSCB Proving]
Byte = 0
Bit = 1
OK = 1
[HSCB 0]
Byte = 19
Bit = 0
[HSCB 1]
Byte = 19
Bit = 1
[Shoe Valve Close]
Byte = 0
Bit = 2
[O/P 02 Close Line]
Byte = 20
Bit = 2
OK = 1
[Line Contactor Proving]
Byte = 0
Bit = 3
OK = 1
[O/P 10 Reverser FWD]
Byte = 22
Bit = 0
[Reverser FWD Proving]
Byte = 0
Bit = 4
[O/P 11 Reverser REV]
Byte = 22
Bit = 1
[Reverser REV Proving]
Byte = 0
Bit = 5
[O/P 01 Close Pre-Charge]
Byte = 20
Bit = 1
OK = 1
[Pre Charge Proving]
Byte = 0
Bit = 6
OK = 1
[O/P 03 Close TM Field]
Byte = 20
Bit = 3
OK = 1
[Field Contactor Proving]
Byte = 1
Bit = 0
OK = 1
[Fire Alarm Return]
Byte = 1
Bit = 2

;[Auxiliary Changeover 1 proving]
;Byte = 3
;Bit = 3
;[Auxiliary Changeover  2 proving]
;Byte = 3
;Bit = 4
;[Auxiliary Changeover  3 proving]
;Byte = 3
;Bit = 5
;[Auxiliary Changeover  4 proving]
;Byte = 3
;Bit = 6
;[Auxiliary Changeover  5 proving]
;Byte = 3
;Bit = 7
;[Auxiliary Changeover  6 proving]
;Byte = 4
;Bit = 0
;[Auxiliary Changeover  7 proving]
;Byte = 4
;Bit = 1

[Traction Motor Blower 1 CB Proving]
Byte = 4
Bit = 3
OK = 1
[Traction Motor Blower 2 CB Proving]
Byte = 4
Bit = 4
OK = 1
[Engine Room Fan CB Proving]
Byte = 4
Bit = 5
OK = 1
[Line Inductor Fan CB Proving]
Byte = 4
Bit = 6
OK = 1
[Compressor CB Proving]
Byte = 4
Bit = 7
[O/P 0E Close train Heat Contactor]
Byte = 21
Bit = 6
[Train Heat Contactor Proving]
Byte = 5
Bit = 0
[Train Heat Overload]
Byte = 5
Bit = 1
[Chopper Fan PSU Breaker Proving]
Byte = 5
Bit = 2
[Pressure Low]
Byte = 5
Bit = 3
[74V DVT Trainline PSU ON]
Byte = 5
Bit = 4
[Loadbank Pressure Switch Interlock]
Byte = 5
Bit = 5
[Reset Relay]
Byte = 5
Bit = 6
[MTU DC Link Voltage Reached]
Byte = 5
Bit = 7
[O/P 00 Electric/Diesel Changeover]
Byte = 20
Bit = 0
[Mode Changeover Proving N/O]
Byte = 6
Bit = 0
[Mode Changeover Proving N/C]
Byte = 6
Bit = 1
[Engine Running]
Byte = 6
Bit = 2
[Alarm- MTU Eng Cold]
Byte = 6
Bit = 3
[PEFR Power Detected]
Byte = 6
Bit = 4
[PEFR –Ve Earth Fault]
Byte = 6
Bit = 5
[Alarm - MTU Derate]
Byte = 6
Bit = 6
[Control Earth Fault]
Byte = 6
Bit = 7
[PEFR +Ve Earth Fault]
Byte = 7
Bit = 0
[Earth Fault Iso Switch (Diesel Only)]
Byte = 7
Bit = 1
[Master Switch Forward]
Byte = 7
Bit = 2
OK = 1
[Master Switch Reverse]
Byte = 7
Bit = 3
OK = 1
[Cab 1 Active]
Byte = 7
Bit = 4
OK = 1
[Cab 2 Active]
Byte = 7
Bit = 5
OK = 1
[Diesel Mode]
Byte = 7
Bit = 6
[Electric Mode / Engine Stop]
Byte = 7
Bit = 7
[Engine Start]
Byte = 8
Bit = 0
[Reset]
Byte = 8
Bit = 1
[Up/Mast Run Back]
Byte = 8
Bit = 2
OK = 1
[Up/Mast Hold]
Byte = 8
Bit = 3
OK = 1
[Up/Mast Series]
Byte = 8
Bit = 4
OK = 1
[Up/Mast Parallel]
Byte = 8
Bit = 5
OK = 1
[Up/Mast Notch Up / Weak Field]
Byte = 8
Bit = 6
OK = 1
[Up/Mast OFF – Cab 2]
Byte = 8
Bit = 7
OK = 1
[Up/Mast OFF – Cab 1]
Byte = 9
Bit = 0
OK = 1
[Low/Mast AAR Input A]
Byte = 9
Bit = 1
OK = 1
[Low/Mast AAR Input B]
Byte = 9
Bit = 2
OK = 1
[Low/Mast AAR Input C]
Byte = 9
Bit = 3
OK = 1
[Low/Mast AAR Input D]
Byte = 9
Bit = 4
OK = 1
[Low/Mast Power On]
Byte = 9
Bit = 5
OK = 1
[Low/Mast Active]
Byte = 9
Bit = 6
OK = 1
[Low/Mast Engine Start Enable]
Byte = 9
Bit = 7
OK = 1
[ETS CMD]
Byte = 10
Bit = 0
[Low/Mast Diesel On]
Byte = 10
Bit = 1
OK = 1
[Up/Mast Diesel On]
Byte = 10
Bit = 2
OK = 1
[Smart Relay Status]
Byte = 10
Bit = 3
[Webasto Status]
Byte = 10
Bit = 4
[Electric Pre-Heat Status]
Byte = 10
Bit = 5
[Battery Charger Input Contactor proving]
Byte = 10
Bit = 6
[Compressor Over Temp]
Byte = 10
Bit = 7
[O/P 28 Inverter 1 Contactor]
Byte = 25
Bit = 0
[Inverter 1 OK]
Byte = 11
Bit = 0
[O/P 29 Inverter 2 Contactor]
Byte = 25
Bit = 1
[Inverter 2 OK]
Byte = 11
Bit = 1
[O/P 2A Inverter 3 Contactor]
Byte = 25
Bit = 2
[Inverter 3 OK]
Byte = 11
Bit = 2
[O/P 2B Inverter 4 Contactor]
Byte = 25
Bit = 3
[Inverter 4 OK]
Byte = 11
Bit = 3
[O/P 2C Battery Charger Contactor]
Byte = 25
Bit = 4
[Battery Charger OK]
Byte = 11
Bit = 4
[Low Fuel Warning]
Byte = 11
Bit = 5
[74V DVT PSU Ok]
Byte = 11
Bit = 6
[LINE OVLD]
Byte = 11
Bit = 7
[PEF (ELECTRIC)]
Byte = 12
Bit = 0
[ENGINE O/LD]
Byte = 12
Bit = 1
[ENGINE U/LD]
Byte = 12
Bit = 2
[LOAD CTRL ACTIVE]
Byte = 12
Bit = 3
Flt = 1

[FCT2_LO]
Byte = 14
Bit = 7
[FCT3_LO]
Byte = 15
Bit = 0
[FCT4_LO]
Byte = 15
Bit = 1
[FCT5_LO]
Byte = 15
Bit = 2
[FCT6_LO]
Byte = 15
Bit = 3
[MICRO WD]
Byte = 15
Bit = 4
[Zero Current]
Byte = 15
Bit = 5
;[ARM1 FAN1]
;Byte = 15
;Bit = 6
;[ARM1 FAN2]
;Byte = 15
;Bit = 7
;[ARM2 FAN1]
;Byte = 16
;Bit = 0
;[ARM2 FAN2]
;Byte = 16
;Bit = 1
;[ARM3 FAN1]
;Byte = 16
;Bit = 2
;[ARM3 FAN2]
;Byte = 16
;Bit = 3
;[ARM4 FAN1]
;Byte = 16
;Bit = 4
;[ARM4 FAN2]
;Byte = 16
;Bit = 5
;[FIELD FAN1]
;Byte = 16
;Bit = 6
;[FIELD FAN2]
;Byte = 16
;Bit = 7
;[PROT FAN1]
;Byte = 17
;Bit = 0
;[PROT FAN2]
;Byte = 17
;Bit = 1
;[AUX FAN1]
;Byte = 17
;Bit = 2
;[AUX FAN2]
;Byte = 17
;Bit = 3
;[TEST DI1]
;Byte = 17
;Bit = 4
;[TEST DI2]
;Byte = 17
;Bit = 5
;[TEST DI3]
;Byte = 17
;Bit = 6
;[TEST DI4]
;Byte = 17
;Bit = 7
;[TEST DI5]
;Byte = 18
;Bit = 0
;[TEST DI6]
;Byte = 18
;Bit = 1
[TEST DI7]
Byte = 18
Bit = 2
[TEST DI8]
Byte = 18
Bit = 3
[Fan24v OK]
Byte = 19
Bit = 2
[Probe 1]
Byte = 19
Bit = 3
[Probe 2]
Byte = 19
Bit = 4
[Probe 3]
Byte = 19
Bit = 5
[Probe 4]
Byte = 19
Bit = 6
[Mode State]
Bytes = 1
Byte1 = 31
[IO I/P Fault]
Byte = 32
Bit = 0
Flt = 1
[IO O/P Fault]
Byte = 32
Bit = 1
Flt = 1
[PreCharge Bank]
Bytes = 1
Byte1 = 33
[Speed]
Bytes = 2
Byte1 = 34
Byte2 = 35

[Fram_Trig1/3]
Bytes = 1
Byte1 = 36
[Fram_Trig4]
Byte = 37
Bit = 0
[Fram_Trig2]
Byte = 37
Bit = 1

[PEF_E_Flt]
Byte = 32
Bit = 2
Flt = 1
[LineOvI_Flt]
Byte = 32
Bit = 3
Flt = 1
[TMA_OVL_Flt(0)]
Byte = 32
Bit = 4
[TMA_OVL_Flt(1)]
Byte = 32
Bit = 5
[TMA_OVL_Flt(2)]
Byte = 32
Bit = 6
[TMA_OVL_Flt(3)]
Byte = 32
Bit = 7
[TMF_OVL_Flt]
Byte = 37
Bit = 2
[Filt_Flt]
Byte = 37
Bit = 4
[PC_Flt_Latched]
Byte = 37
Bit = 3
[PEF_E_Latched]
Byte = 37
Bit = 5
[LineOvI_Latched]
Byte = 37
Bit = 6
[TMA_OVL_Latched1]
Byte = 37
Bit = 7
[TMA_OVL_Latched2]
Byte = 38
Bit = 0
[TMA_OVL_Latched3]
Byte = 38
Bit = 1
[TMA_OVL_Latched4]
Byte = 38
Bit = 2
[TMF_OVL_Latched]
Byte = 38
Bit = 3
[INV C OK 1]
Byte = 39
Bit = 2
[INV C OK 2]
Byte = 39
Bit = 3
[INV C OK 3]
Byte = 39
Bit = 4
[INV C OK 4]
Byte = 39
Bit = 5
[BC C OK]
Byte = 39
Bit = 6
[Power Calc]
Bytes = 2
Byte1 = 40
Byte2 = 41
[MTU NBit 0]
Byte = 23
Bit = 0
OK = 1
[MTU NBit 1]
Byte = 23
Bit = 1
OK = 1
[MTU NBit 2]
Byte = 23
Bit = 2
OK = 1
[MTU NBit 3]
Byte = 23
Bit = 3
OK = 1
[MTU NBit 4]
Byte = 23
Bit = 4
OK = 1
[TM 1 On]
Byte = 42
Bit = 0
OK = 1
[TM 2 On]
Byte = 42
Bit = 1
OK = 1
[TM 3 On]
Byte = 42
Bit = 2
OK = 1
[TM 4 On]
Byte = 42
Bit = 3
OK = 1

[O/P 39 Protection LED]
Byte = 28
Bit = 1
[O/P 3A Protection G/nR]
Byte = 28
Bit = 2
Flt = 0
[O/P 3B Aux LED]
Byte = 28
Bit = 3
[O/P 3C Aux G/nR]
Byte = 28
Bit = 4
Flt = 0
[O/P 3D Field LED]
Byte = 28
Bit = 5
[O/P 3E Field G/nR]
Byte = 28
Bit = 6
Flt = 0
[O/P 3F Arm LED 1]
Byte = 28
Bit = 7
[O/P 40 Arm LED 2]
Byte = 29
Bit = 0
[O/P 41 Arm LED 3]
Byte = 29
Bit = 1
[O/P 42 Arm LED 4]
Byte = 29
Bit = 2
[O/P 43 ARM 1 G/nR]
Byte = 29
Bit = 3
Flt = 0
[O/P 44 ARM 2 G/nR]
Byte = 29
Bit = 4
Flt = 0
[O/P 45 ARM 3 G/nR]
Byte = 29
Bit = 5
Flt = 0
[O/P 46 ARM 4 G/nR]
Byte = 29
Bit = 6
Flt = 0
[O/P 47 ARM 1 PWM Off]
Byte = 29
Bit = 7
OK = 0
[O/P 48 ARM 2 PWM Off]
Byte = 30
Bit = 0
OK = 0
[O/P 49 ARM 3 PWM Off]
Byte = 30
Bit = 1
OK = 0
[O/P 4A ARM 4 PWM Off]
Byte = 30
Bit = 2
OK = 0
[O/P 4B Field PWM Off]
Byte = 30
Bit = 3
OK = 0
[O/P 4C Aux PWM Off]
Byte = 30
Bit = 4
OK = 0

[Load Clamp]
Bytes = 2
Byte1 = 64
Byte2 = 65
[Eng Load]
Bytes = 2
Byte1 = 66
Byte2 = 67
[V Line]
Bytes = 2
Byte1 = 68
Byte2 = 69
[V Filt]
Bytes = 2
Byte1 = 70
Byte2 = 71
[I TS]
Bytes = 2
Byte1 = 72
Byte2 = 73
[V Rect]
Bytes = 2
Byte1 = 74
Byte2 = 75
[I Aux]
Bytes = 2
Byte1 = 76
Byte2 = 77
[V Aux]
Bytes = 2
Byte1 = 78
Byte2 = 79
[Temp Arm 1]
Bytes = 2
Byte1 = 80
Byte2 = 81
[Temp Arm 2]
Bytes = 2
Byte1 = 82
Byte2 = 83
[Temp Arm 3]
Bytes = 2
Byte1 = 84
Byte2 = 85
[Temp Arm 4]
Bytes = 2
Byte1 = 86
Byte2 = 87
[Temp Field]
Bytes = 2
Byte1 = 88
Byte2 = 89
[Temp Aux]
Bytes = 2
Byte1 = 90
Byte2 = 91
[Temp Prot]
Bytes = 2
Byte1 = 92
Byte2 = 93
[Temp LI1]
Bytes = 2
Byte1 = 94
Byte2 = 95
[Temp LI2]
Bytes = 2
Byte1 = 96
Byte2 = 97
[I Shoe 1]
Bytes = 2
Byte1 = 98
Byte2 = 99
[I Shoe 2]
Bytes = 2
Byte1 = 100
Byte2 = 101
[Pot 1]
Bytes = 2
Byte1 = 102
Byte2 = 103
[Pot 2]
Bytes = 2
Byte1 = 104
Byte2 = 105
[Pot 3]
Bytes = 2
Byte1 = 106
Byte2 = 107
[Pot 4]
Bytes = 2
Byte1 = 108
Byte2 = 109
[Temp Cubicle]
Bytes = 2
Byte1 = 110
Byte2 = 111
[Temp Ambient]
Bytes = 2
Byte1 = 112
Byte2 = 113
[IA DMD]
Bytes = 2
Byte1 = 114
Byte2 = 115
[IA DMD 1]
Bytes = 2
Byte1 = 116
Byte2 = 117
[IA DMD 2]
Bytes = 2
Byte1 = 118
Byte2 = 119
[IA DMD 3]
Bytes = 2
Byte1 = 120
Byte2 = 121
[IA DMD 4]
Bytes = 2
Byte1 = 122
Byte2 = 123
[IF DMD]
Bytes = 2
Byte1 = 124
Byte2 = 125
[V Lim]
Bytes = 2
Byte1 = 126
Byte2 = 127
[V trac]
Bytes = 2
Byte1 = 62
Byte2 = 63
[Eng Ready]
Byte = 30
Bit = 5
OK = 1

That will be enough to make the last button work on the first window. Bypassing the USB comms will be interesting!

(and yes, I know it's a mess, It's grown a bit randomly as new features were added)

Link to comment
Share on other sites

  • Moderators

weirddave,

That is of no help at all. You provide a reproducer script that shows the delay and I will happily help you debug it, but just posting a mess of code which does not even have all the UDFs needed (what is FTD2XX.dll_UDF.au3?) and which you admit will not be easy to run is not going to tempt me, nor I suspect anyone else, to spend time looking at it in detail. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...