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