diff --git a/src/comm/Parameter.h b/src/comm/Parameter.h index 695cd8a79d6a24b474f006db54337c1196d1e329..038444af404878e4b4b248112652f4503714f1a6 100644 --- a/src/comm/Parameter.h +++ b/src/comm/Parameter.h @@ -61,8 +61,8 @@ namespace OpalRT const QGCParamID& getParamID() const {return *paramID;} void setOpalID(unsigned short opalID) {this->opalID = opalID;} - const QString& getSimulinkPath() {return *simulinkPath;} - const QString& getSimulinkName() {return *simulinkName;} + const QString& getSimulinkPath() const {return *simulinkPath;} + const QString& getSimulinkName() const {return *simulinkName;} uint8_t getComponentID() const {return componentID;} float getValue(); void setValue(float value); diff --git a/src/comm/ParameterList.h b/src/comm/ParameterList.h index 5a891f20b11a179409e00ce6cbe84f5acdb71726..c3eecc052d097619c1ccb139adf5d7787cfda212 100644 --- a/src/comm/ParameterList.h +++ b/src/comm/ParameterList.h @@ -53,11 +53,11 @@ namespace OpalRT const_iterator(const const_iterator& other); const_iterator& operator+=(int i) {index += i; return *this;} - bool operator<(const const_iterator& other) {return (this->paramList == other.paramList) + bool operator<(const const_iterator& other) const {return (this->paramList == other.paramList) &&(this->indexparamList == other.paramList) + bool operator==(const const_iterator& other) const {return (this->paramList == other.paramList) &&(this->index==other.index);} - bool operator!=(const const_iterator& other) {return !((*this) == other);} + bool operator!=(const const_iterator& other) const {return !((*this) == other);} const Parameter& operator*() const {return paramList[index];} const Parameter* operator->() const {return ¶mList[index];} diff --git a/src/ui/RadioCalibration/RadioCalibrationData.cc b/src/ui/RadioCalibration/RadioCalibrationData.cc index aba6ff1a3286d1812ad79fb4b3ad3b728539528b..530638d4708d2f78747968f5a3a873cbe653880d 100644 --- a/src/ui/RadioCalibration/RadioCalibrationData.cc +++ b/src/ui/RadioCalibration/RadioCalibrationData.cc @@ -48,18 +48,14 @@ const float* RadioCalibrationData::operator [](int i) const return NULL; } -const QVector& RadioCalibrationData::operator ()(int i) const +const QVector& RadioCalibrationData::operator ()(const int i) const throw(std::out_of_range) { - if (i < data->size()) + if ((i < data->size()) && (i >=0)) { return (*data)[i]; } - // FIXME Bryan - // FIXME James - - // This is not good. If it is ever used after being returned it will cause a crash -// return QVector(); + throw std::out_of_range("Invalid channel index"); } QString RadioCalibrationData::toString(RadioElement element) const diff --git a/src/ui/RadioCalibration/RadioCalibrationData.h b/src/ui/RadioCalibration/RadioCalibrationData.h index 4eb5b071c3626281ec41bbeb4997a2d9222986f7..f001bc340f8b3b0b1f196ef9813128eb66fce7eb 100644 --- a/src/ui/RadioCalibration/RadioCalibrationData.h +++ b/src/ui/RadioCalibration/RadioCalibrationData.h @@ -34,6 +34,7 @@ This file is part of the QGROUNDCONTROL project #include #include #include +#include /** @@ -66,7 +67,7 @@ public: }; const float* operator[](int i) const; - const QVector& operator()(int i) const; + const QVector& operator()(int i) const throw(std::out_of_range); void set(int element, int index, float value) {(*data)[element][index] = value;} public slots: diff --git a/src/ui/RadioCalibration/RadioCalibrationWindow.cc b/src/ui/RadioCalibration/RadioCalibrationWindow.cc index 4f3c7cf76eafe63b84484a74b418f86354cff264..9684ffc1100d1b7fa7b39e4f116bc683376d3cfb 100644 --- a/src/ui/RadioCalibration/RadioCalibrationWindow.cc +++ b/src/ui/RadioCalibration/RadioCalibrationWindow.cc @@ -52,38 +52,38 @@ RadioCalibrationWindow::RadioCalibrationWindow(QWidget *parent) : setUASId(0); } -void RadioCalibrationWindow::setChannelRaw(int ch, float raw) -{ - /** this expects a particular channel to function mapping - \todo allow run-time channel mapping - */ - switch (ch) - { - case 0: - aileron->channelChanged(raw); - break; - case 1: - elevator->channelChanged(raw); - break; - case 2: - throttle->channelChanged(raw); - break; - case 3: - rudder->channelChanged(raw); - break; - case 4: - gyro->channelChanged(raw); - break; - case 5: - pitch->channelChanged(raw); - break; +//void RadioCalibrationWindow::setChannelRaw(int ch, float raw) +//{ +// /** this expects a particular channel to function mapping +// \todo allow run-time channel mapping +// */ +// switch (ch) +// { +// case 0: +// aileron->channelChanged(raw); +// break; +// case 1: +// elevator->channelChanged(raw); +// break; +// case 2: +// throttle->channelChanged(raw); +// break; +// case 3: +// rudder->channelChanged(raw); +// break; +// case 4: +// gyro->channelChanged(raw); +// break; +// case 5: +// pitch->channelChanged(raw); +// break; - } -} +// } +//} -void RadioCalibrationWindow::setChannelScaled(int ch, float normalized) -{ +//void RadioCalibrationWindow::setChannelScaled(int ch, float normalized) +//{ // FIXME James // FIXME Bryan @@ -113,9 +113,9 @@ void RadioCalibrationWindow::setChannelScaled(int ch, float normalized) // } -} +//} -void RadioCalibrationWindow::setChannel(int ch, float raw, float normalized) +void RadioCalibrationWindow::setChannel(int ch, float raw) { /** this expects a particular channel to function mapping \todo allow run-time channel mapping diff --git a/src/ui/RadioCalibration/RadioCalibrationWindow.h b/src/ui/RadioCalibration/RadioCalibrationWindow.h index 3a3f55310632d49c71a7b1b9b883390a74a1e109..930515a7f5a59536d11ecc440ad364b9370fae01 100644 --- a/src/ui/RadioCalibration/RadioCalibrationWindow.h +++ b/src/ui/RadioCalibration/RadioCalibrationWindow.h @@ -66,9 +66,10 @@ public: explicit RadioCalibrationWindow(QWidget *parent = 0); public slots: - void setChannel(int ch, float raw, float normalized); - void setChannelRaw(int ch, float raw); - void setChannelScaled(int ch, float normalized); + void setChannel(int ch, float raw); + // @todo remove these functions if they are not needed - were added by lm on dec 14, 2010 +// void setChannelRaw(int ch, float raw); +// void setChannelScaled(int ch, float normalized); void loadFile(); void saveFile(); void send();