diff --git a/companion/src/CMakeLists.txt b/companion/src/CMakeLists.txt index 620402f00..a88fdc534 100644 --- a/companion/src/CMakeLists.txt +++ b/companion/src/CMakeLists.txt @@ -314,7 +314,7 @@ set(simu_SRCS ${ERSKY9X_CHECKOUT_DIRECTORY}/ersky9xsimulator.cpp ${RADIO_SRC_DIRECTORY}/bitmaps/sticks.lbm file.cpp # TODO not needed - helpers.cpp # TODO not needed + # helpers.cpp # TODO not needed modeledit/node.cpp modeledit/edge.cpp # TODO not needed simulation/main.cpp @@ -322,7 +322,7 @@ set(simu_SRCS set(simu_HDRS modeledit/node.h - helpers.h # TODO not needed + # helpers.h # TODO not needed myslider.h # TODO not needed ) diff --git a/companion/src/eeprominterface.cpp b/companion/src/eeprominterface.cpp index 36f1b27cc..0ada53cab 100644 --- a/companion/src/eeprominterface.cpp +++ b/companion/src/eeprominterface.cpp @@ -37,6 +37,47 @@ void getEEPROMString(char *dst, const char *src, int size) } } +float ValToTim(int value) +{ + return ((value < -109 ? 129+value : (value < 7 ? (113+value)*5 : (53+value)*10))/10.0); +} + +int TimToVal(float value) +{ + int temp; + if (value>60) { + temp=136+round((value-60)); + } + else if (value>2) { + temp=20+round((value-2.0)*2.0); + } + else { + temp=round(value*10.0); + } + return (temp-129); +} + +QString getSignedStr(int value) +{ + return value > 0 ? QString("+%1").arg(value) : QString("%1").arg(value); +} + +QString getGVarString(int16_t val, bool sign) +{ + if (val >= -10000 && val <= 10000) { + if (sign) + return QString("%1%").arg(getSignedStr(val)); + else + return QString("%1%").arg(val); + } + else { + if (val<0) + return QObject::tr("-GV%1").arg(-val-10000); + else + return QObject::tr("GV%1").arg(val-10000); + } +} + RawSourceRange RawSource::getRange(bool singleprec) { RawSourceRange result; diff --git a/companion/src/eeprominterface.h b/companion/src/eeprominterface.h index b9c863ea4..07919466c 100644 --- a/companion/src/eeprominterface.h +++ b/companion/src/eeprominterface.h @@ -1116,6 +1116,12 @@ extern QString EEPROMWarnings; void setEEPROMString(char *dst, const char *src, int size); void getEEPROMString(char *dst, const char *src, int size); +float ValToTim(int value); +int TimToVal(float value); + +QString getSignedStr(int value); +QString getGVarString(int16_t val, bool sign=false); + inline int applyStickMode(int stick, unsigned int mode) { if (mode == 0 || mode > 4) { diff --git a/companion/src/helpers.cpp b/companion/src/helpers.cpp index c93044bcc..840ab728b 100644 --- a/companion/src/helpers.cpp +++ b/companion/src/helpers.cpp @@ -636,24 +636,6 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData & b->setMaxVisibleItems(10); } -float ValToTim(int value) -{ - return ((value < -109 ? 129+value : (value < 7 ? (113+value)*5 : (53+value)*10))/10.0); -} - -int TimToVal(float value) -{ - int temp; - if (value>60) { - temp=136+round((value-60)); - } else if (value>2) { - temp=20+round((value-2.0)*2.0); - } else { - temp=round(value*10.0); - } - return (temp-129); -} - void populateCSWCB(QComboBox *b, int value) { int order[] = { @@ -695,27 +677,6 @@ void populateCSWCB(QComboBox *b, int value) b->setMaxVisibleItems(10); } -QString getSignedStr(int value) -{ - return value > 0 ? QString("+%1").arg(value) : QString("%1").arg(value); -} - -QString getGVarString(int16_t val, bool sign) -{ - if (val >= -10000 && val <= 10000) { - if (sign) - return QString("%1%").arg(getSignedStr(val)); - else - return QString("%1%").arg(val); - } - else { - if (val<0) - return QObject::tr("-GV%1").arg(-val-10000); - else - return QObject::tr("GV%1").arg(val-10000); - } -} - QString image2qstring(QImage image) { if (image.isNull()) diff --git a/companion/src/helpers.h b/companion/src/helpers.h index fc2e3d427..fdebcb170 100644 --- a/companion/src/helpers.h +++ b/companion/src/helpers.h @@ -109,8 +109,6 @@ void populateSourceCB(QComboBox *b, const RawSource &source, const ModelData & m void populateCSWCB(QComboBox *b, int value); QString getPhaseName(int val, char * phasename=NULL); QString getInputStr(ModelData & model, int index); -QString getSignedStr(int value); -QString getGVarString(int16_t val, bool sign=false); QString image2qstring(QImage image); QImage qstring2image(QString imagestr); int findmult(float value, float base); @@ -128,9 +126,6 @@ QString getFrSkyProtocol(int protocol); QString getFrSkyMeasure(int units); QString getFrSkySrc(int index); -float ValToTim(int value); -int TimToVal(float value); - void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx); #endif // HELPERS_H