Used rouding like arm radios (#4683)

This commit is contained in:
3djc
2017-03-25 13:04:33 +01:00
committed by Bertrand Songis
parent 1f7dd5a5bc
commit 98388a7ec8
2 changed files with 6 additions and 1 deletions
+5
View File
@@ -368,6 +368,11 @@ inline int divRoundClosest(const int n, const int d)
return ((n < 0) ^ (d < 0)) ? ((n - d/2)/d) : ((n + d/2)/d);
}
inline int calcRESXto100(int x)
{
return divRoundClosest(x*100, 1024);
}
#define CHECK_IN_ARRAY(T, index) ((unsigned int)index < DIM(T) ? T[(unsigned int)index] : "???")
extern QList<EEPROMInterface *> eepromInterfaces;