summaryrefslogtreecommitdiffhomepage
path: root/gui
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-10-20 05:36:40 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-10-20 05:36:40 +0200
commit18b559ff13898e8e96275b7e329bfa23b7394f6f (patch)
tree5d22b7453992a96142c2e6a5e91289e50a377858 /gui
parentd1e7df336ce101a0fd9b05e4d3b2b8d49f6caa61 (diff)
spline: allow switch pitch mapping max Y 90/180
Diffstat (limited to 'gui')
-rw-r--r--gui/mapping-window.cpp42
-rw-r--r--gui/mapping-window.ui33
2 files changed, 61 insertions, 14 deletions
diff --git a/gui/mapping-window.cpp b/gui/mapping-window.cpp
index 127929fe..0726186a 100644
--- a/gui/mapping-window.cpp
+++ b/gui/mapping-window.cpp
@@ -56,12 +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, ui.max_yaw_rotation);
- tie_setting(s.a_pitch.clamp, ui.max_pitch_rotation);
- tie_setting(s.a_roll.clamp, ui.max_roll_rotation);
- tie_setting(s.a_x.clamp, ui.max_x_translation);
- tie_setting(s.a_y.clamp, ui.max_y_translation);
- tie_setting(s.a_z.clamp, ui.max_z_translation);
+ 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()
@@ -88,6 +90,9 @@ void MapWidget::load()
{ nullptr, Yaw, nullptr, false }
};
+ ui.max_pitch_output->setItemData(0, int(axis_opts::o_r180));
+ ui.max_pitch_output->setItemData(1, int(axis_opts::o_r90));
+
using a = axis_opts::max_clamp;
for (QComboBox* x : { ui.max_yaw_rotation, ui.max_pitch_rotation, ui.max_roll_rotation })
@@ -98,6 +103,8 @@ void MapWidget::load()
for (a y : { a::t30, a::t20, a::t15, a::t10, a::t100 })
x->addItem(QStringLiteral("%1 cm").arg(int(y)), y);
+ // XXX TODO add tie_setting overload for spline_widget!!! -sh 20171020
+
for (int i = 0; qfcs[i].qfc; i++)
{
const bool altp = qfcs[i].altp;
@@ -116,7 +123,7 @@ void MapWidget::load()
qfc.force_redraw();
}
- connect(&axis.opts.clamp, base_value::signal_fun<int>(),
+ connect(&axis.opts.clamp_x, base_value::signal_fun<int>(),
&qfc, [i, &conf, &qfc](int value) {
conf.set_max_input(value);
qfc.reload_spline();
@@ -133,11 +140,30 @@ void MapWidget::load()
// force signal to avoid duplicating the slot's logic
qfc.setConfig(&conf);
- axis.opts.clamp.valueChanged(axis.opts.clamp);
+ axis.opts.clamp_x.valueChanged(axis.opts.clamp_x);
widgets[i % 6][altp ? 1 : 0] = &qfc;
}
+ {
+ value<axis_opts::max_clamp>& val = s.a_pitch.clamp_y;
+
+ Map& axis = m(Pitch);
+
+ connect(&val, base_value::signal_fun<int>(), 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*)
diff --git a/gui/mapping-window.ui b/gui/mapping-window.ui
index c37c4b3e..7db6f425 100644
--- a/gui/mapping-window.ui
+++ b/gui/mapping-window.ui
@@ -67,7 +67,7 @@
</sizepolicy>
</property>
<property name="text">
- <string>Max rotation</string>
+ <string>Max input</string>
</property>
</widget>
</item>
@@ -141,7 +141,7 @@
</sizepolicy>
</property>
<property name="text">
- <string>Max rotation</string>
+ <string>Max input</string>
</property>
</widget>
</item>
@@ -155,6 +155,27 @@
</property>
</widget>
</item>
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Max output</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="max_pitch_output">
+ <item>
+ <property name="text">
+ <string>180°</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>90°</string>
+ </property>
+ </item>
+ </widget>
+ </item>
</layout>
</widget>
</item>
@@ -215,7 +236,7 @@
</sizepolicy>
</property>
<property name="text">
- <string>Max rotation</string>
+ <string>Max input</string>
</property>
</widget>
</item>
@@ -293,7 +314,7 @@
</sizepolicy>
</property>
<property name="text">
- <string>Max translation</string>
+ <string>Max input</string>
</property>
</widget>
</item>
@@ -367,7 +388,7 @@
</sizepolicy>
</property>
<property name="text">
- <string>Max translation</string>
+ <string>Max input</string>
</property>
</widget>
</item>
@@ -441,7 +462,7 @@
</sizepolicy>
</property>
<property name="text">
- <string>Max translation</string>
+ <string>Max input</string>
</property>
</widget>
</item>