Changeset 74 for trunk


Ignore:
Timestamp:
Nov 26, 2009, 12:15:39 AM (15 years ago)
Author:
demin
Message:

fix signal shape display configuration

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MultiChannelUSB/UserInterface.tcl

    r73 r74  
    6161        my instvar data xvec yvec
    6262
    63         dict set data none {}
    64         dict set data uwt1 {}
    65         dict set data uwt2 {}
    66         dict set data uwt3 {}
    67 #        dict set data sum8 {}
     63        set data {}
    6864
    6965        $yvec set {}
     
    7369
    7470    OscDisplay instproc start {} {
    75         my instvar config
    76        
     71        my instvar config trig_mux disp_mux
     72
     73        set trig_mux 2
     74        set disp_mux 2
     75
    7776        trace add variable [myvar auto] write [myproc auto_update]
    7877        trace add variable [myvar thrs] write [myproc thrs_update]
    79         trace add variable [myvar fltr_val] write [myproc fltr_val_update]
    80 
    81         ${config}.thrs_check deselect
    82         ${config}.thrs_field set 10
    83         ${config}.none select
     78        trace add variable [myvar thrs_val] write [myproc thrs_val_update]
     79        trace add variable [myvar disp_val] write [myproc disp_val_update]
     80        trace add variable [myvar trig_val] write [myproc trig_val_update]
     81
     82        ${config}.auto_check select
     83        ${config}.thrs_check select
     84        ${config}.thrs_field set 60
     85        ${config}.disp_uwt2 select
     86        ${config}.trig_uwt2 select
    8487    }
    8588
     
    8992        my instvar number master
    9093        my instvar data xvec yvec
    91         my instvar config auto thrs thrs_val fltr_val
     94        my instvar config auto thrs thrs_val disp_val trig_val
    9295
    9396        my set restart_command [usb::convert 0001000${number}00000000]
     
    114117        frame ${config}.spc2 -width 10 -height 10
    115118
    116         label ${config}.fltr -text {low-pass filter}
    117         radiobutton ${config}.none -text none -variable [myvar fltr_val] -value none
    118         radiobutton ${config}.uwt1 -text uwt1 -variable [myvar fltr_val] -value uwt1
    119         radiobutton ${config}.uwt2 -text uwt2 -variable [myvar fltr_val] -value uwt2
    120         radiobutton ${config}.uwt3 -text uwt3 -variable [myvar fltr_val] -value uwt3
    121 #        radiobutton ${config}.sum8 -text sum8 -variable [myvar fltr_val] -value sum8
     119        label ${config}.disp -text {display input}
     120        radiobutton ${config}.disp_data -text {raw data} -variable [myvar disp_val] -value data
     121        radiobutton ${config}.disp_uwt1 -text {filter 1} -variable [myvar disp_val] -value uwt1
     122        radiobutton ${config}.disp_uwt2 -text {filter 2} -variable [myvar disp_val] -value uwt2
     123        radiobutton ${config}.disp_uwt3 -text {filter 3} -variable [myvar disp_val] -value uwt3
     124        radiobutton ${config}.disp_base -text {baseline} -variable [myvar disp_val] -value base
     125#        radiobutton ${config}.disp_sum8 -text {sum of 8} -variable [myvar disp_val] -value sum8
    122126
    123127        frame ${config}.spc3 -width 10 -height 10
     128
     129        label ${config}.trig -text {trigger input}
     130        radiobutton ${config}.trig_data -text {raw data} -variable [myvar trig_val] -value data
     131        radiobutton ${config}.trig_uwt1 -text {filter 1} -variable [myvar trig_val] -value uwt1
     132        radiobutton ${config}.trig_uwt2 -text {filter 2} -variable [myvar trig_val] -value uwt2
     133        radiobutton ${config}.trig_uwt3 -text {filter 3} -variable [myvar trig_val] -value uwt3
     134        radiobutton ${config}.trig_base -text {baseline} -variable [myvar trig_val] -value base
     135#        radiobutton ${config}.trig_sum8 -text {sum of 8} -variable [myvar trig_val] -value sum8
     136
     137        frame ${config}.spc4 -width 10 -height 10
    124138
    125139        button ${config}.acquire -text Acquire \
     
    135149        grid ${config}.thrs_field -sticky ew -pady 1 -padx 5
    136150        grid ${config}.spc2
    137         grid ${config}.fltr -sticky w -pady 1 -padx 3
    138         grid ${config}.none -sticky w
    139         grid ${config}.uwt1 -sticky w
    140         grid ${config}.uwt2 -sticky w
    141         grid ${config}.uwt3 -sticky w
    142 #        grid ${config}.sum8 -sticky w
     151        grid ${config}.disp -sticky w -pady 1 -padx 3
     152        grid ${config}.disp_data -sticky w
     153        grid ${config}.disp_uwt1 -sticky w
     154        grid ${config}.disp_uwt2 -sticky w
     155        grid ${config}.disp_uwt3 -sticky w
     156        grid ${config}.disp_base -sticky w
     157#        grid ${config}.disp_sum8 -sticky w
    143158        grid ${config}.spc3
     159        grid ${config}.trig -sticky w -pady 1 -padx 3
     160        grid ${config}.trig_data -sticky w
     161        grid ${config}.trig_uwt1 -sticky w
     162        grid ${config}.trig_uwt2 -sticky w
     163        grid ${config}.trig_uwt3 -sticky w
     164        grid ${config}.trig_base -sticky w
     165#        grid ${config}.disp_sum8 -sticky w
     166        grid ${config}.spc4
    144167        grid ${config}.acquire -sticky ew -pady 3 -padx 5
    145168        grid ${config}.restart -sticky ew -pady 3 -padx 5
     
    161184
    162185    OscDisplay instproc auto_update args {
    163         my instvar auto after_handle
     186        my instvar config auto after_handle
    164187
    165188        if {$auto} {
     
    182205
    183206    OscDisplay instproc thrs_update args {
    184         my instvar config thrs
     207        my instvar config number thrs thrs_val
     208
     209        set val_addr [format %04x [expr {17 + ${number}}]]
     210
    185211        if {$thrs} {
    186212            ${config}.thrs_field configure -state normal
     213            my thrs_val_update
    187214        } else {
    188215            ${config}.thrs_field configure -state disabled
    189         }
    190     }
    191 
    192 # -------------------------------------------------------------------------
    193 
    194     OscDisplay instproc fltr_val_update args {
    195         my instvar yvec data fltr_val
    196         $yvec set [dict get $data $fltr_val]
     216            my send_data [usb::convert ${val_addr}000000000000]
     217        }
     218    }
     219
     220# -------------------------------------------------------------------------
     221
     222    OscDisplay instproc thrs_val_update args {
     223        my instvar config number thrs_val
     224
     225        set val_addr [format %04x [expr {17 + ${number}}]]
     226        set value [format %04x $thrs_val]
     227
     228        my send_data [usb::convert ${val_addr}${value}00000000]
     229    }
     230
     231# -------------------------------------------------------------------------
     232
     233    OscDisplay instproc mux {} {
     234        my instvar trig_mux disp_mux
     235
     236        format {00%x%x} $trig_mux $disp_mux
     237    }
     238
     239# ------------------------------------------------------------------------
     240
     241    OscDisplay instproc disp_val_update args {
     242        my instvar number disp_val disp_mux
     243
     244        set mux_addr [format %04x [expr {20 + ${number}}]]
     245
     246        switch -- $disp_val {
     247            data {
     248                set disp_mux 0
     249                my send_data [usb::convert ${mux_addr}[my mux]00000000]
     250            }
     251            uwt1 {
     252                set disp_mux 1
     253                my send_data [usb::convert ${mux_addr}[my mux]00000000]
     254            }
     255            uwt2 {
     256                set disp_mux 2
     257                my send_data [usb::convert ${mux_addr}[my mux]00000000]
     258            }
     259            uwt3 {
     260                set disp_mux 3
     261                my send_data [usb::convert ${mux_addr}[my mux]00000000]
     262            }
     263            base {
     264                set disp_mux 4
     265                my send_data [usb::convert ${mux_addr}[my mux]00000000]
     266            }
     267        }
     268    }
     269
     270# ------------------------------------------------------------------------
     271
     272    OscDisplay instproc trig_val_update args {
     273        my instvar number trig_val trig_mux
     274
     275        set mux_addr [format %04x [expr {20 + ${number}}]]
     276
     277        switch -- $trig_val {
     278            data {
     279                set trig_mux 0
     280                my send_data [usb::convert ${mux_addr}[my mux]00000000]
     281            }
     282            uwt1 {
     283                set trig_mux 1
     284                my send_data [usb::convert ${mux_addr}[my mux]00000000]
     285            }
     286            uwt2 {
     287                set trig_mux 2
     288                my send_data [usb::convert ${mux_addr}[my mux]00000000]
     289            }
     290            uwt3 {
     291                set trig_mux 3
     292                my send_data [usb::convert ${mux_addr}[my mux]00000000]
     293            }
     294            base {
     295                set trig_mux 4
     296                my send_data [usb::convert ${mux_addr}[my mux]00000000]
     297            }
     298        }
    197299    }
    198300
     
    246348    OscDisplay instproc acquire {} {
    247349        global usb_handle
    248         my instvar xvec yvec data fltr_val
     350        my instvar xvec yvec data
    249351        my instvar acquire_command
    250352
     
    258360        }
    259361
    260         dict set data none $usb_data
    261         dict set data uwt1 [lindex [uwt 1 $usb_data] 1]
    262         dict set data uwt2 [lindex [uwt 2 $usb_data] 1]
    263         dict set data uwt3 [lindex [uwt 3 $usb_data] 1]
    264 #        dict set data sum8 [sum8 $usb_data]
    265 
    266         $yvec set [dict get $data $fltr_val]
     362        set data $usb_data
     363
     364        $yvec set $usb_data
    267365    }
    268366
     
    313411        my instvar data xvec yvec
    314412
    315         dict set data none {}
    316         dict set data uwt1 {}
    317         dict set data uwt2 {}
    318         dict set data uwt3 {}
    319 #        dict set data sum8 {}
     413        set data {}
    320414
    321415        $yvec set {}
     
    325419
    326420    HstDisplay instproc start {} {
    327         my instvar config peak_mux base_mux
    328 
     421        my instvar config base_mux peak_mux
     422
     423        set base_mux 0
    329424        set peak_mux 1
    330         set base_mux 0
    331425
    332426        trace add variable [myvar auto] write [myproc auto_update]
    333427        trace add variable [myvar peak] write [myproc peak_update]
    334428        trace add variable [myvar thrs] write [myproc thrs_update]
     429        trace add variable [myvar thrs_val] write [myproc thrs_val_update]
    335430        trace add variable [myvar base] write [myproc base_update]
    336431        trace add variable [myvar base_typ] write [myproc base_typ_update]
     
    446541
    447542    HstDisplay instproc mux {} {
    448         my instvar peak_mux base_mux
    449 
    450         format {%x%x%x%x} $base_mux $peak_mux 0 0
     543        my instvar base_mux peak_mux
     544
     545        format {00%x%x} $base_mux $peak_mux
    451546    }
    452547
     
    456551        my instvar number peak peak_mux
    457552
    458         set mux_addr [format %04x [expr {20 + ${number}}]]
     553        set mux_addr [format %04x [expr {23 + ${number}}]]
    459554
    460555        if {$peak} {
     
    477572        if {$thrs} {
    478573            ${config}.thrs_field configure -state normal
    479             my send_data [usb::convert ${val_addr}${value}00000000]
     574            my thrs_val_update
    480575        } else {
    481576            ${config}.thrs_field configure -state disabled
     
    492587        set value [format %04x $thrs_val]
    493588
    494         ${config}.base_field configure -state normal
    495589        my send_data [usb::convert ${val_addr}${value}00000000]
    496590    }
     
    501595        my instvar config number base base_val base_mux
    502596
    503         set mux_addr [format %04x [expr {20 + ${number}}]]
     597        set mux_addr [format %04x [expr {23 + ${number}}]]
    504598        set val_addr [format %04x [expr {11 + ${number}}]]
    505599
     
    522616        my instvar config number base_typ base_val base_mux
    523617
    524         set mux_addr [format %04x [expr {20 + ${number}}]]
     618        set mux_addr [format %04x [expr {23 + ${number}}]]
    525619        set val_addr [format %04x [expr {11 + ${number}}]]
    526620        set value [format %04x $base_val]
Note: See TracChangeset for help on using the changeset viewer.