Ignore:
Timestamp:
May 12, 2011, 7:04:11 PM (9 years ago)
Author:
tbretz
Message:
Implemented a fix which should avoid that the GUI is playing ping-pong with e.g. the ftmctrl. This is done through a wrapper around all infoHandlers. In ceratin circumstances (mainly when signals of the kind valueChanged are emitted) it is advicable to not send the values back to the emitter if their origin is the handler.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/gui/MainWindow.cc

    r10657 r10678  
    22
    33#include <iostream>
     4#include <sstream>
    45
    56#include <QTimer>
     
    3637    // Initialize the 40 FTU Leds as a copy of the prototype LED
    3738    fFtuLED[0] = fFtuLEDPrototype;
     39    fFtuLED[0]->setToolTip("Crate 0, Board 0, Index 0");
    3840
    3941    for (int i=1; i<40; i++)
     
    4951        b->setFlat(fFtuLEDPrototype->isFlat());
    5052
     53        ostringstream str;
     54        str << "Crate " << i/10 << ", Board " << i%10 << ", Index " << i;
     55        b->setToolTip(str.str().c_str());
     56
    5157        fFtuLedLayout->addWidget(b, i/10+1, i%10+1, 1, 1);
    5258
     
    126132    {
    127133        uint8_t(fTriggerSeqPed->value()),
    128         uint8_t(fTriggerSeqLPint->value()),
    129         uint8_t(fTriggerSeqLPext->value())
     134        uint8_t(fTriggerSeqLPext->value()),
     135        uint8_t(fTriggerSeqLPint->value())
    130136    };
    131137
    132     Dim::SendCommand("FTM_CONTROL/SET_TRIGGER_SEQUENCE", d);
     138    if (!fInHandler)
     139        Dim::SendCommand("FTM_CONTROL/SET_TRIGGER_SEQUENCE", d);
    133140}
    134141
     
    153160}
    154161
    155 void MainWindow::SetTriggerCoincidence()
    156 {
    157     const uint16_t d[2] =
    158     {
    159         uint16_t(fPhysicsCoincidence->value()),
    160         uint16_t(fPhysicsWindow->value()/4-2)
    161     };
    162 
    163     Dim::SendCommand("FTM_CONTROL/SET_TRIGGER_COINCIDENCE", d);
    164 }
    165 
    166 void MainWindow::SetCalibCoincidence()
    167 {
    168     const uint16_t d[2] =
    169     {
    170         uint16_t(fCalibCoincidence->value()),
    171         uint16_t(fCalibWindow->value()/4-2)
    172     };
    173 
    174     Dim::SendCommand("FTM_CONTROL/SET_CALIBRATION_COINCIDENCE", d);
     162void MainWindow::on_fPhysicsCoincidence_valueChanged(int v)
     163{
     164    if (!fInHandler)
     165        Dim::SendCommand("FTM_CONTROL/SET_TRIGGER_COINCIDENCE", v);
     166}
     167
     168void MainWindow::on_fPhysicsWindow_valueChanged(int v)
     169{
     170    if (!fInHandler)
     171        Dim::SendCommand("FTM_CONTROL/SET_TRIGGER_WINDOW", v/4-2);
     172}
     173
     174void MainWindow::on_fCalibCoincidence_valueChanged(int v)
     175{
     176    if (!fInHandler)
     177        Dim::SendCommand("FTM_CONTROL/SET_CALIBRATION_COINCIDENCE", v);
     178}
     179
     180void MainWindow::on_fCalibWindow_valueChanged(int v)
     181{
     182    if (!fInHandler)
     183        Dim::SendCommand("FTM_CONTROL/SET_CALIBRATION_WINDOW", v/4-2);
    175184}
    176185
     
    180189
    181190    const int32_t d[2] = { fThresholdIdx->value(), v };
    182     Dim::SendCommand("FTM_CONTROL/SET_THRESHOLD", d);
     191
     192    if (!fInHandler)
     193        Dim::SendCommand("FTM_CONTROL/SET_THRESHOLD", d);
    183194}
    184195
    185196void MainWindow::on_fTriggerInterval_valueChanged(int val)
    186197{
    187     Dim::SendCommand("FTM_CONTROL/SET_TRIGGER_INTERVAL", val);
     198    if (!fInHandler)
     199        Dim::SendCommand("FTM_CONTROL/SET_TRIGGER_INTERVAL", val);
    188200}
    189201
    190202void MainWindow::on_fTriggerDelay_valueChanged(int val)
    191203{
    192     Dim::SendCommand("FTM_CONTROL/SET_TRIGGER_DELAY", val/4-2);
     204    if (!fInHandler)
     205        Dim::SendCommand("FTM_CONTROL/SET_TRIGGER_DELAY", val/4-2);
    193206}
    194207
    195208void MainWindow::on_fTimeMarkerDelay_valueChanged(int val)
    196209{
    197     Dim::SendCommand("FTM_CONTROL/SET_TIME_MARKER_DELAY", val/4-2);
     210    if (!fInHandler)
     211        Dim::SendCommand("FTM_CONTROL/SET_TIME_MARKER_DELAY", val/4-2);
    198212}
    199213
    200214void MainWindow::on_fDeadTime_valueChanged(int val)
    201215{
    202     Dim::SendCommand("FTM_CONTROL/SET_DEAD_TIME", val/4-2);
     216    if (!fInHandler)
     217        Dim::SendCommand("FTM_CONTROL/SET_DEAD_TIME", val/4-2);
    203218}
    204219
    205220void MainWindow::on_fPrescalingVal_valueChanged(int val)
    206221{
    207     Dim::SendCommand("FTM_CONTROL/SET_PRESCALING", val);
     222    if (!fInHandler)
     223        Dim::SendCommand("FTM_CONTROL/SET_PRESCALING", val);
    208224}
    209225
Note: See TracChangeset for help on using the changeset viewer.