[all] Custom functions reworked

[all] Expo function rewritten and many other flash savings (thanks Andreas)
[stock] LONG key press duration is longer
[stock] Rotary Encoder bugs fixed
[stock/gruvin9x] Play Both function added
!!! TRANSLATIONS ALL NEED TO BE UPDATED BEFORE NEXT RELEASE
This commit is contained in:
bsongis
2013-02-15 20:11:12 +00:00
parent 5cda44ac0b
commit d64a71f5ab
22 changed files with 456 additions and 388 deletions
+17
View File
@@ -32,6 +32,7 @@
*
*/
#include <math.h>
#include <gtest/gtest.h>
#include "open9x.h"
@@ -219,6 +220,8 @@ TEST(EEPROM, rm)
EXPECT_EQ(sz, 0);
}
#if defined(FRSKY)
extern void processFrskyPacket(uint8_t *packet);
TEST(FrSky, gpsNfuel)
@@ -266,6 +269,8 @@ TEST(FrSky, dateNtime)
EXPECT_EQ(frskyData.hub.sec, 50);
}
#endif
TEST(getSwitch, undefCSW)
{
MODEL_RESET();
@@ -425,6 +430,18 @@ TEST(Mixer, RecursiveAddChannel)
EXPECT_EQ(chans[1], 0);
}
TEST(Expo, AllValues)
{
// TODO whole range
for (uint16_t x=0; x<100; x++) {
for (uint16_t k=0; k<100; k++) {
// TODO compare with the correct function instead of this one
uint16_t ref = ((unsigned long)x*x*x/0x10000*k/(RESXul*RESXul/0x10000) + (RESKul-k)*x+RESKul/2)/RESKul;
EXPECT_EQ(expou(x, k), ref);
}
}
}
int main(int argc, char **argv) {
StartEepromThread(NULL);