/* * Authors (alphabetical order) * - Bertrand Songis * - Bryan J. Rentoul (Gruvin) * - Cameron Weeks * - Erez Raviv * - Jean-Pierre Parisy * - Karl Szmutny * - Michael Blandford * - Michal Hlavinka * - Pat Mackenzie * - Philip Moss * - Rob Thomson * - Romolo Manfredini * - Thomas Husterer * * open9x is based on code named * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, * er9x by Erez Raviv: http://code.google.com/p/er9x/, * and the original (and ongoing) project by * Thomas Husterer, th9x: http://code.google.com/p/th9x/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #include #include "open9x.h" void doMixerCalculations(); #define MODEL_RESET() memset(&g_model, 0, sizeof(g_model)) #define MIXER_RESET() \ memset(g_chans512, 0, sizeof(g_chans512)); \ memset(ex_chans, 0, sizeof(ex_chans)) uint16_t anaIn(uint8_t chan) { return 0; } TEST(Trims, greaterTrimLink) { MODEL_RESET(); setTrimValue(1, 0, TRIM_EXTENDED_MAX+3); // link to FP3 trim setTrimValue(3, 0, 32); EXPECT_EQ(getRawTrimValue(getTrimFlightPhase(1, 0), 0), 32); } TEST(Trims, chainedTrims) { MODEL_RESET(); setTrimValue(0, 0, 32); setTrimValue(1, 0, TRIM_EXTENDED_MAX+1); // link to FP0 trim setTrimValue(2, 0, TRIM_EXTENDED_MAX+2); // link to FP1 trim EXPECT_EQ(getRawTrimValue(getTrimFlightPhase(0, 2), 0), 32); } TEST(Trims, infiniteChainedTrims) { MODEL_RESET(); setTrimValue(0, 0, 32); setTrimValue(1, 0, TRIM_EXTENDED_MAX+3); // link to FP3 trim setTrimValue(2, 0, TRIM_EXTENDED_MAX+2); // link to FP1 trim setTrimValue(3, 0, TRIM_EXTENDED_MAX+3); // link to FP2 trim EXPECT_EQ(getRawTrimValue(getTrimFlightPhase(0, 2), 0), 32); } TEST(outdezNAtt, test_unsigned) { uint16_t altitude = 65530; uint8_t refBuf[sizeof(displayBuf)]; memset(displayBuf, 0, sizeof(displayBuf)); lcd_putc(0*FWNUM, 0, '6'); lcd_putc(1*FWNUM, 0, '5'); lcd_putc(2*FWNUM, 0, '5'); lcd_putc(3*FWNUM, 0, '3'); lcd_putc(4*FWNUM, 0, '0'); memcpy(refBuf, displayBuf, sizeof(displayBuf)); memset(displayBuf, 0, sizeof(displayBuf)); lcd_outdezNAtt(1, 0, altitude, LEFT|UNSIGN); EXPECT_EQ(memcmp(refBuf, displayBuf, sizeof(displayBuf)), 0) << "Unsigned numbers will be bad displayed"; } TEST(EEPROM, 1000_random_writes) { eepromFile = NULL; // in memory RlcFile f; uint8_t buf[1000]; uint8_t buf2[1000]; EeFsFormat(); for(int i=0; i<1000; i++) { int size = rand()%800; for(int j=0; j