Commit e13b3a0d authored by Michael Carpenter's avatar Michael Carpenter

Addition of INT8 and INT16 MAV_PARAM_TYPE handling of incoming messages

parent fa4c1e13
......@@ -35,6 +35,8 @@ typedef struct param_union {
uint32_t param_uint32;
uint8_t param_uint8;
uint8_t bytes[4];
int16_t param_int16;
int8_t param_int8;
};
uint8_t type;
} mavlink_param_union_t;
......
......@@ -904,6 +904,26 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
emit parameterChanged(uasId, message.compid, value.param_count, value.param_index, parameterName, param);
//qDebug() << "RECEIVED PARAM:" << param;
}
case MAV_PARAM_TYPE_INT8:
{
// Variant
QVariant param(val.param_int8);
parameters.value(component)->insert(parameterName, param);
// Emit change
emit parameterChanged(uasId, message.compid, parameterName, param);
emit parameterChanged(uasId, message.compid, value.param_count, value.param_index, parameterName, param);
//qDebug() << "RECEIVED PARAM:" << param;
}
case MAV_PARAM_TYPE_INT16:
{
// Variant
QVariant param(val.param_int16);
parameters.value(component)->insert(parameterName, param);
// Emit change
emit parameterChanged(uasId, message.compid, parameterName, param);
emit parameterChanged(uasId, message.compid, value.param_count, value.param_index, parameterName, param);
//qDebug() << "RECEIVED PARAM:" << param;
}
case MAV_PARAM_TYPE_UINT32:
{
// Variant
......@@ -2265,6 +2285,10 @@ void UAS::setParameter(const int component, const QString& id, const QVariant& v
// Assign correct value based on QVariant
switch (value.type())
{
case QVariant::Char:
union_value.param_int8 = value.toChar().toAscii();
p.param_type = MAV_PARAM_TYPE_INT8;
break;
case QVariant::Int:
union_value.param_int32 = value.toInt();
p.param_type = MAV_PARAM_TYPE_INT32;
......
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