Skip to content

Commit

Permalink
implemented missing repeat interval setting (requires latest libspnav)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtsiomb committed Jul 17, 2023
1 parent 4d0fd40 commit 7518e83
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/spnavcfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ int read_cfg(struct config *cfg)
}
}

cfg->repeat = spnav_cfg_get_repeat();

update_ui();
return 0;
}
22 changes: 21 additions & 1 deletion src/ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ bool MainWin::init()
connect(ui->ed_serpath, SIGNAL(editingFinished()), this, SLOT(serpath_changed()));
connect(ui->chk_serial, SIGNAL(stateChanged(int)), this, SLOT(chk_changed(int)));

connect(ui->chk_repeat, SIGNAL(stateChanged(int)), this, SLOT(chk_changed(int)));
connect(ui->spin_repeat, SIGNAL(valueChanged(int)), this, SLOT(spin_changed(int)));

/*
connect(ui->bn_loaddef, SIGNAL(clicked()), this, SLOT(bn_clicked()));
connect(ui->bn_loadcfg, SIGNAL(clicked()), this, SLOT(bn_clicked()));
Expand Down Expand Up @@ -219,7 +222,7 @@ void MainWin::updateui()
} else {
ui->chk_serial->setChecked(false);
}
if(cfg.repeat > 0) {
if(cfg.repeat >= 0) {
ui->chk_repeat->setChecked(true);
ui->spin_repeat->setValue(cfg.repeat);
} else {
Expand Down Expand Up @@ -457,6 +460,13 @@ void MainWin::spin_changed(int val)
if(mask_events) return;

QObject *src = QObject::sender();

if(src == ui->spin_repeat) {
cfg.repeat = ui->spin_repeat->value();
spnav_cfg_set_repeat(cfg.repeat);
return;
}

if(src == ui->spin_dead) {
for(int i=0; i<devinfo.naxes; i++) {
if(cfg.dead_thres[i] != val) {
Expand Down Expand Up @@ -492,6 +502,16 @@ void MainWin::chk_changed(int checked)
free(cfg.serdev);
cfg.serdev = 0;
spnav_cfg_set_serial(cfg.serdev);
return;
}

if(src == ui->chk_repeat) {
if(checked) {
cfg.repeat = ui->spin_repeat->value();
} else {
cfg.repeat = -1;
}
spnav_cfg_set_repeat(cfg.repeat);
}

if(src == ui->chk_swapyz) {
Expand Down

0 comments on commit 7518e83

Please sign in to comment.