One TODO less ...
This commit is contained in:
@@ -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
|
||||
)
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user