mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-03 20:29:15 +01:00
Merge branch 'next' into test2
Conflicts: ground/openpilotgcs/src/plugins/config/configrevowidget.cpp ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.cpp ground/openpilotgcs/src/plugins/uavobjects/uavobjecttemplate.m
This commit is contained in:
commit
386a9d41ef
@ -33,16 +33,23 @@ OUTDIR := $(TOP)/build/$(TARGET)
|
|||||||
.PHONY: bin
|
.PHONY: bin
|
||||||
bin: $(OUTDIR)/$(TARGET).bin
|
bin: $(OUTDIR)/$(TARGET).bin
|
||||||
|
|
||||||
FW_PAD = $(shell echo $$[$(FW_BANK_BASE)-$(BL_BANK_BASE)-$(BL_BANK_SIZE)])
|
FW_PRE_PAD = $(shell echo $$[$(FW_BANK_BASE)-$(BL_BANK_BASE)-$(BL_BANK_SIZE)])
|
||||||
$(OUTDIR)/$(TARGET).pad:
|
$(OUTDIR)/$(TARGET).fw_pre.pad:
|
||||||
$(V0) @echo $(MSG_PADDING) $@
|
$(V0) @echo $(MSG_PADDING) $@
|
||||||
$(V1) dd status=noxfer if=/dev/zero count=$(FW_PAD) bs=1 2>/dev/null | tr '\000' '\377' > $@
|
$(V1) dd status=noxfer if=/dev/zero count=$(FW_PRE_PAD) bs=1 2>/dev/null | tr '\000' '\377' > $@
|
||||||
|
|
||||||
|
FW_POST_PAD = $(shell echo $$[$(FW_BANK_SIZE)-$(FW_DESC_SIZE)-$$(stat -c%s $(FW_BIN))])
|
||||||
|
$(OUTDIR)/$(TARGET).fw_post.pad:
|
||||||
|
$(V0) @echo $(MSG_PADDING) $@
|
||||||
|
$(V1) dd status=noxfer if=/dev/zero count=$(FW_POST_PAD) bs=1 2>/dev/null | tr '\000' '\377' > $@
|
||||||
|
|
||||||
|
|
||||||
BL_BIN = $(TOP)/build/bl_$(BOARD_NAME)/bl_$(BOARD_NAME).bin
|
BL_BIN = $(TOP)/build/bl_$(BOARD_NAME)/bl_$(BOARD_NAME).bin
|
||||||
FW_BIN = $(TOP)/build/fw_$(BOARD_NAME)/fw_$(BOARD_NAME).bin
|
FW_BIN = $(TOP)/build/fw_$(BOARD_NAME)/fw_$(BOARD_NAME).bin
|
||||||
$(OUTDIR)/$(TARGET).bin: $(BL_BIN) $(FW_BIN) $(OUTDIR)/$(TARGET).pad
|
FWINFO_BIN = $(FW_BIN).firmwareinfo.bin
|
||||||
|
$(OUTDIR)/$(TARGET).bin: $(BL_BIN) $(FW_BIN) $(OUTDIR)/$(TARGET).fw_pre.pad $(OUTDIR)/$(TARGET).fw_post.pad
|
||||||
$(V0) @echo $(MSG_FLASH_IMG) $@
|
$(V0) @echo $(MSG_FLASH_IMG) $@
|
||||||
$(V1) cat $(BL_BIN) $(OUTDIR)/$(TARGET).pad $(FW_BIN) > $@
|
$(V1) cat $(BL_BIN) $(OUTDIR)/$(TARGET).fw_pre.pad $(FW_BIN) $(OUTDIR)/$(TARGET).fw_post.pad $(FWINFO_BIN) > $@
|
||||||
|
|
||||||
.PHONY: dfu
|
.PHONY: dfu
|
||||||
dfu: $(OUTDIR)/$(TARGET).bin
|
dfu: $(OUTDIR)/$(TARGET).bin
|
||||||
|
@ -420,6 +420,10 @@ static int32_t updateSensorsCC3D(AccelsData * accelsData, GyrosData * gyrosData)
|
|||||||
gyrosData->z += gyro_correct_int[2];
|
gyrosData->z += gyro_correct_int[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Because most crafts wont get enough information from gravity to zero yaw gyro, we try
|
||||||
|
// and make it average zero (weakly)
|
||||||
|
gyro_correct_int[2] += - gyrosData->z * yawBiasRate;
|
||||||
|
|
||||||
GyrosSet(gyrosData);
|
GyrosSet(gyrosData);
|
||||||
AccelsSet(accelsData);
|
AccelsSet(accelsData);
|
||||||
|
|
||||||
|
@ -75,6 +75,7 @@ SECTIONS
|
|||||||
{
|
{
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
KEEP(*(.boardinfo))
|
KEEP(*(.boardinfo))
|
||||||
|
. = ALIGN(ORIGIN(BD_INFO)+LENGTH(BD_INFO));
|
||||||
} > BD_INFO
|
} > BD_INFO
|
||||||
|
|
||||||
/* Stabs debugging sections. */
|
/* Stabs debugging sections. */
|
||||||
|
@ -43,6 +43,8 @@ namespace core {
|
|||||||
LanguageStr=LanguageType().toShortString(Language);
|
LanguageStr=LanguageType().toShortString(Language);
|
||||||
Cache::Instance();
|
Cache::Instance();
|
||||||
|
|
||||||
|
// OPMaps::MemoryCache();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,6 +91,7 @@ Size PlateCarreeProjection::GetTileMatrixMaxXY(const int &zoom)
|
|||||||
|
|
||||||
Size PlateCarreeProjection::GetTileMatrixMinXY(const int &zoom)
|
Size PlateCarreeProjection::GetTileMatrixMinXY(const int &zoom)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(zoom);
|
||||||
return Size(0, 0);
|
return Size(0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,6 +90,7 @@ Size PlateCarreeProjectionPergo::GetTileMatrixMaxXY(const int &zoom)
|
|||||||
|
|
||||||
Size PlateCarreeProjectionPergo::GetTileMatrixMinXY(const int &zoom)
|
Size PlateCarreeProjectionPergo::GetTileMatrixMinXY(const int &zoom)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(zoom)
|
||||||
return Size(0, 0);
|
return Size(0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
namespace mapcontrol
|
namespace mapcontrol
|
||||||
{
|
{
|
||||||
HomeItem::HomeItem(MapGraphicItem* map,OPMapWidget* parent):safe(true),map(map),mapwidget(parent),
|
HomeItem::HomeItem(MapGraphicItem* map,OPMapWidget* parent):safe(true),map(map),mapwidget(parent),
|
||||||
showsafearea(true),safearea(1000),altitude(0),isDragging(false),toggleRefresh(true)
|
showsafearea(true),toggleRefresh(true),safearea(1000),altitude(0),isDragging(false)
|
||||||
{
|
{
|
||||||
pic.load(QString::fromUtf8(":/markers/images/home2.svg"));
|
pic.load(QString::fromUtf8(":/markers/images/home2.svg"));
|
||||||
pic=pic.scaled(30,30,Qt::IgnoreAspectRatio);
|
pic=pic.scaled(30,30,Qt::IgnoreAspectRatio);
|
||||||
|
@ -34,7 +34,7 @@ namespace mapcontrol
|
|||||||
{
|
{
|
||||||
|
|
||||||
OPMapWidget::OPMapWidget(QWidget *parent, Configuration *config):QGraphicsView(parent),configuration(config),UAV(0),GPS(0),Home(0)
|
OPMapWidget::OPMapWidget(QWidget *parent, Configuration *config):QGraphicsView(parent),configuration(config),UAV(0),GPS(0),Home(0)
|
||||||
,followmouse(true),compass(0),showuav(false),showhome(false),showDiag(false),diagGraphItem(0),diagTimer(0),overlayOpacity(1)
|
,followmouse(true),compass(0),showuav(false),showhome(false),diagTimer(0),diagGraphItem(0),showDiag(false),overlayOpacity(1)
|
||||||
{
|
{
|
||||||
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||||
core=new internals::Core;
|
core=new internals::Core;
|
||||||
@ -392,7 +392,6 @@ namespace mapcontrol
|
|||||||
}
|
}
|
||||||
void OPMapWidget::WPDeleteAll()
|
void OPMapWidget::WPDeleteAll()
|
||||||
{
|
{
|
||||||
int x=0;
|
|
||||||
foreach(QGraphicsItem* i,map->childItems())
|
foreach(QGraphicsItem* i,map->childItems())
|
||||||
{
|
{
|
||||||
WayPointItem* w=qgraphicsitem_cast<WayPointItem*>(i);
|
WayPointItem* w=qgraphicsitem_cast<WayPointItem*>(i);
|
||||||
@ -419,7 +418,9 @@ namespace mapcontrol
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPMapWidget::deleteAllOverlays()
|
void OPMapWidget::deleteAllOverlays()
|
||||||
{
|
{
|
||||||
foreach(QGraphicsItem* i,map->childItems())
|
foreach(QGraphicsItem* i,map->childItems())
|
||||||
|
@ -37,6 +37,9 @@ TrailItem::TrailItem(internals::PointLatLng const& coord,int const& altitude, QB
|
|||||||
|
|
||||||
void TrailItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
void TrailItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(option);
|
||||||
|
Q_UNUSED(widget);
|
||||||
|
|
||||||
painter->setBrush(m_brush);
|
painter->setBrush(m_brush);
|
||||||
painter->drawEllipse(-2,-2,4,4);
|
painter->drawEllipse(-2,-2,4,4);
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,9 @@ int WayPointCircle::type() const
|
|||||||
|
|
||||||
void WayPointCircle::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
void WayPointCircle::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(option);
|
||||||
|
Q_UNUSED(widget);
|
||||||
|
|
||||||
QPointF p1;
|
QPointF p1;
|
||||||
QPointF p2;
|
QPointF p2;
|
||||||
p1=QPointF(line.p1().x(),line.p1().y()+line.length());
|
p1=QPointF(line.p1().x(),line.p1().y()+line.length());
|
||||||
|
@ -75,6 +75,8 @@ QPainterPath WayPointLine::shape() const
|
|||||||
}
|
}
|
||||||
void WayPointLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
void WayPointLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(option);
|
||||||
|
Q_UNUSED(widget);
|
||||||
|
|
||||||
QPen myPen = pen();
|
QPen myPen = pen();
|
||||||
myPen.setColor(myColor);
|
myPen.setColor(myColor);
|
||||||
|
@ -492,7 +492,7 @@ QString QScienceSpinBox::stripped(const QString &t, int *pos) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// reimplemented function, copied from qspinbox.cpp
|
// reimplemented function, copied from qspinbox.cpp
|
||||||
static bool isIntermediateValueHelper(qint64 num, qint64 min, qint64 max, qint64 *match)
|
bool QScienceSpinBox::isIntermediateValueHelper(qint64 num, qint64 min, qint64 max, qint64 *match)
|
||||||
{
|
{
|
||||||
QSBDEBUG("%lld %lld %lld", num, min, max);
|
QSBDEBUG("%lld %lld %lld", num, min, max);
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
|
|
||||||
static bool isIntermediateValueHelper(qint64 num, qint64 minimum, qint64 maximum, qint64 *match = 0);
|
|
||||||
|
|
||||||
class QScienceSpinBox : public QDoubleSpinBox
|
class QScienceSpinBox : public QDoubleSpinBox
|
||||||
{
|
{
|
||||||
@ -24,6 +23,7 @@ public:
|
|||||||
|
|
||||||
QString textFromValue ( double value ) const;
|
QString textFromValue ( double value ) const;
|
||||||
double valueFromText ( const QString & text ) const;
|
double valueFromText ( const QString & text ) const;
|
||||||
|
static bool isIntermediateValueHelper(qint64 num, qint64 minimum, qint64 maximum, qint64 *match = 0);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int dispDecimals;
|
int dispDecimals;
|
||||||
|
@ -114,6 +114,8 @@ void MyTabbedStackWidget::showWidget(int index)
|
|||||||
|
|
||||||
void MyTabbedStackWidget::insertCornerWidget(int index, QWidget *widget)
|
void MyTabbedStackWidget::insertCornerWidget(int index, QWidget *widget)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(index);
|
||||||
|
|
||||||
widget->hide();
|
widget->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,6 +218,7 @@ ConfigCcpmWidget::~ConfigCcpmWidget()
|
|||||||
|
|
||||||
void ConfigCcpmWidget::setupUI(QString frameType)
|
void ConfigCcpmWidget::setupUI(QString frameType)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(frameType);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigCcpmWidget::ResetActuators(GUIConfigDataUnion* configData)
|
void ConfigCcpmWidget::ResetActuators(GUIConfigDataUnion* configData)
|
||||||
|
@ -291,7 +291,7 @@ bool ConfigFixedWingWidget::setupFrameFixedWing(QString airframeType)
|
|||||||
|
|
||||||
int channel;
|
int channel;
|
||||||
//disable all
|
//disable all
|
||||||
for (channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++)
|
for (channel=0; (unsigned int) channel < VehicleConfig::CHANNEL_NUMELEM; channel++)
|
||||||
{
|
{
|
||||||
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
|
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
|
||||||
resetMixerVector(mixer, channel);
|
resetMixerVector(mixer, channel);
|
||||||
@ -371,7 +371,7 @@ bool ConfigFixedWingWidget::setupFrameElevon(QString airframeType)
|
|||||||
int channel;
|
int channel;
|
||||||
double value;
|
double value;
|
||||||
//disable all
|
//disable all
|
||||||
for (channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++)
|
for (channel=0; (unsigned int) channel < VehicleConfig::CHANNEL_NUMELEM; channel++)
|
||||||
{
|
{
|
||||||
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
|
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
|
||||||
resetMixerVector(mixer, channel);
|
resetMixerVector(mixer, channel);
|
||||||
@ -449,7 +449,7 @@ bool ConfigFixedWingWidget::setupFrameVtail(QString airframeType)
|
|||||||
int channel;
|
int channel;
|
||||||
double value;
|
double value;
|
||||||
//disable all
|
//disable all
|
||||||
for (channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++)
|
for (channel=0; (unsigned int) channel < VehicleConfig::CHANNEL_NUMELEM; channel++)
|
||||||
{
|
{
|
||||||
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
|
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
|
||||||
resetMixerVector(mixer, channel);
|
resetMixerVector(mixer, channel);
|
||||||
|
@ -239,7 +239,7 @@ QString ConfigGroundVehicleWidget::updateConfigObjectsFromWidgets()
|
|||||||
void ConfigGroundVehicleWidget::refreshWidgetsValues(QString frameType)
|
void ConfigGroundVehicleWidget::refreshWidgetsValues(QString frameType)
|
||||||
{
|
{
|
||||||
UAVDataObject* obj;
|
UAVDataObject* obj;
|
||||||
UAVObjectField *field;
|
// UAVObjectField *field;
|
||||||
|
|
||||||
GUIConfigDataUnion config = GetConfigData();
|
GUIConfigDataUnion config = GetConfigData();
|
||||||
|
|
||||||
@ -307,7 +307,7 @@ bool ConfigGroundVehicleWidget::setupGroundVehicleMotorcycle(QString airframeTyp
|
|||||||
|
|
||||||
int channel;
|
int channel;
|
||||||
//disable all
|
//disable all
|
||||||
for (channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++) {
|
for (channel=0; (unsigned int) channel < VehicleConfig::CHANNEL_NUMELEM; channel++) {
|
||||||
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
|
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
|
||||||
resetMixerVector(mixer, channel);
|
resetMixerVector(mixer, channel);
|
||||||
}
|
}
|
||||||
@ -364,7 +364,7 @@ bool ConfigGroundVehicleWidget::setupGroundVehicleDifferential(QString airframeT
|
|||||||
|
|
||||||
int channel;
|
int channel;
|
||||||
//disable all
|
//disable all
|
||||||
for (channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++) {
|
for (channel=0; (unsigned int) channel < VehicleConfig::CHANNEL_NUMELEM; channel++) {
|
||||||
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
|
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
|
||||||
resetMixerVector(mixer, channel);
|
resetMixerVector(mixer, channel);
|
||||||
}
|
}
|
||||||
@ -419,7 +419,7 @@ bool ConfigGroundVehicleWidget::setupGroundVehicleCar(QString airframeType)
|
|||||||
|
|
||||||
int channel;
|
int channel;
|
||||||
//disable all
|
//disable all
|
||||||
for (channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++) {
|
for (channel=0; (unsigned int) channel < VehicleConfig::CHANNEL_NUMELEM; channel++) {
|
||||||
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
|
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
|
||||||
resetMixerVector(mixer, channel);
|
resetMixerVector(mixer, channel);
|
||||||
}
|
}
|
||||||
|
@ -971,7 +971,7 @@ bool ConfigMultiRotorWidget::setupMultiRotorMixer(double mixerFactors[8][3])
|
|||||||
Q_ASSERT(mixer);
|
Q_ASSERT(mixer);
|
||||||
|
|
||||||
//disable all
|
//disable all
|
||||||
for (int channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++)
|
for (unsigned int channel=0; channel < VehicleConfig::CHANNEL_NUMELEM; channel++)
|
||||||
{
|
{
|
||||||
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
|
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
|
||||||
resetMixerVector(mixer, channel);
|
resetMixerVector(mixer, channel);
|
||||||
|
@ -112,7 +112,9 @@ void VehicleConfig::SetConfigData(GUIConfigDataUnion configData) {
|
|||||||
|
|
||||||
void VehicleConfig::ResetActuators(GUIConfigDataUnion* configData)
|
void VehicleConfig::ResetActuators(GUIConfigDataUnion* configData)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(configData);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList VehicleConfig::getChannelDescriptions()
|
QStringList VehicleConfig::getChannelDescriptions()
|
||||||
{
|
{
|
||||||
QStringList channelDesc;
|
QStringList channelDesc;
|
||||||
|
@ -218,6 +218,8 @@ void ConfigGadgetWidget::tabAboutToChange(int i,bool * proceed)
|
|||||||
*/
|
*/
|
||||||
void ConfigGadgetWidget::updatePipXStatus(UAVObject *)
|
void ConfigGadgetWidget::updatePipXStatus(UAVObject *)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(object);
|
||||||
|
|
||||||
// Restart the disconnection timer.
|
// Restart the disconnection timer.
|
||||||
pipxTimeout->start(5000);
|
pipxTimeout->start(5000);
|
||||||
if (!pipxConnected)
|
if (!pipxConnected)
|
||||||
|
@ -1268,7 +1268,7 @@ void ConfigInputWidget::simpleCalibration(bool enable)
|
|||||||
|
|
||||||
restoreMdata();
|
restoreMdata();
|
||||||
|
|
||||||
for (int i = 0; i < ManualControlCommand::CHANNEL_NUMELEM; i++)
|
for (unsigned int i = 0; i < ManualControlCommand::CHANNEL_NUMELEM; i++)
|
||||||
manualSettingsData.ChannelNeutral[i] = manualCommandData.Channel[i];
|
manualSettingsData.ChannelNeutral[i] = manualCommandData.Channel[i];
|
||||||
|
|
||||||
// Force flight mode neutral to middle
|
// Force flight mode neutral to middle
|
||||||
|
@ -231,7 +231,7 @@ void ConfigOutputWidget::refreshWidgetsValues(UAVObject * obj)
|
|||||||
{
|
{
|
||||||
Q_UNUSED(obj);
|
Q_UNUSED(obj);
|
||||||
|
|
||||||
bool dirty=isDirty();
|
// bool dirty=isDirty();
|
||||||
|
|
||||||
// Get Actuator Settings
|
// Get Actuator Settings
|
||||||
ActuatorSettings *actuatorSettings = ActuatorSettings::GetInstance(getObjectManager());
|
ActuatorSettings *actuatorSettings = ActuatorSettings::GetInstance(getObjectManager());
|
||||||
|
@ -266,6 +266,8 @@ void ConfigPipXtremeWidget::updateStatus(UAVObject *object)
|
|||||||
*/
|
*/
|
||||||
void ConfigPipXtremeWidget::updateSettings(UAVObject *object)
|
void ConfigPipXtremeWidget::updateSettings(UAVObject *object)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(object);
|
||||||
|
|
||||||
if (!settingsUpdated)
|
if (!settingsUpdated)
|
||||||
{
|
{
|
||||||
settingsUpdated = true;
|
settingsUpdated = true;
|
||||||
|
@ -74,9 +74,9 @@ public:
|
|||||||
ConfigRevoWidget::ConfigRevoWidget(QWidget *parent) :
|
ConfigRevoWidget::ConfigRevoWidget(QWidget *parent) :
|
||||||
ConfigTaskWidget(parent),
|
ConfigTaskWidget(parent),
|
||||||
collectingData(false),
|
collectingData(false),
|
||||||
|
m_ui(new Ui_RevoSensorsWidget()),
|
||||||
position(-1)
|
position(-1)
|
||||||
{
|
{
|
||||||
m_ui = new Ui_RevoSensorsWidget();
|
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
// Initialization of the Paper plane widget
|
// Initialization of the Paper plane widget
|
||||||
|
@ -109,7 +109,7 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi
|
|||||||
|
|
||||||
//Generate lists of mixerTypeNames, mixerVectorNames, channelNames
|
//Generate lists of mixerTypeNames, mixerVectorNames, channelNames
|
||||||
channelNames << "None";
|
channelNames << "None";
|
||||||
for (int i = 0; i < ActuatorSettings::CHANNELADDR_NUMELEM; i++) {
|
for (unsigned int i = 0; i < ActuatorSettings::CHANNELADDR_NUMELEM; i++) {
|
||||||
|
|
||||||
mixerTypes << QString("Mixer%1Type").arg(i+1);
|
mixerTypes << QString("Mixer%1Type").arg(i+1);
|
||||||
mixerVectors << QString("Mixer%1Vector").arg(i+1);
|
mixerVectors << QString("Mixer%1Vector").arg(i+1);
|
||||||
|
@ -84,6 +84,8 @@ void ModeManager::init()
|
|||||||
|
|
||||||
void ModeManager::addWidget(QWidget *widget)
|
void ModeManager::addWidget(QWidget *widget)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(widget);
|
||||||
|
|
||||||
// We want the actionbar to stay on the bottom
|
// We want the actionbar to stay on the bottom
|
||||||
// so m_modeStack->cornerWidgetCount() -1 inserts it at the position immediately above
|
// so m_modeStack->cornerWidgetCount() -1 inserts it at the position immediately above
|
||||||
// the actionbar
|
// the actionbar
|
||||||
@ -220,6 +222,8 @@ void ModeManager::aboutToRemoveObject(QObject *obj)
|
|||||||
|
|
||||||
void ModeManager::addAction(Command *command, int priority, QMenu *menu)
|
void ModeManager::addAction(Command *command, int priority, QMenu *menu)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(menu);
|
||||||
|
|
||||||
m_actions.insert(command, priority);
|
m_actions.insert(command, priority);
|
||||||
|
|
||||||
// Count the number of commands with a higher priority
|
// Count the number of commands with a higher priority
|
||||||
|
@ -198,6 +198,8 @@ void GCSControlGadget::sticksChangedLocally(double leftX, double leftY, double r
|
|||||||
|
|
||||||
void GCSControlGadget::gamepads(quint8 count)
|
void GCSControlGadget::gamepads(quint8 count)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(count);
|
||||||
|
|
||||||
// sdlGamepad.setGamepad(0);
|
// sdlGamepad.setGamepad(0);
|
||||||
// sdlGamepad.setTickRate(JOYSTICK_UPDATE_RATE);
|
// sdlGamepad.setTickRate(JOYSTICK_UPDATE_RATE);
|
||||||
}
|
}
|
||||||
@ -291,7 +293,7 @@ double GCSControlGadget::constrain(double value)
|
|||||||
|
|
||||||
void GCSControlGadget::buttonState(ButtonNumber number, bool pressed)
|
void GCSControlGadget::buttonState(ButtonNumber number, bool pressed)
|
||||||
{
|
{
|
||||||
int state;
|
// int state;
|
||||||
if ((buttonSettings[number].ActionID>0)&&(buttonSettings[number].FunctionID>0)&&(pressed))
|
if ((buttonSettings[number].ActionID>0)&&(buttonSettings[number].FunctionID>0)&&(pressed))
|
||||||
{//this button is configured
|
{//this button is configured
|
||||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||||
|
@ -71,6 +71,8 @@ void GCSControlGadgetOptionsPage::buttonState(ButtonNumber number, bool pressed)
|
|||||||
|
|
||||||
void GCSControlGadgetOptionsPage::gamepads(quint8 count)
|
void GCSControlGadgetOptionsPage::gamepads(quint8 count)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(count);
|
||||||
|
|
||||||
/*options_page->AvailableControllerList->clear();
|
/*options_page->AvailableControllerList->clear();
|
||||||
for (int i=0;i<count;i++)
|
for (int i=0;i<count;i++)
|
||||||
{
|
{
|
||||||
@ -105,6 +107,8 @@ void GCSControlGadgetOptionsPage::axesValues(QListInt16 values)
|
|||||||
//creates options page widget (uses the UI file)
|
//creates options page widget (uses the UI file)
|
||||||
QWidget *GCSControlGadgetOptionsPage::createPage(QWidget *parent)
|
QWidget *GCSControlGadgetOptionsPage::createPage(QWidget *parent)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(parent);
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
options_page = new Ui::GCSControlGadgetOptionsPage();
|
options_page = new Ui::GCSControlGadgetOptionsPage();
|
||||||
QWidget *optionsPageWidget = new QWidget;
|
QWidget *optionsPageWidget = new QWidget;
|
||||||
|
@ -154,6 +154,8 @@ void GCSControlGadgetWidget::toggleArmed(int state)
|
|||||||
|
|
||||||
void GCSControlGadgetWidget::mccChanged(UAVObject * obj)
|
void GCSControlGadgetWidget::mccChanged(UAVObject * obj)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(obj);
|
||||||
|
|
||||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||||
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||||
UAVDataObject* flightStatus = dynamic_cast<UAVDataObject*>( objManager->getObject(QString("FlightStatus")) );
|
UAVDataObject* flightStatus = dynamic_cast<UAVDataObject*>( objManager->getObject(QString("FlightStatus")) );
|
||||||
|
@ -165,6 +165,8 @@ return s1.portName<s2.portName;
|
|||||||
//creates options page widget (uses the UI file)
|
//creates options page widget (uses the UI file)
|
||||||
QWidget *GpsDisplayGadgetOptionsPage::createPage(QWidget *parent)
|
QWidget *GpsDisplayGadgetOptionsPage::createPage(QWidget *parent)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(parent);
|
||||||
|
|
||||||
options_page = new Ui::GpsDisplayGadgetOptionsPage();
|
options_page = new Ui::GpsDisplayGadgetOptionsPage();
|
||||||
QWidget *optionsPageWidget = new QWidget;
|
QWidget *optionsPageWidget = new QWidget;
|
||||||
options_page->setupUi(optionsPageWidget);
|
options_page->setupUi(optionsPageWidget);
|
||||||
|
@ -301,7 +301,7 @@ void NMEAParser::nmeaProcessGPGSV(char *packet)
|
|||||||
|
|
||||||
const int sentence_total = tokenslist.at(1).toInt(); // Number of sentences for full data
|
const int sentence_total = tokenslist.at(1).toInt(); // Number of sentences for full data
|
||||||
const int sentence_index = tokenslist.at(2).toInt(); // sentence x of y
|
const int sentence_index = tokenslist.at(2).toInt(); // sentence x of y
|
||||||
const int sat_count = tokenslist.at(3).toInt(); // Number of satellites in view
|
// const int sat_count = tokenslist.at(3).toInt(); // Number of satellites in view
|
||||||
|
|
||||||
int sats = (tokenslist.size() - 4) /4;
|
int sats = (tokenslist.size() - 4) /4;
|
||||||
for(int sat = 0; sat < sats; sat++) {
|
for(int sat = 0; sat < sats; sat++) {
|
||||||
|
@ -117,7 +117,7 @@ void TelemetryParser::updateSats( UAVObject* object1) {
|
|||||||
UAVObjectField* azimuth = object1->getField(QString("Azimuth"));
|
UAVObjectField* azimuth = object1->getField(QString("Azimuth"));
|
||||||
UAVObjectField* snr = object1->getField(QString("SNR"));
|
UAVObjectField* snr = object1->getField(QString("SNR"));
|
||||||
|
|
||||||
for (int i=0;i< prn->getNumElements();i++) {
|
for (unsigned int i=0;i< prn->getNumElements();i++) {
|
||||||
emit satellite(i,prn->getValue(i).toInt(),elevation->getValue(i).toInt(),
|
emit satellite(i,prn->getValue(i).toInt(),elevation->getValue(i).toInt(),
|
||||||
azimuth->getValue(i).toInt(), snr->getValue(i).toInt());
|
azimuth->getValue(i).toInt(), snr->getValue(i).toInt());
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,8 @@ IPconnectionConfiguration::IPconnectionConfiguration(QString classId, QSettings*
|
|||||||
m_Port(1000),
|
m_Port(1000),
|
||||||
m_UseTCP(1)
|
m_UseTCP(1)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(qSettings);
|
||||||
|
|
||||||
settings = Core::ICore::instance()->settings();
|
settings = Core::ICore::instance()->settings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,6 @@ void IPConnection::onOpenDevice(QString HostName, int Port, bool UseTCP)
|
|||||||
{
|
{
|
||||||
QAbstractSocket *ipSocket;
|
QAbstractSocket *ipSocket;
|
||||||
const int Timeout = 5 * 1000;
|
const int Timeout = 5 * 1000;
|
||||||
int state;
|
|
||||||
|
|
||||||
ipConMutex.lock();
|
ipConMutex.lock();
|
||||||
if (UseTCP) {
|
if (UseTCP) {
|
||||||
@ -177,6 +176,8 @@ QList <Core::IConnection::device> IPconnectionConnection::availableDevices()
|
|||||||
|
|
||||||
QIODevice *IPconnectionConnection::openDevice(const QString &deviceName)
|
QIODevice *IPconnectionConnection::openDevice(const QString &deviceName)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(deviceName);
|
||||||
|
|
||||||
QString HostName;
|
QString HostName;
|
||||||
int Port;
|
int Port;
|
||||||
bool UseTCP;
|
bool UseTCP;
|
||||||
@ -211,6 +212,8 @@ QIODevice *IPconnectionConnection::openDevice(const QString &deviceName)
|
|||||||
|
|
||||||
void IPconnectionConnection::closeDevice(const QString &deviceName)
|
void IPconnectionConnection::closeDevice(const QString &deviceName)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(deviceName);
|
||||||
|
|
||||||
if (ipSocket){
|
if (ipSocket){
|
||||||
ipConMutex.lock();
|
ipConMutex.lock();
|
||||||
emit CloseSocket(ipSocket);
|
emit CloseSocket(ipSocket);
|
||||||
|
@ -169,6 +169,7 @@ bool flightDataModel::setColumnByIndex(pathPlanData *row,const int index,const
|
|||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
QVariant flightDataModel::getColumnByIndex(const pathPlanData *row,const int index) const
|
QVariant flightDataModel::getColumnByIndex(const pathPlanData *row,const int index) const
|
||||||
{
|
{
|
||||||
|
@ -60,6 +60,8 @@ void modelMapProxy::WPValuesChanged(WayPointItem * wp)
|
|||||||
|
|
||||||
void modelMapProxy::currentRowChanged(QModelIndex current, QModelIndex previous)
|
void modelMapProxy::currentRowChanged(QModelIndex current, QModelIndex previous)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(previous);
|
||||||
|
|
||||||
QList<WayPointItem*> list;
|
QList<WayPointItem*> list;
|
||||||
WayPointItem * wp=findWayPointNumber(current.row());
|
WayPointItem * wp=findWayPointNumber(current.row());
|
||||||
if(!wp)
|
if(!wp)
|
||||||
@ -202,6 +204,8 @@ WayPointItem * modelMapProxy::findWayPointNumber(int number)
|
|||||||
|
|
||||||
void modelMapProxy::rowsRemoved(const QModelIndex &parent, int first, int last)
|
void modelMapProxy::rowsRemoved(const QModelIndex &parent, int first, int last)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(parent);
|
||||||
|
|
||||||
for(int x=last;x>first-1;x--)
|
for(int x=last;x>first-1;x--)
|
||||||
{
|
{
|
||||||
myMap->WPDelete(x);
|
myMap->WPDelete(x);
|
||||||
@ -211,6 +215,8 @@ void modelMapProxy::rowsRemoved(const QModelIndex &parent, int first, int last)
|
|||||||
|
|
||||||
void modelMapProxy::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
|
void modelMapProxy::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(bottomRight);
|
||||||
|
|
||||||
WayPointItem * item=findWayPointNumber(topLeft.row());
|
WayPointItem * item=findWayPointNumber(topLeft.row());
|
||||||
if(!item)
|
if(!item)
|
||||||
return;
|
return;
|
||||||
|
@ -287,5 +287,7 @@ void opmap_edit_waypoint_dialog::enableEditWidgets(bool value)
|
|||||||
|
|
||||||
void opmap_edit_waypoint_dialog::currentRowChanged(QModelIndex current, QModelIndex previous)
|
void opmap_edit_waypoint_dialog::currentRowChanged(QModelIndex current, QModelIndex previous)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(previous);
|
||||||
|
|
||||||
mapper->setCurrentIndex(current.row());
|
mapper->setCurrentIndex(current.row());
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,7 @@ PFDGadgetOptionsPage::PFDGadgetOptionsPage(PFDGadgetConfiguration *config, QObje
|
|||||||
//creates options page widget (uses the UI file)
|
//creates options page widget (uses the UI file)
|
||||||
QWidget *PFDGadgetOptionsPage::createPage(QWidget *parent)
|
QWidget *PFDGadgetOptionsPage::createPage(QWidget *parent)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(parent);
|
||||||
|
|
||||||
options_page = new Ui::PFDGadgetOptionsPage();
|
options_page = new Ui::PFDGadgetOptionsPage();
|
||||||
//main widget
|
//main widget
|
||||||
|
@ -46,6 +46,7 @@ QmlViewGadgetOptionsPage::QmlViewGadgetOptionsPage(QmlViewGadgetConfiguration *c
|
|||||||
//creates options page widget (uses the UI file)
|
//creates options page widget (uses the UI file)
|
||||||
QWidget *QmlViewGadgetOptionsPage::createPage(QWidget *parent)
|
QWidget *QmlViewGadgetOptionsPage::createPage(QWidget *parent)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(parent);
|
||||||
|
|
||||||
options_page = new Ui::QmlViewGadgetOptionsPage();
|
options_page = new Ui::QmlViewGadgetOptionsPage();
|
||||||
//main widget
|
//main widget
|
||||||
|
@ -90,7 +90,7 @@ static void hid_close(hid_t *);
|
|||||||
static void attach_callback(void *, IOReturn, void *, IOHIDDeviceRef);
|
static void attach_callback(void *, IOReturn, void *, IOHIDDeviceRef);
|
||||||
static void detach_callback(void *, IOReturn, void *hid_mgr, IOHIDDeviceRef dev);
|
static void detach_callback(void *, IOReturn, void *hid_mgr, IOHIDDeviceRef dev);
|
||||||
static void input_callback(void *, IOReturn, void *, IOHIDReportType, uint32_t, uint8_t *, CFIndex);
|
static void input_callback(void *, IOReturn, void *, IOHIDReportType, uint32_t, uint8_t *, CFIndex);
|
||||||
static void output_callback(hid_t *context, IOReturn ret, void *sender, IOHIDReportType type, uint32_t id, uint8_t *data, CFIndex len);
|
//static void output_callback(hid_t *context, IOReturn ret, void *sender, IOHIDReportType type, uint32_t id, uint8_t *data, CFIndex len);
|
||||||
static void timeout_callback(CFRunLoopTimerRef, void *);
|
static void timeout_callback(CFRunLoopTimerRef, void *);
|
||||||
|
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ int pjrc_rawhid::open(int max, int vid, int pid, int usage_page, int usage)
|
|||||||
IOHIDManagerRegisterDeviceRemovalCallback(hid_manager, detach_callback, NULL);
|
IOHIDManagerRegisterDeviceRemovalCallback(hid_manager, detach_callback, NULL);
|
||||||
ret = IOHIDManagerOpen(hid_manager, kIOHIDOptionsTypeNone);
|
ret = IOHIDManagerOpen(hid_manager, kIOHIDOptionsTypeNone);
|
||||||
if (ret != kIOReturnSuccess) {
|
if (ret != kIOReturnSuccess) {
|
||||||
printf("Could not start IOHIDManager");
|
qDebug()<< "Could not start IOHIDManager";
|
||||||
IOHIDManagerUnscheduleFromRunLoop(hid_manager,
|
IOHIDManagerUnscheduleFromRunLoop(hid_manager,
|
||||||
CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
|
CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
|
||||||
CFRelease(hid_manager);
|
CFRelease(hid_manager);
|
||||||
@ -181,7 +181,7 @@ int pjrc_rawhid::open(int max, int vid, int pid, int usage_page, int usage)
|
|||||||
}
|
}
|
||||||
// Set the run loop reference:
|
// Set the run loop reference:
|
||||||
the_correct_runloop = CFRunLoopGetCurrent();
|
the_correct_runloop = CFRunLoopGetCurrent();
|
||||||
printf("run loop\n");
|
qDebug() << "run loop";
|
||||||
// let it do the callback for all devices
|
// let it do the callback for all devices
|
||||||
while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, true) == kCFRunLoopRunHandledSource) ;
|
while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, true) == kCFRunLoopRunHandledSource) ;
|
||||||
// count up how many were added by the callback
|
// count up how many were added by the callback
|
||||||
@ -240,7 +240,7 @@ int pjrc_rawhid::receive(int num, void *buf, int len, int timeout)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!hid->open) {
|
if (!hid->open) {
|
||||||
printf("pjrc_rawhid_recv, device not open\n");
|
qDebug() << "pjrc_rawhid_recv, device not open\n";
|
||||||
ret = -1;
|
ret = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -263,6 +263,8 @@ int pjrc_rawhid::receive(int num, void *buf, int len, int timeout)
|
|||||||
//
|
//
|
||||||
int pjrc_rawhid::send(int num, void *buf, int len, int timeout)
|
int pjrc_rawhid::send(int num, void *buf, int len, int timeout)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(timeout);
|
||||||
|
|
||||||
hid_t *hid;
|
hid_t *hid;
|
||||||
int result=-100;
|
int result=-100;
|
||||||
|
|
||||||
@ -287,6 +289,7 @@ int pjrc_rawhid::send(int num, void *buf, int len, int timeout)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
#if 0
|
#if 0
|
||||||
|
#define TIMEOUT_FIXED
|
||||||
// No matter what I tried this never actually sends an output
|
// No matter what I tried this never actually sends an output
|
||||||
// report and output_callback never gets called. Why??
|
// report and output_callback never gets called. Why??
|
||||||
// Did I miss something? This is exactly the same params as
|
// Did I miss something? This is exactly the same params as
|
||||||
@ -315,7 +318,7 @@ int pjrc_rawhid::send(int num, void *buf, int len, int timeout)
|
|||||||
|
|
||||||
QString pjrc_rawhid::getserial(int num) {
|
QString pjrc_rawhid::getserial(int num) {
|
||||||
hid_t *hid;
|
hid_t *hid;
|
||||||
char buf[128];
|
// char buf[128];
|
||||||
|
|
||||||
hid = get_hid(num);
|
hid = get_hid(num);
|
||||||
|
|
||||||
@ -358,6 +361,9 @@ void pjrc_rawhid::close(int num)
|
|||||||
//
|
//
|
||||||
static void input_callback(void *context, IOReturn ret, void *sender, IOHIDReportType type, uint32_t id, uint8_t *data, CFIndex len)
|
static void input_callback(void *context, IOReturn ret, void *sender, IOHIDReportType type, uint32_t id, uint8_t *data, CFIndex len)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(type);
|
||||||
|
Q_UNUSED(id);
|
||||||
|
|
||||||
buffer_t *n;
|
buffer_t *n;
|
||||||
hid_t *hid;
|
hid_t *hid;
|
||||||
|
|
||||||
@ -365,7 +371,7 @@ static void input_callback(void *context, IOReturn ret, void *sender, IOHIDRepor
|
|||||||
if (ret != kIOReturnSuccess || len < 1) return;
|
if (ret != kIOReturnSuccess || len < 1) return;
|
||||||
hid = (hid_t*)context;
|
hid = (hid_t*)context;
|
||||||
if (!hid || hid->ref != sender) return;
|
if (!hid || hid->ref != sender) return;
|
||||||
printf("Processing packet");
|
qDebug() << "Processing packet";
|
||||||
n = (buffer_t *)malloc(sizeof(buffer_t));
|
n = (buffer_t *)malloc(sizeof(buffer_t));
|
||||||
if (!n) return;
|
if (!n) return;
|
||||||
if (len > BUFFER_SIZE) len = BUFFER_SIZE;
|
if (len > BUFFER_SIZE) len = BUFFER_SIZE;
|
||||||
@ -385,6 +391,8 @@ static void input_callback(void *context, IOReturn ret, void *sender, IOHIDRepor
|
|||||||
|
|
||||||
static void timeout_callback(CFRunLoopTimerRef timer, void *info)
|
static void timeout_callback(CFRunLoopTimerRef timer, void *info)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(timer);
|
||||||
|
|
||||||
//qDebug("timeout_callback\n");
|
//qDebug("timeout_callback\n");
|
||||||
*(int *)info = 1;
|
*(int *)info = 1;
|
||||||
//qDebug() << "Stop CFRunLoop from timeout_callback" << CFRunLoopGetCurrent();
|
//qDebug() << "Stop CFRunLoop from timeout_callback" << CFRunLoopGetCurrent();
|
||||||
@ -440,9 +448,13 @@ static void hid_close(hid_t *hid)
|
|||||||
|
|
||||||
static void detach_callback(void *context, IOReturn r, void *hid_mgr, IOHIDDeviceRef dev)
|
static void detach_callback(void *context, IOReturn r, void *hid_mgr, IOHIDDeviceRef dev)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(context);
|
||||||
|
Q_UNUSED(r);
|
||||||
|
Q_UNUSED(hid_mgr);
|
||||||
|
|
||||||
hid_t *p;
|
hid_t *p;
|
||||||
|
|
||||||
printf("detach callback\n");
|
qDebug()<< "detach callback";
|
||||||
for (p = first_hid; p; p = p->next) {
|
for (p = first_hid; p; p = p->next) {
|
||||||
if (p->ref == dev) {
|
if (p->ref == dev) {
|
||||||
p->open = 0;
|
p->open = 0;
|
||||||
@ -454,9 +466,13 @@ static void detach_callback(void *context, IOReturn r, void *hid_mgr, IOHIDDevic
|
|||||||
|
|
||||||
static void attach_callback(void *context, IOReturn r, void *hid_mgr, IOHIDDeviceRef dev)
|
static void attach_callback(void *context, IOReturn r, void *hid_mgr, IOHIDDeviceRef dev)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(context);
|
||||||
|
Q_UNUSED(r);
|
||||||
|
Q_UNUSED(hid_mgr);
|
||||||
|
|
||||||
struct hid_struct *h;
|
struct hid_struct *h;
|
||||||
|
|
||||||
printf("attach callback\n");
|
qDebug() << "attach callback";
|
||||||
if (IOHIDDeviceOpen(dev, kIOHIDOptionsTypeNone) != kIOReturnSuccess) return;
|
if (IOHIDDeviceOpen(dev, kIOHIDOptionsTypeNone) != kIOReturnSuccess) return;
|
||||||
h = (hid_t *)malloc(sizeof(hid_t));
|
h = (hid_t *)malloc(sizeof(hid_t));
|
||||||
if (!h) return;
|
if (!h) return;
|
||||||
@ -468,9 +484,16 @@ static void attach_callback(void *context, IOReturn r, void *hid_mgr, IOHIDDevic
|
|||||||
add_hid(h);
|
add_hid(h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TIMEOUT_FIXED
|
||||||
static void output_callback(hid_t *context, IOReturn ret, void *sender, IOHIDReportType type, uint32_t id, uint8_t *data, CFIndex len)
|
static void output_callback(hid_t *context, IOReturn ret, void *sender, IOHIDReportType type, uint32_t id, uint8_t *data, CFIndex len)
|
||||||
{
|
{
|
||||||
printf("output_callback, r=%d\n", ret);
|
Q_UNUSED(sender);
|
||||||
|
Q_UNUSED(type);
|
||||||
|
Q_UNUSED(id);
|
||||||
|
Q_UNUSED(data);
|
||||||
|
|
||||||
|
qDebug()<< QString("output_callback, r=%1").arg(ret);
|
||||||
|
// printf("output_callback, r=%d\n", ret);
|
||||||
if (ret == kIOReturnSuccess) {
|
if (ret == kIOReturnSuccess) {
|
||||||
*(int *)context = len;
|
*(int *)context = len;
|
||||||
} else {
|
} else {
|
||||||
@ -479,4 +502,4 @@ static void output_callback(hid_t *context, IOReturn ret, void *sender, IOHIDRep
|
|||||||
}
|
}
|
||||||
CFRunLoopStop(CFRunLoopGetCurrent());
|
CFRunLoopStop(CFRunLoopGetCurrent());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
@ -45,8 +45,6 @@ static bool HID_GetStrProperty(IOHIDDeviceRef dev, CFStringRef property, QString
|
|||||||
*/
|
*/
|
||||||
USBMonitor::USBMonitor(QObject *parent): QThread(parent) {
|
USBMonitor::USBMonitor(QObject *parent): QThread(parent) {
|
||||||
hid_manager=NULL;
|
hid_manager=NULL;
|
||||||
CFMutableDictionaryRef dict;
|
|
||||||
CFNumberRef num;
|
|
||||||
IOReturn ret;
|
IOReturn ret;
|
||||||
|
|
||||||
m_instance = this;
|
m_instance = this;
|
||||||
@ -117,6 +115,10 @@ void USBMonitor::removeDevice(IOHIDDeviceRef dev) {
|
|||||||
*/
|
*/
|
||||||
void USBMonitor::detach_callback(void *context, IOReturn r, void *hid_mgr, IOHIDDeviceRef dev)
|
void USBMonitor::detach_callback(void *context, IOReturn r, void *hid_mgr, IOHIDDeviceRef dev)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(context);
|
||||||
|
Q_UNUSED(r);
|
||||||
|
Q_UNUSED(hid_mgr);
|
||||||
|
|
||||||
qDebug() << "USBMonitor: Device detached event";
|
qDebug() << "USBMonitor: Device detached event";
|
||||||
instance()->removeDevice(dev);
|
instance()->removeDevice(dev);
|
||||||
}
|
}
|
||||||
@ -129,9 +131,12 @@ void USBMonitor::addDevice(USBPortInfo info) {
|
|||||||
|
|
||||||
void USBMonitor::attach_callback(void *context, IOReturn r, void *hid_mgr, IOHIDDeviceRef dev)
|
void USBMonitor::attach_callback(void *context, IOReturn r, void *hid_mgr, IOHIDDeviceRef dev)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(context);
|
||||||
|
Q_UNUSED(r);
|
||||||
|
Q_UNUSED(hid_mgr);
|
||||||
|
|
||||||
bool got_properties = true;
|
bool got_properties = true;
|
||||||
|
|
||||||
CFTypeRef prop;
|
|
||||||
USBPortInfo deviceInfo;
|
USBPortInfo deviceInfo;
|
||||||
|
|
||||||
deviceInfo.dev_handle = dev;
|
deviceInfo.dev_handle = dev;
|
||||||
|
@ -38,6 +38,8 @@ SerialPluginConfiguration::SerialPluginConfiguration(QString classId, QSettings*
|
|||||||
IUAVGadgetConfiguration(classId, parent),
|
IUAVGadgetConfiguration(classId, parent),
|
||||||
m_speed("57600")
|
m_speed("57600")
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(qSettings);
|
||||||
|
|
||||||
settings = Core::ICore::instance()->settings();
|
settings = Core::ICore::instance()->settings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,20 +55,24 @@ if ~strcmpi(outputType,'mat') && ~strcmpi(outputType,'csv')
|
|||||||
error('Incorrect file format specified. Second argument must be ''mat'' or ''csv''.');
|
error('Incorrect file format specified. Second argument must be ''mat'' or ''csv''.');
|
||||||
end
|
end
|
||||||
|
|
||||||
$(ALLOCATIONCODE)
|
$(INSTANTIATIONCODE)
|
||||||
|
|
||||||
|
|
||||||
fid = fopen(logfile);
|
fid = fopen(logfile);
|
||||||
|
buffer=fread(fid,Inf,'uchar=>uchar');
|
||||||
|
fseek(fid, 0, 'bof');
|
||||||
|
|
||||||
|
bufferIdx=1;
|
||||||
|
|
||||||
correctMsgByte=hex2dec('20');
|
correctMsgByte=hex2dec('20');
|
||||||
correctTimestampedByte=hex2dec('A0');
|
correctTimestampedByte=hex2dec('A0');
|
||||||
correctSyncByte=hex2dec('3C');
|
correctSyncByte=hex2dec('3C');
|
||||||
unknownObjIDList=zeros(1,2);
|
unknownObjIDList=zeros(1,2);
|
||||||
|
|
||||||
% Parse log file, entry by entry
|
% Parse log file, entry by entry
|
||||||
prebuf = fread(fid, 12, 'uint8');
|
% prebuf = buffer(1:12);
|
||||||
log_size = dir(logfile);
|
|
||||||
log_size = log_size.bytes;
|
last_print = -1e10;
|
||||||
last_print = 0;
|
|
||||||
|
|
||||||
startTime=clock;
|
startTime=clock;
|
||||||
|
|
||||||
@ -116,15 +120,18 @@ $(SWITCHCODE)
|
|||||||
otherwise
|
otherwise
|
||||||
unknownObjIDListIdx=find(unknownObjIDList(:,1)==objID, 1, 'first');
|
unknownObjIDListIdx=find(unknownObjIDList(:,1)==objID, 1, 'first');
|
||||||
if isempty(unknownObjIDListIdx)
|
if isempty(unknownObjIDListIdx)
|
||||||
unknownObjIDList=[unknownObjIDList; objID 1];
|
unknownObjIDList=[unknownObjIDList; uint32(objID) 1]; %#ok<AGROW>
|
||||||
else
|
else
|
||||||
unknownObjIDList(unknownObjIDListIdx,2)=unknownObjIDList(unknownObjIDListIdx,2)+1;
|
unknownObjIDList(unknownObjIDListIdx,2)=unknownObjIDList(unknownObjIDListIdx,2)+1;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
datasize = typecast(buffer(datasizeBufferIdx + 4:datasizeBufferIdx + 12-1), 'uint64');
|
||||||
|
|
||||||
msgBytesLeft = datasize - 1 - 1 - 2 - 4;
|
msgBytesLeft = datasize - 1 - 1 - 2 - 4;
|
||||||
if msgBytesLeft > 255
|
if msgBytesLeft > 255
|
||||||
msgBytesLeft = 0;
|
msgBytesLeft = 0;
|
||||||
end
|
end
|
||||||
fread(fid, msgBytesLeft, 'uint8');
|
bufferIdx=bufferIdx+msgBytesLeft;
|
||||||
end
|
end
|
||||||
catch
|
catch
|
||||||
% One of the reads failed - indicates EOF
|
% One of the reads failed - indicates EOF
|
||||||
@ -132,43 +139,41 @@ $(SWITCHCODE)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if (wrongSyncByte ~= lastWrongSyncByte || wrongMessageByte~=lastWrongMessageByte ) ||...
|
if (wrongSyncByte ~= lastWrongSyncByte || wrongMessageByte~=lastWrongMessageByte ) ||...
|
||||||
(ftell(fid) / log_size - last_print) > 0.01
|
bufferIdx - last_print > 5e4 %Every 50,000 bytes show the status update
|
||||||
|
|
||||||
lastWrongSyncByte=wrongSyncByte;
|
lastWrongSyncByte=wrongSyncByte;
|
||||||
lastWrongMessageByte=wrongMessageByte;
|
lastWrongMessageByte=wrongMessageByte;
|
||||||
|
|
||||||
str1=[];
|
str1=[];
|
||||||
for i=1:length([str2 str3 str4 str5]);
|
for i=1:length([str2 str3 str4 str5]);
|
||||||
str1=[str1 sprintf('\b')];
|
str1=[str1 sprintf('\b')]; %#ok<AGROW>
|
||||||
end
|
end
|
||||||
str2=sprintf('wrongSyncByte instances: % 10d\n', wrongSyncByte );
|
str2=sprintf('wrongSyncByte instances: % 10d\n', wrongSyncByte );
|
||||||
str3=sprintf('wrongMessageByte instances: % 10d\n\n', wrongMessageByte );
|
str3=sprintf('wrongMessageByte instances: % 10d\n\n', wrongMessageByte );
|
||||||
|
|
||||||
str4=sprintf('Completed bytes: % 9d of % 9d\n', ftell(fid), log_size);
|
str4=sprintf('Completed bytes: % 9d of % 9d\n', bufferIdx, length(buffer));
|
||||||
|
|
||||||
% Arbitrary times two so that it is at least as long
|
% Arbitrary times two so that it is at least as long
|
||||||
estTimeRemaining=(log_size-ftell(fid))/(ftell(fid)/etime(clock,startTime)) * 2;
|
estTimeRemaining=(length(buffer)-bufferIdx)/(bufferIdx/etime(clock,startTime)) * 2;
|
||||||
h=floor(estTimeRemaining/3600);
|
h=floor(estTimeRemaining/3600);
|
||||||
m=floor((estTimeRemaining-h*3600)/60);
|
m=floor((estTimeRemaining-h*3600)/60);
|
||||||
s=ceil(estTimeRemaining-h*3600-m*60);
|
s=ceil(estTimeRemaining-h*3600-m*60);
|
||||||
|
|
||||||
str5=sprintf('Est. time remaining, %02dh:%02dm:%02ds \n', h,m,s);
|
str5=sprintf('Est. time remaining, %02dh:%02dm:%02ds \n', h,m,s);
|
||||||
|
|
||||||
last_print = ftell(fid) / log_size;
|
last_print = bufferIdx;
|
||||||
|
|
||||||
fprintf([str1 str2 str3 str4 str5]);
|
fprintf([str1 str2 str3 str4 str5]);
|
||||||
end
|
end
|
||||||
|
|
||||||
if msgType ~= correctTimestampedByte
|
%Check if at end of file. If not, load next prebuffer
|
||||||
prebuf = fread(fid, 12, 'uint8');
|
if bufferIdx+12-1 > length(buffer)
|
||||||
|
break;
|
||||||
end
|
end
|
||||||
|
% bufferIdx=bufferIdx+12;
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
fprintf('%d records in %0.2f seconds.\n', ftell(fid), etime(clock,startTime));
|
|
||||||
|
|
||||||
for i=2:size(unknownObjIDList,1) %Don't show the first one, as it was simply a dummy placeholder
|
|
||||||
disp(['Unknown object ID: 0x' dec2hex(unknownObjIDList(i,1),8) ' appeared ' int2str(unknownObjIDList(i,2)) ' times.']);
|
|
||||||
end
|
|
||||||
|
|
||||||
for i=2:size(unknownObjIDList,1) %Don't show the first one, as it was simply a dummy placeholder
|
for i=2:size(unknownObjIDList,1) %Don't show the first one, as it was simply a dummy placeholder
|
||||||
disp(['Unknown object ID: 0x' dec2hex(unknownObjIDList(i,1),8) ' appeared ' int2str(unknownObjIDList(i,2)) ' times.']);
|
disp(['Unknown object ID: 0x' dec2hex(unknownObjIDList(i,1),8) ' appeared ' int2str(unknownObjIDList(i,2)) ' times.']);
|
||||||
@ -177,28 +182,25 @@ end
|
|||||||
%% Clean Up and Save mat file
|
%% Clean Up and Save mat file
|
||||||
fclose(fid);
|
fclose(fid);
|
||||||
|
|
||||||
% Trim output structs
|
%% Prune vectors
|
||||||
$(CLEANUPCODE)
|
$(CLEANUPCODE)
|
||||||
|
|
||||||
|
|
||||||
|
%% Perform typecasting on vectors
|
||||||
|
$(ALLOCATIONCODE)
|
||||||
|
|
||||||
|
%% Save data to file
|
||||||
if strcmpi(outputType,'mat')
|
if strcmpi(outputType,'mat')
|
||||||
matfile = strrep(logfile,'opl','mat');
|
[path, name]=fileparts(logfile);
|
||||||
|
matfile = fullfile(path,[name '.mat']);
|
||||||
save(matfile $(SAVEOBJECTSCODE));
|
save(matfile $(SAVEOBJECTSCODE));
|
||||||
else
|
else
|
||||||
$(EXPORTCSVCODE);
|
$(EXPORTCSVCODE)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
fprintf('%d records in %0.2f seconds.\n', length(buffer), etime(clock,startTime));
|
||||||
|
|
||||||
|
|
||||||
%% Object reading functions
|
|
||||||
$(FUNCTIONSCODE)
|
|
||||||
|
|
||||||
% This function prunes the excess pre-allocated space
|
|
||||||
function [structOut]=PruneStructOfArrays(structIn, lastIndex)
|
|
||||||
|
|
||||||
fieldNames = fieldnames(structIn);
|
|
||||||
for i=1:length(fieldNames)
|
|
||||||
structOut.(fieldNames{i})=structIn.(fieldNames{i})(:,1:lastIndex);
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function OPLog2csv(structIn, structName, logfile)
|
function OPLog2csv(structIn, structName, logfile)
|
||||||
@ -236,3 +238,28 @@ function crc = compute_crc(data)
|
|||||||
crc = crc_table(1+bitxor(data(i),crc));
|
crc = crc_table(1+bitxor(data(i),crc));
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function out=mcolon(inStart, inFinish)
|
||||||
|
%% This function was inspired by Bruno Luong's 'mcolon'. The name is kept the same as his 'mcolon'
|
||||||
|
% function, found on Matlab's file exchange. The two functions return identical
|
||||||
|
% results, although his is much faster. Unfortunately, C-compiled mex
|
||||||
|
% code would make this function non-cross-platform, so a Matlab scripted
|
||||||
|
% version is provided here.
|
||||||
|
if size(inStart,1) > 1 || size(inFinish,1) > 1
|
||||||
|
if size(inStart,2) > 1 || size(inFinish,2) > 1
|
||||||
|
error('Inputs must be vectors, i.e just one column wide.')
|
||||||
|
else
|
||||||
|
inStart=inStart';
|
||||||
|
inFinish=inFinish';
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
diffIn=diff([inStart; inFinish]);
|
||||||
|
numElements=sum(diffIn)+length(inStart);
|
||||||
|
|
||||||
|
out=zeros(1,numElements);
|
||||||
|
|
||||||
|
idx=1;
|
||||||
|
for i=1:length(inStart)
|
||||||
|
out(idx:idx+diffIn(i))=inStart(i):inFinish(i);
|
||||||
|
idx=idx+diffIn(i)+1;
|
||||||
|
end
|
||||||
|
@ -268,7 +268,7 @@ QByteArray UAVObjectUtilManager::getBoardCPUSerial()
|
|||||||
QByteArray cpuSerial;
|
QByteArray cpuSerial;
|
||||||
FirmwareIAPObj::DataFields firmwareIapData = getFirmwareIap();
|
FirmwareIAPObj::DataFields firmwareIapData = getFirmwareIap();
|
||||||
|
|
||||||
for (int i = 0; i < FirmwareIAPObj::CPUSERIAL_NUMELEM; i++)
|
for (unsigned int i = 0; i < FirmwareIAPObj::CPUSERIAL_NUMELEM; i++)
|
||||||
cpuSerial.append(firmwareIapData.CPUSerial[i]);
|
cpuSerial.append(firmwareIapData.CPUSerial[i]);
|
||||||
|
|
||||||
return cpuSerial;
|
return cpuSerial;
|
||||||
@ -288,7 +288,7 @@ QByteArray UAVObjectUtilManager::getBoardDescription()
|
|||||||
QByteArray ret;
|
QByteArray ret;
|
||||||
FirmwareIAPObj::DataFields firmwareIapData = getFirmwareIap();
|
FirmwareIAPObj::DataFields firmwareIapData = getFirmwareIap();
|
||||||
|
|
||||||
for (int i = 0; i < FirmwareIAPObj::DESCRIPTION_NUMELEM; i++)
|
for (unsigned int i = 0; i < FirmwareIAPObj::DESCRIPTION_NUMELEM; i++)
|
||||||
ret.append(firmwareIapData.Description[i]);
|
ret.append(firmwareIapData.Description[i]);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
ConfigTaskWidget::ConfigTaskWidget(QWidget *parent) : QWidget(parent),isConnected(false),smartsave(NULL),dirty(false),outOfLimitsStyle("background-color: rgb(255, 0, 0);"),timeOut(NULL),allowWidgetUpdates(true)
|
ConfigTaskWidget::ConfigTaskWidget(QWidget *parent) : QWidget(parent),isConnected(false),allowWidgetUpdates(true),smartsave(NULL),dirty(false),outOfLimitsStyle("background-color: rgb(255, 0, 0);"),timeOut(NULL)
|
||||||
{
|
{
|
||||||
pm = ExtensionSystem::PluginManager::instance();
|
pm = ExtensionSystem::PluginManager::instance();
|
||||||
objManager = pm->getObject<UAVObjectManager>();
|
objManager = pm->getObject<UAVObjectManager>();
|
||||||
|
@ -457,7 +457,7 @@ bool UAVTalk::processInputByte(quint8 rxbyte)
|
|||||||
default:
|
default:
|
||||||
rxState = STATE_SYNC;
|
rxState = STATE_SYNC;
|
||||||
stats.rxErrors++;
|
stats.rxErrors++;
|
||||||
UAVTALK_QXTLOG_DEBUG("UAVTalk: ???->Sync");
|
UAVTALK_QXTLOG_DEBUG("UAVTalk: \?\?\?->Sync"); //Use the escape character for '?' so that the tripgraph isn't triggered.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Done
|
// Done
|
||||||
|
@ -43,7 +43,7 @@ public:
|
|||||||
uint8_t maxRetryCount; // max. times to try to transmit the 'send' packet
|
uint8_t maxRetryCount; // max. times to try to transmit the 'send' packet
|
||||||
uint16_t max_retry; // Maximum number of retrys for a single transmit.
|
uint16_t max_retry; // Maximum number of retrys for a single transmit.
|
||||||
int32_t timeoutLen; // how long to wait for each retry to succeed
|
int32_t timeoutLen; // how long to wait for each retry to succeed
|
||||||
int32_t timeout; // current timeout. when 'time' reaches this point we have timed out
|
uint32_t timeout; // current timeout. when 'time' reaches this point we have timed out
|
||||||
uint8_t txSeqNo; // current 'send' packet sequence number
|
uint8_t txSeqNo; // current 'send' packet sequence number
|
||||||
uint16_t rxBufPos; // current buffer position in the receive packet
|
uint16_t rxBufPos; // current buffer position in the receive packet
|
||||||
uint16_t rxBufLen; // number of 'data' bytes in the buffer
|
uint16_t rxBufLen; // number of 'data' bytes in the buffer
|
||||||
|
@ -802,6 +802,8 @@ qssp::qssp(port * info,bool debug):debug(debug)
|
|||||||
}
|
}
|
||||||
void qssp::pfCallBack( uint8_t * buf, uint16_t size)
|
void qssp::pfCallBack( uint8_t * buf, uint16_t size)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(size);
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug()<<"receive callback"<<buf[0]<<buf[1]<<buf[2]<<buf[3]<<buf[4];
|
qDebug()<<"receive callback"<<buf[0]<<buf[1]<<buf[2]<<buf[3]<<buf[4];
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,8 @@ UploaderGadgetOptionsPage::UploaderGadgetOptionsPage(UploaderGadgetConfiguration
|
|||||||
//creates options page widget
|
//creates options page widget
|
||||||
QWidget *UploaderGadgetOptionsPage::createPage(QWidget *parent)
|
QWidget *UploaderGadgetOptionsPage::createPage(QWidget *parent)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(parent);
|
||||||
|
|
||||||
//main widget
|
//main widget
|
||||||
QWidget *widget = new QWidget;
|
QWidget *widget = new QWidget;
|
||||||
|
|
||||||
|
@ -31,7 +31,9 @@ using namespace std;
|
|||||||
bool UAVObjectGeneratorMatlab::generate(UAVObjectParser* parser,QString templatepath,QString outputpath) {
|
bool UAVObjectGeneratorMatlab::generate(UAVObjectParser* parser,QString templatepath,QString outputpath) {
|
||||||
|
|
||||||
fieldTypeStrMatlab << "int8" << "int16" << "int32"
|
fieldTypeStrMatlab << "int8" << "int16" << "int32"
|
||||||
<< "uint8" << "uint16" << "uint32" << "float32" << "uint8";
|
<< "uint8" << "uint16" << "uint32" << "single" << "uint8";
|
||||||
|
fieldSizeStrMatlab << "1" << "2" << "4"
|
||||||
|
<< "1" << "2" << "4" << "4" << "1";
|
||||||
|
|
||||||
QDir matlabTemplatePath = QDir( templatepath + QString("ground/openpilotgcs/src/plugins/uavobjects"));
|
QDir matlabTemplatePath = QDir( templatepath + QString("ground/openpilotgcs/src/plugins/uavobjects"));
|
||||||
QDir matlabOutputPath = QDir( outputpath + QString("matlab") );
|
QDir matlabOutputPath = QDir( outputpath + QString("matlab") );
|
||||||
@ -46,14 +48,15 @@ bool UAVObjectGeneratorMatlab::generate(UAVObjectParser* parser,QString template
|
|||||||
|
|
||||||
for (int objidx = 0; objidx < parser->getNumObjects(); ++objidx) {
|
for (int objidx = 0; objidx < parser->getNumObjects(); ++objidx) {
|
||||||
ObjectInfo* info=parser->getObjectByIndex(objidx);
|
ObjectInfo* info=parser->getObjectByIndex(objidx);
|
||||||
process_object(info);
|
int numBytes=parser->getNumBytes(objidx);
|
||||||
|
process_object(info, numBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
matlabCodeTemplate.replace( QString("$(ALLOCATIONCODE)"), matlabAllocationCode);
|
matlabCodeTemplate.replace( QString("$(INSTANTIATIONCODE)"), matlabInstantiationCode);
|
||||||
matlabCodeTemplate.replace( QString("$(SWITCHCODE)"), matlabSwitchCode);
|
matlabCodeTemplate.replace( QString("$(SWITCHCODE)"), matlabSwitchCode);
|
||||||
matlabCodeTemplate.replace( QString("$(CLEANUPCODE)"), matlabCleanupCode);
|
matlabCodeTemplate.replace( QString("$(CLEANUPCODE)"), matlabCleanupCode);
|
||||||
matlabCodeTemplate.replace( QString("$(SAVEOBJECTSCODE)"), matlabSaveObjectsCode);
|
matlabCodeTemplate.replace( QString("$(SAVEOBJECTSCODE)"), matlabSaveObjectsCode);
|
||||||
matlabCodeTemplate.replace( QString("$(FUNCTIONSCODE)"), matlabFunctionsCode);
|
matlabCodeTemplate.replace( QString("$(ALLOCATIONCODE)"), matlabAllocationCode);
|
||||||
matlabCodeTemplate.replace( QString("$(EXPORTCSVCODE)"), matlabExportCsvCode);
|
matlabCodeTemplate.replace( QString("$(EXPORTCSVCODE)"), matlabExportCsvCode);
|
||||||
|
|
||||||
bool res = writeFile( matlabOutputPath.absolutePath() + "/OPLogConvert.m", matlabCodeTemplate );
|
bool res = writeFile( matlabOutputPath.absolutePath() + "/OPLogConvert.m", matlabCodeTemplate );
|
||||||
@ -68,7 +71,7 @@ bool UAVObjectGeneratorMatlab::generate(UAVObjectParser* parser,QString template
|
|||||||
/**
|
/**
|
||||||
* Generate the matlab object files
|
* Generate the matlab object files
|
||||||
*/
|
*/
|
||||||
bool UAVObjectGeneratorMatlab::process_object(ObjectInfo* info)
|
bool UAVObjectGeneratorMatlab::process_object(ObjectInfo* info, int numBytes)
|
||||||
{
|
{
|
||||||
if (info == NULL)
|
if (info == NULL)
|
||||||
return false;
|
return false;
|
||||||
@ -78,73 +81,101 @@ bool UAVObjectGeneratorMatlab::process_object(ObjectInfo* info)
|
|||||||
// QString objectTableName(objectName + "Objects");
|
// QString objectTableName(objectName + "Objects");
|
||||||
QString objectTableName(objectName);
|
QString objectTableName(objectName);
|
||||||
QString tableIdxName(objectName.toLower() + "Idx");
|
QString tableIdxName(objectName.toLower() + "Idx");
|
||||||
QString functionName("Read" + info->name + "Object");
|
|
||||||
QString functionCall(functionName + "(fid, timestamp, checkCRC, ");
|
|
||||||
QString objectID(QString().setNum(info->id));
|
QString objectID(QString().setNum(info->id));
|
||||||
QString isSingleInst = boolTo01String( info->isSingleInst );
|
QString numBytesString=QString("%1").arg(numBytes);
|
||||||
|
|
||||||
|
|
||||||
//===================================================================//
|
//=========================================================================//
|
||||||
// Generate allocation code (will replace the $(ALLOCATIONCODE) tag) //
|
// Generate instantiation code (will replace the $(INSTANTIATIONCODE) tag) //
|
||||||
//===================================================================//
|
//=========================================================================//
|
||||||
// matlabSwitchCode.append("\t\tcase " + objectID + "\n");
|
|
||||||
matlabAllocationCode.append("\n\t" + tableIdxName + " = 0;\n");
|
|
||||||
QString type;
|
QString type;
|
||||||
QString allocfields;
|
QString instantiationFields;
|
||||||
if (0){
|
|
||||||
matlabAllocationCode.append("\t" + objectTableName + ".timestamp = 0;\n");
|
matlabInstantiationCode.append("\n\t" + tableIdxName + " = 0;\n");
|
||||||
for (int n = 0; n < info->fields.length(); ++n) {
|
matlabInstantiationCode.append("\t" + objectTableName + "=struct('timestamp', 0");
|
||||||
// Determine type
|
|
||||||
type = fieldTypeStrMatlab[info->fields[n]->type];
|
|
||||||
// Append field
|
|
||||||
if ( info->fields[n]->numElements > 1 )
|
|
||||||
allocfields.append("\t" + objectTableName + "(1)." + info->fields[n]->name + " = zeros(" + QString::number(info->fields[n]->numElements, 10) + ",1);\n");
|
|
||||||
else
|
|
||||||
allocfields.append("\t" + objectTableName + "(1)." + info->fields[n]->name + " = 0;\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
matlabAllocationCode.append("\t" + objectTableName + "=struct('timestamp', 0");
|
|
||||||
if (!info->isSingleInst) {
|
if (!info->isSingleInst) {
|
||||||
allocfields.append(",...\n\t\t 'instanceID', 0");
|
instantiationFields.append(",...\n\t\t 'instanceID', 0");
|
||||||
}
|
}
|
||||||
for (int n = 0; n < info->fields.length(); ++n) {
|
for (int n = 0; n < info->fields.length(); ++n) {
|
||||||
// Determine type
|
// Determine type
|
||||||
type = fieldTypeStrMatlab[info->fields[n]->type];
|
type = fieldTypeStrMatlab[info->fields[n]->type];
|
||||||
// Append field
|
// Append field
|
||||||
if ( info->fields[n]->numElements > 1 )
|
if ( info->fields[n]->numElements > 1 )
|
||||||
allocfields.append(",...\n\t\t '" + info->fields[n]->name + "', zeros(" + QString::number(info->fields[n]->numElements, 10) + ",1)");
|
instantiationFields.append(",...\n\t\t '" + info->fields[n]->name + "', zeros(" + QString::number(info->fields[n]->numElements, 10) + ",1)");
|
||||||
else
|
else
|
||||||
allocfields.append(",...\n\t\t '" + info->fields[n]->name + "', 0");
|
instantiationFields.append(",...\n\t\t '" + info->fields[n]->name + "', 0");
|
||||||
}
|
}
|
||||||
allocfields.append(");\n");
|
instantiationFields.append(");\n");
|
||||||
}
|
|
||||||
matlabAllocationCode.append(allocfields);
|
matlabInstantiationCode.append(instantiationFields);
|
||||||
matlabAllocationCode.append("\t" + objectTableName.toUpper() + "_OBJID=" + objectID + ";\n");
|
matlabInstantiationCode.append("\t" + objectTableName.toUpper() + "_OBJID=" + objectID + ";\n");
|
||||||
|
matlabInstantiationCode.append("\t" + objectTableName.toUpper() + "_NUMBYTES=" + numBytesString + ";\n");
|
||||||
|
matlabInstantiationCode.append("\t" + objectName + "FidIdx = [];\n");
|
||||||
|
|
||||||
|
|
||||||
//==============================================================//
|
//==============================================================//
|
||||||
// Generate 'Switch:' code (will replace the $(SWITCHCODE) tag) //
|
// Generate 'Switch:' code (will replace the $(SWITCHCODE) tag) //
|
||||||
//==============================================================//
|
//==============================================================//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
matlabSwitchCode.append("\t\tcase " + objectTableName.toUpper() + "_OBJID\n");
|
matlabSwitchCode.append("\t\tcase " + objectTableName.toUpper() + "_OBJID\n");
|
||||||
// matlabSwitchCode.append("\t\t\t" + objectTableName + "(" + tableIdxName +") = " + functionCall + ";\n");
|
|
||||||
matlabSwitchCode.append("\t\t\t" + tableIdxName + " = " + tableIdxName +" + 1;\n");
|
matlabSwitchCode.append("\t\t\t" + tableIdxName + " = " + tableIdxName +" + 1;\n");
|
||||||
matlabSwitchCode.append("\t\t\t" + objectTableName + "= " + functionCall + objectTableName + ", " + tableIdxName + ");\n");
|
matlabSwitchCode.append("\t\t\t" + objectTableName + "FidIdx(" + tableIdxName + ") = bufferIdx; %#ok<*AGROW>\n");
|
||||||
matlabSwitchCode.append("\t\t\tif " + tableIdxName + " >= length(" + objectTableName +".timestamp) %Check to see if pre-allocated memory is exhausted\n");
|
matlabSwitchCode.append("\t\t\tbufferIdx=bufferIdx + " + objectTableName.toUpper() + "_NUMBYTES+1; %+1 is for CRC\n");
|
||||||
matlabSwitchCode.append("\t\t\t\tFieldNames= fieldnames(" + objectTableName +");\n");
|
if(!info->isSingleInst){
|
||||||
matlabSwitchCode.append("\t\t\t\tfor i=1:length(FieldNames) %Grow structure\n");
|
matlabSwitchCode.append("\t\t\tbufferIdx = bufferIdx + 2; %An extra two bytes for the instance ID\n");
|
||||||
matlabSwitchCode.append("\t\t\t\t\t" + objectTableName + ".(FieldNames{i})(:," + tableIdxName + "*2+1) = 0;\n");
|
}
|
||||||
matlabSwitchCode.append("\t\t\t\tend\n");
|
matlabSwitchCode.append("\t\t\tif " + tableIdxName + " >= length(" + objectTableName +"FidIdx) %Check to see if pre-allocated memory is exhausted\n");
|
||||||
|
matlabSwitchCode.append("\t\t\t\t" + objectTableName + "FidIdx(" + tableIdxName + "*2) = 0;\n");
|
||||||
matlabSwitchCode.append("\t\t\tend\n");
|
matlabSwitchCode.append("\t\t\tend\n");
|
||||||
|
|
||||||
|
|
||||||
//============================================================//
|
//============================================================//
|
||||||
// Generate 'Cleanup:' code (will replace the $(CLEANUP) tag) //
|
// Generate 'Cleanup:' code (will replace the $(CLEANUP) tag) //
|
||||||
//============================================================//
|
//============================================================//
|
||||||
matlabCleanupCode.append(objectTableName + "=PruneStructOfArrays(" + objectTableName + "," + tableIdxName +");\n" );
|
matlabCleanupCode.append(objectTableName + "FidIdx =" + objectTableName + "FidIdx(1:" + tableIdxName +");\n" );
|
||||||
|
|
||||||
|
//=================================================================//
|
||||||
|
// Generate functions code (will replace the $(ALLOCATIONCODE) tag) //
|
||||||
|
//=================================================================//
|
||||||
|
//Generate function description comment
|
||||||
|
matlabAllocationCode.append("% " + objectName + " typecasting\n");
|
||||||
|
QString allocationFields;
|
||||||
|
|
||||||
|
//Add timestamp
|
||||||
|
allocationFields.append("\t" + objectName + ".timestamp = " +
|
||||||
|
"double(typecast(buffer(mcolon(" + objectName + "FidIdx "
|
||||||
|
"- 20, " + objectName + "FidIdx + 4-1 -20)), 'uint32'))';\n");
|
||||||
|
|
||||||
|
int currentIdx=0;
|
||||||
|
|
||||||
|
//Add Instance ID, if necessary
|
||||||
|
if(!info->isSingleInst){
|
||||||
|
allocationFields.append("\t" + objectName + ".instanceID = " +
|
||||||
|
"double(typecast(buffer(mcolon(" + objectName + "FidIdx "
|
||||||
|
", " + objectName + "FidIdx + 2-1)), 'uint16'))';\n");
|
||||||
|
currentIdx+=2;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int n = 0; n < info->fields.length(); ++n) {
|
||||||
|
// Determine variabel type
|
||||||
|
type = fieldTypeStrMatlab[info->fields[n]->type];
|
||||||
|
|
||||||
|
//Determine variable type length
|
||||||
|
QString size = fieldSizeStrMatlab[info->fields[n]->type];
|
||||||
|
// Append field
|
||||||
|
if ( info->fields[n]->numElements > 1 ){
|
||||||
|
allocationFields.append("\t" + objectName + "." + info->fields[n]->name + " = " +
|
||||||
|
"reshape(double(typecast(buffer(mcolon(" + objectName + "FidIdx + " + QString("%1").arg(currentIdx) +
|
||||||
|
", " + objectName + "FidIdx + " + QString("%1").arg(currentIdx + size.toInt()*info->fields[n]->numElements - 1) + ")), '" + type + "')), "+ QString::number(info->fields[n]->numElements, 10) + ", [] );\n");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
allocationFields.append("\t" + objectName + "." + info->fields[n]->name + " = " +
|
||||||
|
"double(typecast(buffer(mcolon(" + objectName + "FidIdx + " + QString("%1").arg(currentIdx) +
|
||||||
|
", " + objectName + "FidIdx + " + QString("%1").arg(currentIdx + size.toInt() - 1) + ")), '" + type + "'))';\n");
|
||||||
|
}
|
||||||
|
currentIdx+=size.toInt()*info->fields[n]->numElements;
|
||||||
|
}
|
||||||
|
matlabAllocationCode.append(allocationFields);
|
||||||
|
matlabAllocationCode.append("\n");
|
||||||
|
|
||||||
|
|
||||||
//========================================================================//
|
//========================================================================//
|
||||||
@ -159,55 +190,7 @@ bool UAVObjectGeneratorMatlab::process_object(ObjectInfo* info)
|
|||||||
matlabExportCsvCode.append("\tOPLog2csv(" + objectTableName + ", '"+objectTableName+"', logfile);\n");
|
matlabExportCsvCode.append("\tOPLog2csv(" + objectTableName + ", '"+objectTableName+"', logfile);\n");
|
||||||
// OPLog2csv(ActuatorCommand, 'ActuatorCommand', logfile)
|
// OPLog2csv(ActuatorCommand, 'ActuatorCommand', logfile)
|
||||||
|
|
||||||
//=================================================================//
|
|
||||||
// Generate functions code (will replace the $(FUNCTIONSCODE) tag) //
|
|
||||||
//=================================================================//
|
|
||||||
//Generate function description comment
|
|
||||||
matlabFunctionsCode.append("%%\n% " + objectName + " read function\n");
|
|
||||||
|
|
||||||
matlabFunctionsCode.append("function [" + objectName + "] = " + functionCall + objectTableName + ", " + tableIdxName + ")" + "\n");
|
|
||||||
|
|
||||||
|
|
||||||
matlabFunctionsCode.append("\t" + objectName + ".timestamp(" + tableIdxName + ")= timestamp;\n");
|
|
||||||
matlabFunctionsCode.append("\tif " + isSingleInst + "\n");
|
|
||||||
matlabFunctionsCode.append("\t\theaderSize = 8;\n");
|
|
||||||
matlabFunctionsCode.append("\telse\n");
|
|
||||||
matlabFunctionsCode.append("\t\t" + objectName + ".instanceID(" + tableIdxName + ") = (fread(fid, 1, 'uint16'));\n");
|
|
||||||
matlabFunctionsCode.append("\t\theaderSize = 10;\n");
|
|
||||||
matlabFunctionsCode.append("\tend\n\n");
|
|
||||||
|
|
||||||
// Generate functions code, actual fields of the object
|
|
||||||
QString funcfields;
|
|
||||||
|
|
||||||
matlabFunctionsCode.append("\tstartPos = ftell(fid) - headerSize;\n");
|
|
||||||
|
|
||||||
for (int n = 0; n < info->fields.length(); ++n) {
|
|
||||||
// Determine type
|
|
||||||
type = fieldTypeStrMatlab[info->fields[n]->type];
|
|
||||||
// Append field
|
|
||||||
if ( info->fields[n]->numElements > 1 )
|
|
||||||
funcfields.append("\t" + objectName + "." + info->fields[n]->name + "(:," + tableIdxName + ") = double(fread(fid, " + QString::number(info->fields[n]->numElements, 10) + ", '" + type + "'));\n");
|
|
||||||
else
|
|
||||||
funcfields.append("\t" + objectName + "." + info->fields[n]->name + "(" + tableIdxName + ") = double(fread(fid, 1, '" + type + "'));\n");
|
|
||||||
}
|
|
||||||
matlabFunctionsCode.append(funcfields);
|
|
||||||
|
|
||||||
matlabFunctionsCode.append("\tobjLen = ftell(fid) - startPos;\n");
|
|
||||||
|
|
||||||
matlabFunctionsCode.append("\t% read CRC\n");
|
|
||||||
matlabFunctionsCode.append("\tcrc_read = fread(fid, 1, '*uint8');\n");
|
|
||||||
|
|
||||||
matlabFunctionsCode.append("\tif checkCRC\n");
|
|
||||||
matlabFunctionsCode.append("\t\tfseek(fid, startPos, 'bof');\n");
|
|
||||||
matlabFunctionsCode.append("\t\tcrc_calc = compute_crc(uint8(fread(fid,objLen,'uint8')));\n");
|
|
||||||
matlabFunctionsCode.append("\t\tfread(fid,1,'uint8');\n");
|
|
||||||
matlabFunctionsCode.append("\t\tif (crc_calc ~= crc_read)\n");
|
|
||||||
matlabFunctionsCode.append("\t\t\tdisp('CRC Error')\n");
|
|
||||||
matlabFunctionsCode.append("\t\t\t" + tableIdxName + " = " + tableIdxName + " - 1;\n");
|
|
||||||
matlabFunctionsCode.append("\t\tend\n");
|
|
||||||
matlabFunctionsCode.append("\tend\n");
|
|
||||||
|
|
||||||
matlabFunctionsCode.append("\n\n");
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -35,14 +35,15 @@ public:
|
|||||||
bool generate(UAVObjectParser* gen,QString templatepath,QString outputpath);
|
bool generate(UAVObjectParser* gen,QString templatepath,QString outputpath);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool process_object(ObjectInfo* info);
|
bool process_object(ObjectInfo* info, int numBytes);
|
||||||
QString matlabAllocationCode;
|
QString matlabInstantiationCode;
|
||||||
QString matlabSwitchCode;
|
QString matlabSwitchCode;
|
||||||
QString matlabCleanupCode;
|
QString matlabCleanupCode;
|
||||||
|
QString matlabAllocationCode;
|
||||||
QString matlabSaveObjectsCode;
|
QString matlabSaveObjectsCode;
|
||||||
QString matlabExportCsvCode;
|
QString matlabExportCsvCode;
|
||||||
QString matlabFunctionsCode;
|
|
||||||
QStringList fieldTypeStrMatlab;
|
QStringList fieldTypeStrMatlab;
|
||||||
|
QStringList fieldSizeStrMatlab;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user