1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-30 08:24:11 +01:00

Merge branch 'next' into revo

This commit is contained in:
James Cotton 2012-06-14 01:02:03 -05:00
commit 4f37be785e
3 changed files with 19 additions and 8 deletions

View File

@ -312,7 +312,10 @@ bool ConfigFixedWingWidget::setupFrameFixedWing(QString airframeType)
int channel;
//disable all
for (channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++)
{
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
resetMixerVector(mixer, channel);
}
//motor
channel = m_aircraft->fwEngineChannelBox->currentIndex()-1;
@ -396,7 +399,10 @@ bool ConfigFixedWingWidget::setupFrameElevon(QString airframeType)
double value;
//disable all
for (channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++)
{
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
resetMixerVector(mixer, channel);
}
//motor
channel = m_aircraft->fwEngineChannelBox->currentIndex()-1;
@ -478,7 +484,10 @@ bool ConfigFixedWingWidget::setupFrameVtail(QString airframeType)
double value;
//disable all
for (channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++)
{
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
resetMixerVector(mixer, channel);
}
//motor
channel = m_aircraft->fwEngineChannelBox->currentIndex()-1;

View File

@ -112,10 +112,12 @@ void UAVTalk::processInputStream()
{
quint8 tmp;
while (io->bytesAvailable() > 0)
{
io->read((char*)&tmp, 1);
processInputByte(tmp);
if (io && io->isReadable()) {
while (io->bytesAvailable() > 0)
{
io->read((char*)&tmp, 1);
processInputByte(tmp);
}
}
}
@ -719,9 +721,8 @@ bool UAVTalk::transmitNack(quint32 objId)
qToLittleEndian<quint16>(dataOffset, &txBuffer[2]);
// Send buffer, check that the transmit backlog does not grow above limit
if ( io->bytesToWrite() < TX_BUFFER_SIZE )
if (io && io->isWritable() && io->bytesToWrite() < TX_BUFFER_SIZE )
{
io->write((const char*)txBuffer, dataOffset+CHECKSUM_LENGTH);
}
@ -811,7 +812,7 @@ bool UAVTalk::transmitSingleObject(UAVObject* obj, quint8 type, bool allInstance
txBuffer[dataOffset+length] = updateCRC(0, txBuffer, dataOffset + length);
// Send buffer, check that the transmit backlog does not grow above limit
if ( io->bytesToWrite() < TX_BUFFER_SIZE )
if (io && io->isWritable() && io->bytesToWrite() < TX_BUFFER_SIZE )
{
io->write((const char*)txBuffer, dataOffset+length+CHECKSUM_LENGTH);
}

View File

@ -27,6 +27,7 @@
#ifndef UAVTALK_H
#define UAVTALK_H
#include <QtCore>
#include <QIODevice>
#include <QMutex>
#include <QMutexLocker>
@ -93,7 +94,7 @@ private:
typedef enum {STATE_SYNC, STATE_TYPE, STATE_SIZE, STATE_OBJID, STATE_INSTID, STATE_DATA, STATE_CS} RxStateType;
// Variables
QIODevice* io;
QPointer<QIODevice> io;
UAVObjectManager* objMngr;
QMutex* mutex;
UAVObject* respObj;