From 39e209983bd1f04fb0beefef754d7430c8b7fb9f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 20 Oct 2017 17:53:21 +0200 Subject: logic, spline: more spline work/fixes - mapping window clamps are now value in spline - clamp won't mess up saved spline content - clean up artifacts on spline widget --- gui/mapping-window.cpp | 43 +++++++++++-------------------------------- 1 file changed, 11 insertions(+), 32 deletions(-) (limited to 'gui') diff --git a/gui/mapping-window.cpp b/gui/mapping-window.cpp index 0726186a..629bcd5b 100644 --- a/gui/mapping-window.cpp +++ b/gui/mapping-window.cpp @@ -56,14 +56,14 @@ MapWidget::MapWidget(Mappings& m) : m(m), widgets{} tie_setting(s.a_y.altp, ui.ty_altp); tie_setting(s.a_z.altp, ui.tz_altp); - tie_setting(s.a_yaw.clamp_x, ui.max_yaw_rotation); - tie_setting(s.a_pitch.clamp_x, ui.max_pitch_rotation); - tie_setting(s.a_roll.clamp_x, ui.max_roll_rotation); - tie_setting(s.a_x.clamp_x, ui.max_x_translation); - tie_setting(s.a_y.clamp_x, ui.max_y_translation); - tie_setting(s.a_z.clamp_x, ui.max_z_translation); - - tie_setting(s.a_pitch.clamp_y, ui.max_pitch_output); + tie_setting(s.a_yaw.clamp_x_, ui.max_yaw_rotation); + tie_setting(s.a_pitch.clamp_x_, ui.max_pitch_rotation); + tie_setting(s.a_roll.clamp_x_, ui.max_roll_rotation); + tie_setting(s.a_x.clamp_x_, ui.max_x_translation); + tie_setting(s.a_y.clamp_x_, ui.max_y_translation); + tie_setting(s.a_z.clamp_x_, ui.max_z_translation); + + tie_setting(s.a_pitch.clamp_y_, ui.max_pitch_output); } void MapWidget::load() @@ -123,10 +123,9 @@ void MapWidget::load() qfc.force_redraw(); } - connect(&axis.opts.clamp_x, base_value::signal_fun(), + connect(&axis.opts.clamp_x_, base_value::signal_fun(), &qfc, [i, &conf, &qfc](int value) { - conf.set_max_input(value); - qfc.reload_spline(); + //qfc.reload_spline(); qfc.set_x_step(value + 1e-2 >= 90 ? 10 : 5); if (i >= 3) @@ -140,30 +139,10 @@ void MapWidget::load() // force signal to avoid duplicating the slot's logic qfc.setConfig(&conf); - axis.opts.clamp_x.valueChanged(axis.opts.clamp_x); + axis.opts.clamp_x_.valueChanged(axis.opts.clamp_x_); widgets[i % 6][altp ? 1 : 0] = &qfc; } - - { - value& val = s.a_pitch.clamp_y; - - Map& axis = m(Pitch); - - connect(&val, base_value::signal_fun(), this, [&](int x) { - x = std::abs(x); - - spline* splines[] { &axis.spline_main, &axis.spline_alt }; - - for (spline* spl : splines) - spl->set_max_output(x); - - ui.ryconfig->setConfig(&axis.spline_main); - ui.ryconfig_alt->setConfig(&axis.spline_alt); - }); - - axis.opts.clamp_y.valueChanged(axis.opts.clamp_y); - } } void MapWidget::closeEvent(QCloseEvent*) -- cgit v1.2.3