16 changed files with 254 additions and 113 deletions
@ -0,0 +1,49 @@
@@ -0,0 +1,49 @@
|
||||
#include "RadioCalibrationData.h" |
||||
|
||||
RadioCalibrationData::RadioCalibrationData() |
||||
{ |
||||
data = new QVector<QVector<float> >(); |
||||
} |
||||
|
||||
RadioCalibrationData::RadioCalibrationData(const QVector<float> &aileron, |
||||
const QVector<float> &elevator, |
||||
const QVector<float> &rudder, |
||||
const QVector<float> &gyro, |
||||
const QVector<float> &pitch, |
||||
const QVector<float> &throttle) |
||||
{ |
||||
data = new QVector<QVector<float> >(); |
||||
(*data) << aileron |
||||
<< elevator |
||||
<< rudder |
||||
<< gyro |
||||
<< pitch |
||||
<< throttle; |
||||
} |
||||
|
||||
RadioCalibrationData::RadioCalibrationData(const RadioCalibrationData &other) |
||||
:QObject() |
||||
{ |
||||
data = new QVector<QVector<float> >(*other.data); |
||||
} |
||||
|
||||
const float* RadioCalibrationData::operator [](int i) const |
||||
{ |
||||
if (i < data->size()) |
||||
{ |
||||
return (*data)[i].constData(); |
||||
} |
||||
|
||||
return NULL; |
||||
} |
||||
|
||||
const QVector<float>& RadioCalibrationData::operator ()(int i) const |
||||
{ |
||||
if (i < data->size()) |
||||
{ |
||||
return (*data)[i]; |
||||
} |
||||
|
||||
// This is not good. If it is ever used after being returned it will cause a crash
|
||||
return QVector<float>(); |
||||
} |
@ -0,0 +1,53 @@
@@ -0,0 +1,53 @@
|
||||
#ifndef RADIOCALIBRATIONDATA_H |
||||
#define RADIOCALIBRATIONDATA_H |
||||
|
||||
#include <QObject> |
||||
#include <QDebug> |
||||
#include <QVector> |
||||
|
||||
|
||||
class RadioCalibrationData : public QObject |
||||
{ |
||||
Q_OBJECT |
||||
|
||||
public: |
||||
explicit RadioCalibrationData(); |
||||
RadioCalibrationData(const RadioCalibrationData&); |
||||
RadioCalibrationData(const QVector<float>& aileron, |
||||
const QVector<float>& elevator, |
||||
const QVector<float>& rudder, |
||||
const QVector<float>& gyro, |
||||
const QVector<float>& pitch, |
||||
const QVector<float>& throttle); |
||||
|
||||
enum RadioElement |
||||
{ |
||||
AILERON=0, |
||||
ELEVATOR, |
||||
RUDDER, |
||||
GYRO, |
||||
PITCH, |
||||
THROTTLE |
||||
}; |
||||
|
||||
void loadFile(); |
||||
void saveFile(); |
||||
void send(); |
||||
void receive(); |
||||
const float* operator[](int i) const; |
||||
const QVector<float>& operator()(int i) const; |
||||
|
||||
protected: |
||||
QVector<QVector<float> > *data; |
||||
|
||||
|
||||
void init(const QVector<float>& aileron, |
||||
const QVector<float>& elevator, |
||||
const QVector<float>& rudder, |
||||
const QVector<float>& gyro, |
||||
const QVector<float>& pitch, |
||||
const QVector<float>& throttle); |
||||
|
||||
}; |
||||
|
||||
#endif // RADIOCALIBRATIONDATA_H
|
Loading…
Reference in new issue