def set_tx_vga2gain(self, value):
     # Don't set value twice
     if self.tx_vga2gain == value: return
     print "set_tx_vga2gain(%d)" % (value)
     # Set the value
     umtrx_lms.lms_set_tx_vga2gain(self.lms, value)
     # Read back the value
     self.tx_vga2gain = umtrx_lms.lms_get_tx_vga2gain(self.lms)
     self.tx_vga2gain_slider.set_value(self.tx_vga2gain)
    def _generate_panel(self):
        # Rx LNA Selection
        self.rx_lna_chooser = forms.drop_down(
            parent=self.GetWin(),
            value=umtrx_lms.lms_get_rx_lna(self.lms),
            callback=self.set_rx_lna,
            label="Rx LNA",
            choices=[0, 1, 2, 3],
            labels=["Disabled","LNA1","LNA2", "LNA3"],
#            style=wx.RA_HORIZONTAL,
            )
        self.GridAdd(self.rx_lna_chooser, 0, 0, 1, 1)

        # Rx LNA Mode
        self.rx_lna_gain_mode_chooser = forms.drop_down(
            parent=self.GetWin(),
            value=umtrx_lms.lms_get_rx_lna_gain(self.lms),
            callback=self.set_rx_lna_gain_mode,
            label="Rx LNA Mode",
            choices=[3, 2, 1],
            labels=["3: Norm","3: -6dB","1: Bypass"],
#            style=wx.RA_HORIZONTAL,
            )
        self.GridAdd(self.rx_lna_gain_mode_chooser, 0, 1, 1, 1)

        # Rx LPF bandwidth
        self.rx_lna_gain_mode_chooser = forms.drop_down(
            parent=self.GetWin(),
            value=umtrx_lms.lms_get_rx_lpf_raw(self.lms),
            callback=self.set_rx_lpf,
            label="Rx LNA LPF",
            choices=[15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0],
            labels=[0.75, 0.875, 1.25, 1.375, 1.5, 1.92, 2.5, 2.75, 3, 3.5, 4.375, 5, 6, 7, 10, 14],
#            style=wx.RA_HORIZONTAL,
            )
        self.GridAdd(self.rx_lna_gain_mode_chooser, 0, 2, 1, 1)
        
        # Rx VGA1 gain
        self.rx_vga1gain = umtrx_lms.lms_get_rx_vga1gain_int(self.lms)
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        self.rx_vga1gain_slider = form.slider_field(
            parent=self.GetWin(), sizer=hbox,
            value=self.rx_vga1gain,
            callback=self.set_rx_vga1gain,
            label="Rx VGA1 gain (raw)\n120=30dB, 102=19dB, 2=5dB",
            min=0, max=127,
            )
        self.GridAdd(hbox, 1, 0, 1, 4)
        
        # Rx VGA2 gain
        self.rx_vga2gain = umtrx_lms.lms_get_rx_vga2gain(self.lms)
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        self.rx_vga2gain_slider = form.slider_field(
            parent=self.GetWin(), sizer=hbox,
            value=self.rx_vga2gain,
            callback=self.set_rx_vga2gain,
            label="\nRx VGA2 gain (dB)",
            min=0, max=30,# Not recommended to use above 30
            )
        self.GridAdd(hbox, 1, 4, 1, 4)
        
        # Tx VGA1 DC I offset
        self.tx_vga1dc_i_int = umtrx_lms.lms_get_vga1dc_i_int(self.lms)
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        self.tx_vga1dc_i_int_slider = form.slider_field(
            parent=self.GetWin(), sizer=hbox,
            value=self.tx_vga1dc_i_int,
            callback=self.set_tx_vga1dc_i_int,
            label="\nTx VGA1 DC I offset (raw)",
            min=0, max=255,
            )
        self.GridAdd(hbox, 3, 0, 1, 4)
        
        # Tx VGA1 DC Q offset
        self.tx_vga1dc_q_int = umtrx_lms.lms_get_vga1dc_q_int(self.lms)
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        self.tx_vga1dc_q_int_slider = form.slider_field(
            parent=self.GetWin(), sizer=hbox,
            value=self.tx_vga1dc_q_int,
            callback=self.set_tx_vga1dc_q_int,
            label="\nTx VGA1 DC Q offset (raw)",
            min=0, max=255,
            )
        self.GridAdd(hbox, 3, 4, 1, 4)

        # Tx VGA1 gain
        self.tx_vga1gain = umtrx_lms.lms_get_tx_vga1gain(self.lms)
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        self.tx_vga1gain_slider = form.slider_field(
            parent=self.GetWin(), sizer=hbox,
            value=self.tx_vga1gain,
            callback=self.set_tx_vga1gain,
            label="\nTx VGA1 gain (dB)",
            min=-35, max=-4,
            )
        self.GridAdd(hbox, 4, 0, 1, 4)

        # Tx VGA2 gain
        self.tx_vga2gain = umtrx_lms.lms_get_tx_vga2gain(self.lms)
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        self.tx_vga2gain_slider = form.slider_field(
            parent=self.GetWin(), sizer=hbox,
            value=self.tx_vga2gain,
            callback=self.set_tx_vga2gain,
            label="\nTx VGA2 gain (dB)",
            min=0, max=25,
            )
        self.GridAdd(hbox, 4, 4, 1, 4)