Commit d1d7a920 authored by Thomas Gubler's avatar Thomas Gubler

rc2param: min and max value

parent cab3d7ba
Subproject commit c0a0dff2b36a97614208559a23a9804ab9f2e636
Subproject commit c96b64adc3ff126559366c445633f88252d53b2d
......@@ -3468,9 +3468,9 @@ void UAS::stopLowBattAlarm()
}
}
void UAS::sendMapRCToParam(QString param_id, float scale, float current_value, quint8 param_rc_channel_index)
void UAS::sendMapRCToParam(QString param_id, float scale, float value0, quint8 param_rc_channel_index, float valueMin, float valueMax)
{
qDebug() << "sendMapRCToParam" << param_id << "scale" << scale << "curval" << current_value << "param rc chan index" << param_rc_channel_index;
qDebug() << "sendMapRCToParam" << param_id << "scale" << scale << "value0" << value0 << "param rc chan index" << param_rc_channel_index;
mavlink_message_t message;
mavlink_msg_param_map_rc_pack(mavlink->getSystemId(),
......@@ -3481,11 +3481,14 @@ void UAS::sendMapRCToParam(QString param_id, float scale, float current_value, q
param_id.toStdString().c_str(),
-1,
param_rc_channel_index,
current_value,
scale);
value0,
scale,
valueMin,
valueMax);
sendMessage(message);
qDebug() << "Mavlink message sent";
}
void UAS::unsetRCToParameterMap()
{
qDebug() << "unsetRCToParameterMap";
......@@ -3500,8 +3503,9 @@ void UAS::unsetRCToParameterMap()
-2,
i,
0.0f,
0.0f,
0.0f,
0.0f);
sendMessage(message);
}
}
......@@ -885,7 +885,7 @@ public slots:
void triggerAction(int action);
/** @brief Send command to map a RC channel to a parameter */
void sendMapRCToParam(QString param_id, float scale, float current_value, quint8 param_rc_channel_index);
void sendMapRCToParam(QString param_id, float scale, float value0, quint8 param_rc_channel_index, float valueMin, float valueMax);
/** @brief Send command to disable all bindings/maps between RC and parameters */
void unsetRCToParameterMap();
......
......@@ -392,7 +392,7 @@ public slots:
float flow_comp_m_y, quint8 quality, float ground_distance) = 0;
/** @brief Send command to map a RC channel to a parameter */
virtual void sendMapRCToParam(QString param_id, float scale, float current_value, quint8 param_rc_channel_index) = 0;
virtual void sendMapRCToParam(QString param_id, float scale, float value0, quint8 param_rc_channel_index, float valueMin, float valueMax) = 0;
/** @brief Send command to disable all bindings/maps between RC and parameters */
virtual void unsetRCToParameterMap() = 0;
......
......@@ -67,7 +67,9 @@ void QGCMapRCToParamDialog::accept() {
emit mapRCToParamDialogResult(param_id,
(float)ui->scaleDoubleSpinBox->value(),
(float)ui->value0DoubleSpinBox->value(),
(quint8)ui->rcParamChannelComboBox->currentIndex());
(quint8)ui->rcParamChannelComboBox->currentIndex(),
(float)ui->minValueDoubleSpinBox->value(),
(float)ui->maxValueDoubleSpinBox->value());
QDialog::accept();
}
......
......@@ -76,8 +76,8 @@ public:
~QGCMapRCToParamDialog();
signals:
void mapRCToParamDialogResult(QString param_id, float scale, float current_value,
quint8 param_rc_channel_index);
void mapRCToParamDialogResult(QString param_id, float scale, float value0,
quint8 param_rc_channel_index, float valueMin, float valueMax);
void refreshParam();
public slots:
......
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<height>315</height>
</rect>
</property>
<property name="windowTitle">
......@@ -17,7 +17,7 @@
<property name="geometry">
<rect>
<x>30</x>
<y>240</y>
<y>280</y>
<width>341</width>
<height>32</height>
</rect>
......@@ -35,13 +35,59 @@
<x>9</x>
<y>9</y>
<width>381</width>
<height>231</height>
<height>271</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label1">
<property name="text">
<string>Bind</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="rcParamChannelInfoLabel">
<property name="text">
<string>RC-Parameter Channel (Knob No.)</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="rcParamChannelComboBox">
<property name="editable">
<bool>false</bool>
</property>
<property name="currentText">
<string>1</string>
</property>
<item>
<property name="text">
<string>1</string>
</property>
</item>
<item>
<property name="text">
<string>2</string>
</property>
</item>
<item>
<property name="text">
<string>3</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label2">
<property name="text">
<string>to</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="paramIdInfoLabel">
<property name="text">
......@@ -56,6 +102,13 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label3">
<property name="text">
<string>with</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="scaleInfoLabel">
<property name="text">
......@@ -85,69 +138,68 @@
<property name="decimals">
<number>8</number>
</property>
<property name="minimum">
<double>-100000.000000000000000</double>
</property>
<property name="maximum">
<double>100000.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="rcParamChannelInfoLabel">
<item row="7" column="0">
<widget class="QLabel" name="minInfoLabel">
<property name="text">
<string>RC-Parameter Channel (Knob No.)</string>
<string>Minimum Value</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="rcParamChannelComboBox">
<property name="editable">
<bool>false</bool>
<item row="7" column="1">
<widget class="QDoubleSpinBox" name="minValueDoubleSpinBox">
<property name="decimals">
<number>8</number>
</property>
<property name="currentText">
<string>1</string>
<property name="minimum">
<double>-100000.000000000000000</double>
</property>
<item>
<property name="text">
<string>1</string>
</property>
</item>
<item>
<property name="text">
<string>2</string>
</property>
</item>
<item>
<property name="text">
<string>3</string>
</property>
</item>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label1">
<property name="text">
<string>Bind</string>
<property name="maximum">
<double>100000.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label2">
<item row="8" column="0">
<widget class="QLabel" name="maxInfoLabel">
<property name="text">
<string>to</string>
<string>Maximum Value</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label3">
<property name="text">
<string>with</string>
<item row="8" column="1">
<widget class="QDoubleSpinBox" name="maxValueDoubleSpinBox">
<property name="decimals">
<number>8</number>
</property>
<property name="minimum">
<double>-10000.000000000000000</double>
</property>
<property name="maximum">
<double>100000.000000000000000</double>
</property>
<property name="singleStep">
<double>1.000000000000000</double>
</property>
<property name="value">
<double>10.000000000000000</double>
</property>
</widget>
</item>
<item row="8" column="0">
<item row="10" column="0">
<widget class="QLabel" name="infoLabel">
<property name="text">
<string>Waiting for parameter refresh,,,</string>
</property>
</widget>
</item>
<item row="7" column="0">
<item row="9" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment