source: trunk/FACT++/gui/MainWindow.cc@ 12650

Last change on this file since 12650 was 12528, checked in by tbretz, 13 years ago
Removed some obsolete fad commands; fixed some signal/slot names; some resizing
File size: 18.5 KB
Line 
1#include "MainWindow.h"
2
3#include <iostream>
4#include <sstream>
5
6#include <QTimer>
7
8#include "src/Dim.h"
9
10#include "DockWindow.h"
11#include "HtmlDelegate.h"
12#include "CheckBoxDelegate.h"
13
14using namespace std;
15
16void MainWindow::MakeLEDs(QPushButton **arr, QGridLayout *lay, const char *slot) const
17{
18 arr[0]->setToolTip("Crate 0, Board 0, Index 0");
19
20 for (int i=1; i<40; i++)
21 {
22 QPushButton *b = new QPushButton(static_cast<QWidget*>(arr[0]->parent()));
23
24 b->setEnabled(arr[0]->isEnabled());
25 b->setSizePolicy(arr[0]->sizePolicy());
26 b->setMaximumSize(arr[0]->maximumSize());
27 b->setIcon(arr[0]->icon());
28 b->setIconSize(arr[0]->iconSize());
29 b->setCheckable(arr[0]->isCheckable());
30 b->setFlat(arr[0]->isFlat());
31
32 ostringstream str;
33 str << "Crate " << i/10 << ", Board " << i%10 << ", Index " << i;
34 b->setToolTip(str.str().c_str());
35
36 lay->addWidget(b, i/10+1, i%10+1, 1, 1);
37
38 arr[i] = b;
39 }
40
41 const QString name = arr[0]->objectName();
42
43 for (int i=0; i<40; i++)
44 {
45 arr[i]->setObjectName(name+QString::number(i));
46 QObject::connect(arr[i], SIGNAL(clicked()), this, slot);
47 }
48}
49
50MainWindow::MainWindow(QWidget *p) : QMainWindow(p)
51{
52 // setupUi MUST be called before the DimNetwork is initilized
53 // In this way it can be ensured that nothing from the
54 // DimNetwork arrives before all graphical elements are
55 // initialized. This is a simple but very powerfull trick.
56 setupUi(this);
57
58 // Now here we can do further setup which should be done
59 // before the gui is finally displayed.
60 fDimCmdServers->setItemDelegate(new CheckBoxDelegate);
61 fDimCmdCommands->setItemDelegate(new CheckBoxDelegate);
62 fDimCmdDescription->setItemDelegate(new HtmlDelegate);
63
64 fDimSvcServers->setItemDelegate(new CheckBoxDelegate);
65 fDimSvcServices->setItemDelegate(new CheckBoxDelegate);
66 fDimSvcDescription->setItemDelegate(new HtmlDelegate);
67
68 // Set a default string to be displayed in a the status bar at startup
69 fStatusBar->showMessage(PACKAGE_STRING" | "PACKAGE_URL" | report bugs to <"PACKAGE_BUGREPORT">");
70
71 // Initialize the 40 FTU Leds as a copy of the prototype LED
72 fFtuLED[0] = fFtuLEDPrototype;
73 MakeLEDs(fFtuLED, fFtuLedLayout, SLOT(slot_fFtuLED_clicked()));
74
75 // Initialize the 40 FAD Leds as a copy of the prototype LED
76 fFadLED[0] = fFadLEDPrototype;
77 MakeLEDs(fFadLED, fFadLedLayout, SLOT(slot_fFadLED_clicked()));
78
79 // Initialize a timer to update the displayed UTC time
80 QTimer *timer = new QTimer(this);
81 connect(timer, SIGNAL(timeout()), this, SLOT(slot_TimeUpdate()));
82 timer->start(100);
83}
84
85void MainWindow::slot_TimeUpdate()
86{
87 // Used toUTC to support also older Qt versions
88 // toTime_t() always returns the datetime converted to UTC
89 // dateTime() unfortunately returns our UTC always as LocalTime
90 QDateTime now = QDateTime::currentDateTime().toUTC();
91 now.setTimeSpec(Qt::LocalTime);
92
93 if (now.toTime_t()==fUTC->dateTime().toTime_t())
94 return;
95
96 fUTC->setDateTime(now);
97}
98
99
100void MainWindow::SelectTab(const QString &name)
101{
102 for (int i=0; i<fTabWidget->count(); i++)
103 if (fTabWidget->tabText(i)==name)
104 {
105 fTabWidget->setCurrentIndex(i);
106 break;
107 }
108}
109
110void MainWindow::on_fNoutof4Val_valueChanged(int val)
111{
112 const uint32_t v[2] = { -1, val };
113
114 if (!fInHandler)
115 Dim::SendCommand("FTM_CONTROL/SET_N_OUT_OF_4", v);
116}
117
118void MainWindow::on_fRatesMin_valueChanged(int min)
119{
120 fRatesCanv->SetMin(min);
121}
122
123void MainWindow::on_fRatesMax_valueChanged(int max)
124{
125 fRatesCanv->SetMax(max);
126}
127
128void MainWindow::on_fShutdown_clicked()
129{
130 Dim::SendCommand("DIS_DNS/KILL_SERVERS");
131}
132
133void MainWindow::on_fShutdownAll_clicked()
134{
135 Dim::SendCommand("DIS_DNS/KILL_SERVERS");
136 Dim::SendCommand("DIS_DNS/EXIT", int(1));
137}
138
139void MainWindow::on_fTabWidget_tabCloseRequested(int which)
140{
141 // To get the correct size we have to switch to this tab
142 // An alternative would be to take the size of the current tab
143 fTabWidget->setCurrentIndex(which);
144
145 QWidget *w = fTabWidget->currentWidget(); //fTabWidget->widget(which);
146 if (!w)
147 {
148 cout << "Weird... the tab requested to be closed doesn't exist!" << endl;
149 return;
150 }
151
152 QDockWidget *d = w->findChild<QDockWidget*>();
153 if (!d)
154 {
155 cout << "Sorry, tab requested to be closed contains no QDockWidget!" << endl;
156 return;
157 }
158
159 new DockWindow(d, fTabWidget->tabText(which));
160 fTabWidget->removeTab(which);
161
162 if (fTabWidget->count()==1)
163 fTabWidget->setTabsClosable(false);
164}
165
166void MainWindow::on_fMcpStartRun_clicked()
167{
168 struct Value
169 {
170 uint64_t time;
171 uint64_t nevts;
172 char type[];
173 };
174
175 const int idx1 = fMcpRunType->currentIndex();
176 const int idx2 = fMcpTime->currentIndex();
177 const int idx3 = fMcpNumEvents->currentIndex();
178
179 const int64_t v2 = fMcpTime->itemData(idx2).toInt();
180 const int64_t v3 = fMcpNumEvents->itemData(idx3).toInt();
181
182 const QString rt = fMcpRunType->itemData(idx1).toString();
183
184 const size_t len = sizeof(Value)+rt.length()+1;
185
186 char *buf = new char[len];
187
188 Value *val = reinterpret_cast<Value*>(buf);
189
190 val->time = v2;
191 val->nevts = v3;
192
193 strcpy(val->type, rt.toStdString().c_str());
194
195 Dim::SendCommand("MCP/START", buf, len);
196
197 delete [] buf;
198
199}
200void MainWindow::on_fMcpStopRun_clicked()
201{
202 Dim::SendCommand("MCP/STOP");
203}
204
205void MainWindow::on_fMcpReset_clicked()
206{
207 Dim::SendCommand("MCP/RESET");
208}
209
210void MainWindow::on_fLoggerStart_clicked()
211{
212 Dim::SendCommand("DATA_LOGGER/START_RUN_LOGGING");
213}
214
215void MainWindow::on_fLoggerStop_clicked()
216{
217 Dim::SendCommand("DATA_LOGGER/STOP_RUN_LOGGING");
218}
219
220void MainWindow::on_fFtmStartRun_clicked()
221{
222 Dim::SendCommand("FTM_CONTROL/START_TRIGGER");
223}
224
225void MainWindow::on_fFtmStopRun_clicked()
226{
227 Dim::SendCommand("FTM_CONTROL/STOP_TRIGGER");
228}
229
230/*
231void MainWindow::on_fFadStartRun_clicked()
232{
233 Dim::SendCommand("FAD_CONTROL/START_RUN");
234}
235
236void MainWindow::on_fFadStopRun_clicked()
237{
238 Dim::SendCommand("FAD_CONTROL/STOP_RUN");
239}
240*/
241
242void MainWindow::on_fFadDrsOn_clicked()
243{
244 Dim::SendCommand("FAD_CONTROL/ENABLE_DRS", uint8_t(true));
245}
246
247void MainWindow::on_fFadDrsOff_clicked()
248{
249 Dim::SendCommand("FAD_CONTROL/ENABLE_DRS", uint8_t(false));
250}
251
252void MainWindow::on_fFadDwriteOn_clicked()
253{
254 Dim::SendCommand("FAD_CONTROL/ENABLE_DWRITE", uint8_t(true));
255}
256
257void MainWindow::on_fFadDwriteOff_clicked()
258{
259 Dim::SendCommand("FAD_CONTROL/ENABLE_DWRITE", uint8_t(false));
260}
261
262void MainWindow::on_fFadSingleTrigger_clicked()
263{
264 Dim::SendCommand("FAD_CONTROL/SEND_SINGLE_TRIGGER");
265}
266
267void MainWindow::on_fFadTriggerLineOn_clicked()
268{
269 Dim::SendCommand("FAD_CONTROL/ENABLE_TRIGGER_LINE", uint8_t(true));
270}
271
272void MainWindow::on_fFadTriggerLineOff_clicked()
273{
274 Dim::SendCommand("FAD_CONTROL/ENABLE_TRIGGER_LINE", uint8_t(false));
275}
276
277void MainWindow::on_fFadContTriggerOn_clicked()
278{
279 Dim::SendCommand("FAD_CONTROL/ENABLE_CONTINOUS_TRIGGER", uint8_t(true));
280}
281
282void MainWindow::on_fFadContTriggerOff_clicked()
283{
284 Dim::SendCommand("FAD_CONTROL/ENABLE_CONTINOUS_TRIGGER", uint8_t(false));
285}
286
287void MainWindow::on_fFadBusyOnOn_clicked()
288{
289 Dim::SendCommand("FAD_CONTROL/ENABLE_BUSY_ON", uint8_t(true));
290}
291
292void MainWindow::on_fFadBusyOnOff_clicked()
293{
294 Dim::SendCommand("FAD_CONTROL/ENABLE_BUSY_ON", uint8_t(false));
295}
296
297void MainWindow::on_fFadBusyOffOn_clicked()
298{
299 Dim::SendCommand("FAD_CONTROL/ENABLE_BUSY_OFF", uint8_t(true));
300}
301
302void MainWindow::on_fFadBusyOffOff_clicked()
303{
304 Dim::SendCommand("FAD_CONTROL/ENABLE_BUSY_OFF", uint8_t(false));
305}
306
307void MainWindow::on_fFadSocket0_clicked()
308{
309 Dim::SendCommand("FAD_CONTROL/ENABLE_COMMAND_SOCKET_MODE", uint8_t(true));
310}
311
312void MainWindow::on_fFadSocket17_clicked()
313{
314 Dim::SendCommand("FAD_CONTROL/ENABLE_COMMAND_SOCKET_MODE", uint8_t(false));
315}
316
317void MainWindow::on_fFadResetTriggerId_clicked()
318{
319 Dim::SendCommand("FAD_CONTROL/RESET_EVENT_COUNTER");
320}
321
322void MainWindow::FadSetFileFormat(uint16_t fmt)
323{
324 Dim::SendCommand("FAD_CONTROL/SET_FILE_FORMAT", fmt);
325}
326
327void MainWindow::on_fFadStart_clicked()
328{
329 Dim::SendCommand("FAD_CONTROL/START");
330}
331
332void MainWindow::on_fFadStop_clicked()
333{
334 Dim::SendCommand("FAD_CONTROL/STOP");
335}
336
337void MainWindow::on_fFadAbort_clicked()
338{
339 Dim::SendCommand("FAD_CONTROL/ABORT");
340}
341
342void MainWindow::on_fFadSoftReset_clicked()
343{
344 Dim::SendCommand("FAD_CONTROL/SOFT_RESET");
345}
346
347void MainWindow::on_fFadHardReset_clicked()
348{
349 Dim::SendCommand("FAD_CONTROL/HARD_RESET");
350}
351
352void MainWindow::slot_fFadLED_clicked()
353{
354 for (int32_t i=0; i<40; i++)
355 if (sender()==fFadLED[i])
356 {
357 Dim::SendCommand("FAD_CONTROL/TOGGLE", i);
358 break;
359 }
360}
361
362void MainWindow::on_fFadPrescalerCmd_valueChanged(int val)
363{
364 Dim::SendCommand("FAD_CONTROL/SET_TRIGGER_RATE", uint32_t(val));
365}
366
367void MainWindow::on_fFadRunNumberCmd_valueChanged(int val)
368{
369 Dim::SendCommand("FAD_CONTROL/SET_RUN_NUMBER", uint64_t(val));
370}
371
372void MainWindow::on_fFadRoiCmd_valueChanged(int)
373{
374 const int32_t vals1[2] = { -1, fFadRoiCmd->value() };
375 Dim::SendCommand("FAD_CONTROL/SET_REGION_OF_INTEREST", vals1);
376
377 for (int ch=8; ch<36; ch+=9)
378 {
379 const int32_t vals2[2] = { ch, fFadRoiCh9Cmd->value() };
380 Dim::SendCommand("FAD_CONTROL/SET_REGION_OF_INTEREST", vals2);
381 }
382}
383
384void MainWindow::FadDacCmd_valueChanged(uint16_t val, uint16_t idx)
385{
386 const uint32_t cmd[2] = { idx, val };
387 Dim::SendCommand("FAD_CONTROL/SET_DAC_VALUE", cmd);
388}
389
390void MainWindow::on_fDrsCalibStart_clicked()
391{
392 Dim::SendCommand("FAD_CONTROL/START_DRS_CALIBRATION");
393}
394
395void MainWindow::on_fDrsCalibReset_clicked()
396{
397 Dim::SendCommand("FAD_CONTROL/RESET_SECONDARY_DRS_BASELINE");
398}
399
400void MainWindow::SetTriggerSequence()
401{
402 const uint16_t d[3] =
403 {
404 uint16_t(fTriggerSeqPed->value()),
405 uint16_t(fTriggerSeqLPext->value()),
406 uint16_t(fTriggerSeqLPint->value())
407 };
408
409 if (!fInHandler)
410 Dim::SendCommand("FTM_CONTROL/SET_TRIGGER_SEQUENCE", d);
411}
412
413/*
414void MainWindow::on_fEnableTrigger_clicked(bool b)
415{
416 Dim::SendCommand("FTM_CONTROL/ENABLE_TRIGGER", b);
417}
418
419void MainWindow::on_fEnableExt1_clicked(bool b)
420{
421 Dim::SendCommand("FTM_CONTROL/ENABLE_EXT1", b);
422}
423
424void MainWindow::on_fEnableExt2_clicked(bool b)
425{
426 Dim::SendCommand("FTM_CONTROL/ENABLE_EXT2", b);
427}
428
429void MainWindow::on_fEnableVeto_clicked(bool b)
430{
431 Dim::SendCommand("FTM_CONTROL/ENABLE_VETO", b);
432}
433*/
434void MainWindow::on_fPhysicsCoincidence_valueChanged(int v)
435{
436 if (!fInHandler)
437 Dim::SendCommand("FTM_CONTROL/SET_TRIGGER_MULTIPLICITY", v);
438}
439
440void MainWindow::on_fPhysicsWindow_valueChanged(int v)
441{
442 if (!fInHandler)
443 Dim::SendCommand("FTM_CONTROL/SET_TRIGGER_WINDOW", v/4-2);
444}
445
446void MainWindow::on_fCalibCoincidence_valueChanged(int v)
447{
448 if (!fInHandler)
449 Dim::SendCommand("FTM_CONTROL/SET_CALIBRATION_MULTIPLICITY", v);
450}
451
452void MainWindow::on_fCalibWindow_valueChanged(int v)
453{
454 if (!fInHandler)
455 Dim::SendCommand("FTM_CONTROL/SET_CALIBRATION_WINDOW", v/4-2);
456}
457
458void MainWindow::on_fTriggerInterval_valueChanged(int val)
459{
460 if (!fInHandler)
461 Dim::SendCommand("FTM_CONTROL/SET_TRIGGER_INTERVAL", val);
462}
463
464void MainWindow::on_fTriggerDelay_valueChanged(int val)
465{
466 if (!fInHandler)
467 Dim::SendCommand("FTM_CONTROL/SET_TRIGGER_DELAY", val/4-2);
468}
469
470void MainWindow::on_fTimeMarkerDelay_valueChanged(int val)
471{
472 if (!fInHandler)
473 Dim::SendCommand("FTM_CONTROL/SET_TIME_MARKER_DELAY", val/4-2);
474}
475
476void MainWindow::on_fDeadTime_valueChanged(int val)
477{
478 if (!fInHandler)
479 Dim::SendCommand("FTM_CONTROL/SET_DEAD_TIME", val/4-2);
480}
481
482void MainWindow::on_fPrescalingVal_valueChanged(int val)
483{
484 if (!fInHandler)
485 Dim::SendCommand("FTM_CONTROL/SET_PRESCALING", val);
486}
487
488void MainWindow::on_fPixelEnableAll_clicked()
489{
490 Dim::SendCommand("FTM_CONTROL/ENABLE_PIXEL", int16_t(-1));
491}
492
493void MainWindow::on_fPixelDisableAll_clicked()
494{
495 Dim::SendCommand("FTM_CONTROL/DISABLE_PIXEL", int16_t(-1));
496}
497
498void MainWindow::on_fEnableTrigger_stateChanged(int b)
499{
500 if (!fInHandler)
501 Dim::SendCommand("FTM_CONTROL/ENABLE_TRIGGER", b==Qt::Checked);
502}
503
504void MainWindow::on_fEnableExt1_stateChanged(int b)
505{
506 if (!fInHandler)
507 Dim::SendCommand("FTM_CONTROL/ENABLE_EXT1", b==Qt::Checked);
508}
509
510void MainWindow::on_fEnableExt2_stateChanged(int b)
511{
512 if (!fInHandler)
513 Dim::SendCommand("FTM_CONTROL/ENABLE_EXT2", b==Qt::Checked);
514}
515
516void MainWindow::on_fEnableClockCond_stateChanged(int b)
517{
518 if (!fInHandler)
519 Dim::SendCommand("FTM_CONTROL/ENABLE_CLOCK_CONDITIONER", b==Qt::Checked);
520}
521
522void MainWindow::on_fEnableVeto_stateChanged(int b)
523{
524 if (!fInHandler)
525 Dim::SendCommand("FTM_CONTROL/ENABLE_VETO", b==Qt::Checked);
526}
527
528void MainWindow::on_fClockCondFreq_activated(int idx)
529{
530 if (!fInHandler)
531 Dim::SendCommand("FTM_CONTROL/SET_CLOCK_FREQUENCY", fClockCondFreq->itemData(idx).toInt());
532}
533
534void MainWindow::slot_fFtuLED_clicked()
535{
536 for (int32_t i=0; i<40; i++)
537 if (sender()==fFtuLED[i])
538 {
539 Dim::SendCommand("FTM_CONTROL/TOGGLE_FTU", i);
540 break;
541 }
542}
543
544void MainWindow::on_fFtuPing_toggled(bool checked)
545{
546 if (checked)
547 Dim::SendCommand("FTM_CONTROL/PING");
548}
549
550void MainWindow::on_fFtuAllOn_clicked()
551{
552 static const struct Data { int32_t id; char on; } __attribute__((__packed__)) d = { -1, 1 };
553 Dim::SendCommand("FTM_CONTROL/ENABLE_FTU", &d, sizeof(d));
554}
555
556void MainWindow::on_fFtuAllOff_clicked()
557{
558 static const struct Data { int32_t id; char on; } __attribute__((__packed__)) d = { -1, 0 };
559 Dim::SendCommand("FTM_CONTROL/ENABLE_FTU", &d, sizeof(d));
560}
561
562void MainWindow::on_fLpIntIntensity_valueChanged(int val)
563{
564 if (!fInHandler)
565 Dim::SendCommand("FTM_CONTROL/SET_INTENSITY_LPINT", uint16_t(val));
566}
567
568void MainWindow::on_fLpExtIntensity_valueChanged(int val)
569{
570 if (!fInHandler)
571 Dim::SendCommand("FTM_CONTROL/SET_INTENSITY_LPEXT", uint16_t(val));
572}
573
574void MainWindow::on_fLpIntGroup1_stateChanged(int b)
575{
576 if (!fInHandler)
577 Dim::SendCommand("FTM_CONTROL/ENABLE_GROUP1_LPINT", uint8_t(b));
578}
579
580void MainWindow::on_fLpExtGroup1_stateChanged(int b)
581{
582 if (!fInHandler)
583 Dim::SendCommand("FTM_CONTROL/ENABLE_GROUP1_LPEXT", uint8_t(b));
584}
585
586void MainWindow::on_fLpIntGroup2_stateChanged(int b)
587{
588 if (!fInHandler)
589 Dim::SendCommand("FTM_CONTROL/ENABLE_GROUP2_LPINT", uint8_t(b));
590}
591
592void MainWindow::on_fLpExtGroup2_stateChanged(int b)
593{
594 if (!fInHandler)
595 Dim::SendCommand("FTM_CONTROL/ENABLE_GROUP2_LPEXT", uint8_t(b));
596}
597
598void MainWindow::on_fFeedbackDevMin_valueChanged(int min)
599{
600 fFeedbackDevCam->SetMin(min);
601 fFeedbackDevCam->updateCamera();
602}
603
604void MainWindow::on_fFeedbackDevMax_valueChanged(int max)
605{
606 fFeedbackDevCam->SetMax(max);
607 fFeedbackDevCam->updateCamera();
608}
609
610void MainWindow::on_fFeedbackCmdMin_valueChanged(int min)
611{
612 fFeedbackCmdCam->SetMin(min);
613 fFeedbackCmdCam->updateCamera();
614}
615
616void MainWindow::on_fFeedbackCmdMax_valueChanged(int max)
617{
618 fFeedbackCmdCam->SetMax(max);
619 fFeedbackCmdCam->updateCamera();
620}
621
622void MainWindow::on_fFeedbackTempStart_clicked()
623{
624 Dim::SendCommand("FEEDBACK/START_TEMP_CONTROL",
625 (float)fFeedbackTempOffset->value());
626}
627
628void MainWindow::on_fFeedbackOutputEnable_clicked()
629{
630 Dim::SendCommand("FEEDBACK/ENABLE_OUTPUT", uint8_t(1));
631}
632
633void MainWindow::on_fFeedbackOutputDisable_clicked()
634{
635 Dim::SendCommand("FEEDBACK/ENABLE_OUTPUT", uint8_t(0));
636}
637
638void MainWindow::on_fFeedbackStop_clicked()
639{
640 Dim::SendCommand("FEEDBACK/STOP");
641}
642
643void MainWindow::on_fFeedbackCalibrate_clicked()
644{
645 Dim::SendCommand("FEEDBACK/CALIBRATE_CURRENTS");
646}
647
648void MainWindow::on_fBiasVoltDac_valueChanged(int val)
649{
650 fBiasVolt->setValue(val*90./4096);
651}
652
653void MainWindow::on_fBiasOffsetDac_valueChanged(int val)
654{
655 fBiasOffsetVolt->setValue(val*90./4096);
656}
657
658/*
659void MainWindow::on_fBiasRequestStatus_clicked()
660{
661 if (!fInHandler)
662 Dim::SendCommand("BIAS_CONTROL/REQUEST_STATUS");
663}
664*/
665
666void MainWindow::on_fBiasApplyReference_clicked()
667{
668 if (!fInHandler)
669 Dim::SendCommand("BIAS_CONTROL/SET_GLOBAL_GAPD_REFERENCE_VOLTAGE");
670}
671
672void MainWindow::on_fBiasApplyReferenceCh_clicked()
673{
674 if (!fInHandler)
675 Dim::SendCommand("BIAS_CONTROL/SET_CHANNEL_GAPD_REFERENCE_VOLTAGE",
676 uint16_t(fBiasHvBoard->value()*32+fBiasHvChannel->value()));
677}
678
679void MainWindow::on_fBiasSetToZero_clicked()
680{
681 if (!fInHandler)
682 Dim::SendCommand("BIAS_CONTROL/SET_ZERO_VOLTAGE");
683}
684
685void MainWindow::on_fBiasReset_clicked()
686{
687 if (!fInHandler)
688 Dim::SendCommand("BIAS_CONTROL/RESET_OVER_CURRENT_STATUS");
689}
690
691void MainWindow::on_fBiasAddOffset_clicked()
692{
693 if (fInHandler)
694 return;
695
696 if (fBiasOffsetDac->value()<0)
697 Dim::SendCommand("BIAS_CONTROL/DECREASE_GLOBAL_DAC", uint16_t(-fBiasOffsetDac->value()));
698 else
699 Dim::SendCommand("BIAS_CONTROL/INCREASE_GLOBAL_DAC", uint16_t(fBiasOffsetDac->value()));
700}
701
702void MainWindow::on_fBiasApplyOffset_clicked()
703{
704 if (!fInHandler)
705 Dim::SendCommand("BIAS_CONTROL/SET_GAPD_REFERENCE_OFFSET", float(fBiasOffsetDac->value()*90./4096));
706}
707
708void MainWindow::on_fBiasApply_clicked()
709{
710 const uint16_t cmd[2] =
711 {
712 uint16_t(fBiasHvBoard->value()*32+fBiasHvChannel->value()),
713 uint16_t(fBiasVoltDac->value())
714 };
715
716 if (!fInHandler)
717 Dim::SendCommand("BIAS_CONTROL/SET_CHANNEL_DAC", cmd);
718}
719void MainWindow::on_fBiasApplyGlobal_clicked()
720{
721 if (!fInHandler)
722 Dim::SendCommand("BIAS_CONTROL/SET_GLOBAL_DAC", uint16_t(fBiasVoltDac->value()));
723}
724
725void MainWindow::on_fBiasVoltMin_valueChanged(int min)
726{
727 fBiasCamV->SetMin(min);
728 fBiasCamV->updateCamera();
729}
730
731void MainWindow::on_fBiasVoltMax_valueChanged(int max)
732{
733 fBiasCamV->SetMax(max);
734 fBiasCamV->updateCamera();
735}
736
737void MainWindow::on_fBiasCurrentMin_valueChanged(int min)
738{
739 fBiasCamA->SetMin(min);
740 fBiasCamA->updateCamera();
741}
742
743void MainWindow::on_fBiasCurrentMax_valueChanged(int max)
744{
745 fBiasCamA->SetMax(max);
746 fBiasCamA->updateCamera();
747}
748
749void MainWindow::on_fChatSend_clicked()
750{
751 const string msg = fChatMessage->text().toStdString();
752 if (Dim::SendCommand("CHAT/MSG", msg.c_str(), msg.length()+1))
753 fChatMessage->clear();
754}
755
756void MainWindow::on_fStatusLoggerLed_clicked()
757{
758 SelectTab("Logger");
759}
760
761void MainWindow::on_fStatusChatLed_clicked()
762{
763 SelectTab("Chat");
764}
765
766void MainWindow::on_fStatusFTMLed_clicked()
767{
768 SelectTab("Trigger");
769}
770
771void MainWindow::on_fStatusFTULed_clicked()
772{
773 SelectTab("FTUs");
774}
775
776void MainWindow::on_fStatusFADLed_clicked()
777{
778 SelectTab("FAD");
779}
Note: See TracBrowser for help on using the repository browser.