DSRemote/timer_handlers.cpp

246 wiersze
4.2 KiB
C++
Czysty Zwykły widok Historia

/*
***************************************************************************
*
* Author: Teunis van Beelen
*
2023-02-08 20:22:28 +00:00
* Copyright (C) 2015 - 2023 Teunis van Beelen
*
2019-05-28 06:36:25 +00:00
* Email: teuniz@protonmail.com
*
***************************************************************************
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
***************************************************************************
*/
void UI_Mainwindow::test_timer_handler()
{
printf("scr_update_cntr is: %u\n", waveForm->scr_update_cntr);
waveForm->scr_update_cntr = 0;
}
2015-06-10 13:29:45 +00:00
void UI_Mainwindow::label_timer_handler()
{
waveForm->label_active = LABEL_ACTIVE_NONE;
}
void UI_Mainwindow::navDial_timer_handler()
{
if(navDial->isSliderDown() == true)
{
navDialChanged(navDial->value());
}
else
{
navDial->setSliderPosition(50);
2015-06-08 16:06:08 +00:00
navDialFunc = NAV_DIAL_FUNC_NONE;
2015-06-09 08:37:25 +00:00
if(adjdial_timer->isActive() == false)
{
adjDialFunc = ADJ_DIAL_FUNC_NONE;
}
}
}
void UI_Mainwindow::adjdial_timer_handler()
{
2015-06-09 08:37:25 +00:00
char str[512];
2015-06-05 15:43:27 +00:00
adjdial_timer->stop();
2015-06-05 15:43:27 +00:00
adjDialLabel->setStyleSheet(def_stylesh);
2015-06-05 15:43:27 +00:00
adjDialLabel->setStyleSheet("font: 7pt;");
2015-06-05 15:43:27 +00:00
adjDialLabel->setText("");
2015-06-09 08:37:25 +00:00
if(adjDialFunc == ADJ_DIAL_FUNC_HOLDOFF)
{
strlcpy(str, "Trigger holdoff: ", 512);
2015-06-09 08:37:25 +00:00
convert_to_metric_suffix(str + strlen(str), devparms.triggerholdoff, 2, 512 - strlen(str));
2015-06-09 08:37:25 +00:00
strlcat(str, "s", 512);
2015-06-09 08:37:25 +00:00
statusLabel->setText(str);
snprintf(str, 512, ":TRIG:HOLD %e", devparms.triggerholdoff);
2015-06-09 08:37:25 +00:00
set_cue_cmd(str);
2015-06-11 09:46:56 +00:00
if((devparms.modelserie == 2) || (devparms.modelserie == 6))
2015-06-11 09:46:56 +00:00
{
usleep(20000);
2017-10-15 16:43:43 +00:00
set_cue_cmd(":DISP:CLE");
}
else
{
usleep(20000);
set_cue_cmd(":CLE");
2015-06-11 09:46:56 +00:00
}
2015-06-09 08:37:25 +00:00
}
else if(adjDialFunc == ADJ_DIAL_FUNC_ACQ_AVG)
{
snprintf(str, 512, "Acquire averages: %i", devparms.acquireaverages);
2015-06-09 08:37:25 +00:00
statusLabel->setText(str);
snprintf(str, 512, ":ACQ:AVER %i", devparms.acquireaverages);
2015-06-09 08:37:25 +00:00
set_cue_cmd(str);
2015-06-09 08:37:25 +00:00
}
adjDialFunc = ADJ_DIAL_FUNC_NONE;
if(navDial_timer->isActive() == false)
{
navDialFunc = NAV_DIAL_FUNC_NONE;
}
}
void UI_Mainwindow::scrn_timer_handler()
{
2017-07-09 12:32:25 +00:00
if(pthread_mutex_trylock(&devparms.mutexx))
{
return;
}
scrn_thread->set_params(&devparms);
scrn_thread->start();
}
void UI_Mainwindow::horPosDial_timer_handler()
{
char str[512];
if(devparms.timebasedelayenable)
{
snprintf(str, 512, ":TIM:DEL:OFFS %e", devparms.timebasedelayoffset);
}
else
{
snprintf(str, 512, ":TIM:OFFS %e", devparms.timebaseoffset);
}
set_cue_cmd(str);
}
void UI_Mainwindow::trigAdjDial_timer_handler()
{
int chn;
char str[512];
chn = devparms.triggeredgesource;
if((chn < 0) || (chn > 3))
2015-06-03 18:16:59 +00:00
{
return;
2015-06-03 18:16:59 +00:00
}
snprintf(str, 512, ":TRIG:EDG:LEV %e", devparms.triggeredgelevel[chn]);
set_cue_cmd(str);
}
void UI_Mainwindow::vertOffsDial_timer_handler()
{
int chn;
char str[512];
2015-07-07 14:34:15 +00:00
if(devparms.activechannel < 0)
{
return;
}
chn = devparms.activechannel;
2015-07-07 14:34:15 +00:00
snprintf(str, 512, ":CHAN%i:OFFS %e", chn + 1, devparms.chanoffset[chn]);
2015-07-07 14:34:15 +00:00
set_cue_cmd(str);
}
2015-06-09 06:37:17 +00:00
2015-07-07 14:34:15 +00:00
void UI_Mainwindow::horScaleDial_timer_handler()
{
char str[512];
2015-07-07 14:34:15 +00:00
if(devparms.timebasedelayenable)
{
snprintf(str, 512, ":TIM:DEL:SCAL %e", devparms.timebasedelayscale);
}
else
{
snprintf(str, 512, ":TIM:SCAL %e", devparms.timebasescale);
}
set_cue_cmd(str);
}
2015-06-06 11:02:35 +00:00
void UI_Mainwindow::vertScaleDial_timer_handler()
{
int chn;
2015-06-09 08:37:25 +00:00
char str[512];
if(devparms.activechannel < 0)
2015-07-04 09:10:18 +00:00
{
return;
2015-07-04 09:10:18 +00:00
}
chn = devparms.activechannel;
2015-07-07 14:34:15 +00:00
snprintf(str, 512, ":CHAN%i:SCAL %e", chn + 1, devparms.chanscale[chn]);
set_cue_cmd(str);
}