Massive clean thanks to Schwabe : unifdef -m -DCPUARM -UCPUM64 -UCPUM2560 -UPCBSTD -UPCBMEGA2560 -UPCBGRUVIN9X -UPCB9X $(find . -name "*.cpp" -or -name "*.h")
This commit is contained in:
@@ -30,59 +30,6 @@ void frskyCalculateCellStats(void);
|
||||
void displayVoltagesScreen();
|
||||
#endif
|
||||
|
||||
#if defined(TELEMETRY_FRSKY) && !defined(CPUARM)
|
||||
TEST(FrSky, gpsNfuel)
|
||||
{
|
||||
MODEL_RESET();
|
||||
TELEMETRY_RESET();
|
||||
g_model.frsky.usrProto = 1;
|
||||
telemetryData.hub.gpsFix = 1;
|
||||
|
||||
uint8_t pkt1[] = { 0xfd, 0x07, 0x00, 0x5e, 0x14, 0x2c, 0x00, 0x5e, 0x1c, 0x03 };
|
||||
uint8_t pkt2[] = { 0xfd, 0x07, 0x00, 0x00, 0x5e, 0x13, 0x38, 0x0c, 0x5e, 0x1b };
|
||||
uint8_t pkt3[] = { 0xfd, 0x07, 0x00, 0xc9, 0x06, 0x5e, 0x23, 0x4e, 0x00, 0x5e };
|
||||
uint8_t pkt4[] = { 0xfd, 0x07, 0x00, 0x12, 0xef, 0x2e, 0x5e, 0x1a, 0x98, 0x26 };
|
||||
uint8_t pkt5[] = { 0xfd, 0x07, 0x00, 0x5e, 0x22, 0x45, 0x00, 0x5e, 0x11, 0x02 };
|
||||
uint8_t pkt6[] = { 0xfd, 0x07, 0x00, 0x00, 0x5e, 0x19, 0x93, 0x00, 0x5e, 0x04 };
|
||||
uint8_t pkt7[] = { 0xfd, 0x03, 0x00, 0x64, 0x00, 0x5e };
|
||||
frskyDProcessPacket(pkt1);
|
||||
frskyDProcessPacket(pkt2);
|
||||
frskyDProcessPacket(pkt3);
|
||||
frskyDProcessPacket(pkt4);
|
||||
frskyDProcessPacket(pkt5);
|
||||
frskyDProcessPacket(pkt6);
|
||||
frskyDProcessPacket(pkt7);
|
||||
EXPECT_EQ(telemetryData.hub.gpsCourse_bp, 44);
|
||||
EXPECT_EQ(telemetryData.hub.gpsCourse_ap, 03);
|
||||
EXPECT_EQ(telemetryData.hub.gpsLongitude_bp / 100, 120);
|
||||
EXPECT_EQ(telemetryData.hub.gpsLongitude_bp % 100, 15);
|
||||
EXPECT_EQ(telemetryData.hub.gpsLongitude_ap, 0x2698);
|
||||
EXPECT_EQ(telemetryData.hub.gpsLatitudeNS, 'N');
|
||||
EXPECT_EQ(telemetryData.hub.gpsLongitudeEW, 'E');
|
||||
EXPECT_EQ(telemetryData.hub.fuelLevel, 100);
|
||||
}
|
||||
|
||||
TEST(FrSky, dateNtime)
|
||||
{
|
||||
MODEL_RESET();
|
||||
TELEMETRY_RESET();
|
||||
g_model.frsky.usrProto = 1;
|
||||
telemetryData.hub.gpsFix = 1;
|
||||
|
||||
uint8_t pkt1[] = { 0xfd, 0x07, 0x00, 0x5e, 0x15, 0x0f, 0x07, 0x5e, 0x16, 0x0b };
|
||||
uint8_t pkt2[] = { 0xfd, 0x07, 0x00, 0x00, 0x5e, 0x17, 0x06, 0x12, 0x5e, 0x18 };
|
||||
uint8_t pkt3[] = { 0xfd, 0x03, 0x00, 0x32, 0x00, 0x5e };
|
||||
frskyDProcessPacket(pkt1);
|
||||
frskyDProcessPacket(pkt2);
|
||||
frskyDProcessPacket(pkt3);
|
||||
EXPECT_EQ(telemetryData.hub.day, 15);
|
||||
EXPECT_EQ(telemetryData.hub.month, 07);
|
||||
EXPECT_EQ(telemetryData.hub.year, 11);
|
||||
EXPECT_EQ(telemetryData.hub.hour, 06);
|
||||
EXPECT_EQ(telemetryData.hub.min, 18);
|
||||
EXPECT_EQ(telemetryData.hub.sec, 50);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(TELEMETRY_FRSKY) && defined(CPUARM)
|
||||
TEST(FrSky, TelemetryValueWithMinAveraging)
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
class SpecialFunctionsTest : public OpenTxTest {};
|
||||
|
||||
#if defined(CPUARM)
|
||||
TEST_F(SpecialFunctionsTest, SwitchFiledSize)
|
||||
{
|
||||
// test the size of swtch member
|
||||
@@ -117,4 +116,3 @@ TEST_F(SpecialFunctionsTest, GvarsInc)
|
||||
|
||||
#endif // #if defined(PCBTARANIS) || defined(PCBHORUS)
|
||||
|
||||
#endif // #if defined(CPUARM)
|
||||
|
||||
@@ -70,10 +70,6 @@ inline void MIXER_RESET()
|
||||
memset(ex_chans, 0, sizeof(ex_chans));
|
||||
memset(act, 0, sizeof(act));
|
||||
memset(swOn, 0, sizeof(swOn));
|
||||
#if !defined(CPUARM)
|
||||
s_last_switch_used = 0;
|
||||
s_last_switch_value = 0;
|
||||
#endif
|
||||
mixerCurrentFlightMode = lastFlightMode = 0;
|
||||
lastAct = 0;
|
||||
logicalSwitchesReset();
|
||||
@@ -85,14 +81,12 @@ inline void TELEMETRY_RESET()
|
||||
memclear(&telemetryData, sizeof(telemetryData));
|
||||
TELEMETRY_RSSI() = 100;
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
for (int i=0; i<MAX_TELEMETRY_SENSORS; i++) {
|
||||
telemetryItems[i].clear();
|
||||
}
|
||||
#endif
|
||||
memclear(g_model.telemetrySensors, sizeof(g_model.telemetrySensors));
|
||||
#endif
|
||||
}
|
||||
|
||||
class OpenTxTest : public testing::Test
|
||||
|
||||
@@ -122,7 +122,6 @@ TEST(outdezNAtt, test_unsigned)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
TEST(outdezNAtt, testBigNumbers)
|
||||
{
|
||||
lcdClear();
|
||||
@@ -130,7 +129,6 @@ TEST(outdezNAtt, testBigNumbers)
|
||||
lcdDrawNumber(0, FH, -1234567, LEFT);
|
||||
EXPECT_TRUE(checkScreenshot("big_numbers"));
|
||||
}
|
||||
#endif // #if defined(CPUARM)
|
||||
|
||||
TEST(Lcd, Invers_0_0)
|
||||
{
|
||||
@@ -160,14 +158,12 @@ TEST(Lcd, Prec2_Right)
|
||||
EXPECT_TRUE(checkScreenshot("prec2_right"));
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
TEST(Lcd, Prec1_Dblsize_Invers)
|
||||
{
|
||||
lcdClear();
|
||||
lcdDrawNumber(LCD_W, 10, 51, PREC1|DBLSIZE|INVERS|RIGHT);
|
||||
EXPECT_TRUE(checkScreenshot("prec1_dblsize_invers"));
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST(Lcd, Line_Wrap)
|
||||
{
|
||||
@@ -183,14 +179,12 @@ TEST(Lcd, DblsizeBottomRight)
|
||||
EXPECT_TRUE(checkScreenshot("dblsize_bottom_right"));
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
TEST(Lcd, Smlsize_drawStringWithIndex)
|
||||
{
|
||||
lcdClear();
|
||||
drawStringWithIndex(0, 0, "FM", 0, SMLSIZE);
|
||||
EXPECT_TRUE(checkScreenshot("smlsize_drawstringwithindex"));
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST(Lcd, vline)
|
||||
{
|
||||
@@ -201,7 +195,6 @@ TEST(Lcd, vline)
|
||||
EXPECT_TRUE(checkScreenshot("vline"));
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
TEST(Lcd, vline_x_lt0)
|
||||
{
|
||||
lcdClear();
|
||||
@@ -209,9 +202,7 @@ TEST(Lcd, vline_x_lt0)
|
||||
lcdDrawSolidVerticalLine(100, -10, 1);
|
||||
EXPECT_TRUE(checkScreenshot("vline_lt0"));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
TEST(Lcd, Smlsize)
|
||||
{
|
||||
lcdClear();
|
||||
@@ -279,7 +270,6 @@ TEST(Lcd, Dblsize)
|
||||
|
||||
EXPECT_TRUE(checkScreenshot("dblsize"));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS) && LCD_W >= 212
|
||||
TEST(Lcd, DrawSwitch)
|
||||
|
||||
@@ -347,17 +347,10 @@ TEST_F(TrimsTest, infiniteChainedTrims)
|
||||
TEST_F(TrimsTest, CopyTrimsToOffset)
|
||||
{
|
||||
setTrimValue(0, ELE_STICK, -100); // -100 on elevator
|
||||
#if defined(CPUARM)
|
||||
evalFunctions(g_model.customFn, modelFunctionsContext); // it disables all safety channels
|
||||
copyTrimsToOffset(1);
|
||||
EXPECT_EQ(getTrimValue(0, ELE_STICK), -100); // unchanged
|
||||
EXPECT_EQ(g_model.limitData[1].offset, -195);
|
||||
#else
|
||||
evalFunctions(); // it disables all safety channels
|
||||
copyTrimsToOffset(1);
|
||||
EXPECT_EQ(getTrimValue(0, ELE_STICK), -100); // unchanged
|
||||
EXPECT_EQ(g_model.limitData[1].offset, -200);
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST_F(TrimsTest, CopySticksToOffset)
|
||||
@@ -408,127 +401,6 @@ TEST(Curves, LinearIntpol)
|
||||
}
|
||||
|
||||
|
||||
#if !defined(CPUARM)
|
||||
TEST(FlightModes, nullFadeOut_posFadeIn)
|
||||
{
|
||||
SYSTEM_RESET();
|
||||
MODEL_RESET();
|
||||
MIXER_RESET();
|
||||
modelDefault(0);
|
||||
lastFlightMode = 255;
|
||||
simuSetSwitch(3, 1);
|
||||
g_model.flightModeData[1].swtch = SWSRC_ID1;
|
||||
g_model.flightModeData[1].fadeIn = 15;
|
||||
evalMixes(1);
|
||||
simuSetSwitch(3, 0);
|
||||
evalMixes(1);
|
||||
// run mixes enough time to fade out flight modes (otherwise the mixer internal state flightModesFade could affect other tests)
|
||||
simuSetSwitch(3, 1);
|
||||
for(int n=0; n<200; n++) {
|
||||
evalMixes(1);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(MixerTest, R2029Comment)
|
||||
{
|
||||
SYSTEM_RESET();
|
||||
MODEL_RESET();
|
||||
MIXER_RESET();
|
||||
modelDefault(0);
|
||||
g_model.mixData[0].destCh = 0;
|
||||
g_model.mixData[0].srcRaw = MIXSRC_CH2;
|
||||
g_model.mixData[0].swtch = -SWSRC_THR;
|
||||
g_model.mixData[0].weight = 100;
|
||||
g_model.mixData[1].destCh = 1;
|
||||
g_model.mixData[1].srcRaw = MIXSRC_Thr;
|
||||
g_model.mixData[1].swtch = SWSRC_THR;
|
||||
g_model.mixData[1].weight = 100;
|
||||
anaInValues[THR_STICK] = 1024;
|
||||
simuSetSwitch(1, 1);
|
||||
evalFlightModeMixes(e_perout_mode_normal, 0);
|
||||
EXPECT_EQ(chans[0], 0);
|
||||
EXPECT_EQ(chans[1], CHANNEL_MAX);
|
||||
simuSetSwitch(1, 0);
|
||||
evalFlightModeMixes(e_perout_mode_normal, 0);
|
||||
EXPECT_EQ(chans[0], 0);
|
||||
EXPECT_EQ(chans[1], 0);
|
||||
simuSetSwitch(1, 1);
|
||||
evalFlightModeMixes(e_perout_mode_normal, 0);
|
||||
EXPECT_EQ(chans[0], 0);
|
||||
EXPECT_EQ(chans[1], CHANNEL_MAX);
|
||||
}
|
||||
|
||||
TEST_F(MixerTest, Cascaded3Channels)
|
||||
{
|
||||
SYSTEM_RESET();
|
||||
MODEL_RESET();
|
||||
MIXER_RESET();
|
||||
modelDefault(0);
|
||||
g_model.mixData[0].destCh = 0;
|
||||
g_model.mixData[0].srcRaw = MIXSRC_CH2;
|
||||
g_model.mixData[0].weight = 100;
|
||||
g_model.mixData[1].destCh = 1;
|
||||
g_model.mixData[1].srcRaw = MIXSRC_CH3;
|
||||
g_model.mixData[1].weight = 100;
|
||||
g_model.mixData[2].destCh = 2;
|
||||
g_model.mixData[2].srcRaw = MIXSRC_THR;
|
||||
g_model.mixData[2].weight = 100;
|
||||
simuSetSwitch(1, 1);
|
||||
evalFlightModeMixes(e_perout_mode_normal, 0);
|
||||
EXPECT_EQ(chans[0], CHANNEL_MAX);
|
||||
EXPECT_EQ(chans[1], CHANNEL_MAX);
|
||||
EXPECT_EQ(chans[2], CHANNEL_MAX);
|
||||
}
|
||||
|
||||
TEST_F(MixerTest, CascadedOrderedChannels)
|
||||
{
|
||||
g_model.mixData[0].destCh = 0;
|
||||
g_model.mixData[0].srcRaw = MIXSRC_THR;
|
||||
g_model.mixData[0].weight = 100;
|
||||
g_model.mixData[1].destCh = 1;
|
||||
g_model.mixData[1].srcRaw = MIXSRC_CH1;
|
||||
g_model.mixData[1].weight = 100;
|
||||
simuSetSwitch(1, 1);
|
||||
evalFlightModeMixes(e_perout_mode_normal, 0);
|
||||
EXPECT_EQ(chans[0], CHANNEL_MAX);
|
||||
EXPECT_EQ(chans[1], CHANNEL_MAX);
|
||||
}
|
||||
|
||||
TEST_F(MixerTest, Cascaded5Channels)
|
||||
{
|
||||
g_model.mixData[0].destCh = 0;
|
||||
g_model.mixData[0].srcRaw = MIXSRC_CH2;
|
||||
g_model.mixData[0].weight = 100;
|
||||
g_model.mixData[1].destCh = 1;
|
||||
g_model.mixData[1].srcRaw = MIXSRC_CH3;
|
||||
g_model.mixData[1].weight = 100;
|
||||
g_model.mixData[2].destCh = 2;
|
||||
g_model.mixData[2].srcRaw = MIXSRC_CH4;
|
||||
g_model.mixData[2].weight = 100;
|
||||
g_model.mixData[3].destCh = 3;
|
||||
g_model.mixData[3].srcRaw = MIXSRC_CH5;
|
||||
g_model.mixData[3].weight = 100;
|
||||
g_model.mixData[4].destCh = 4;
|
||||
g_model.mixData[4].srcRaw = MIXSRC_THR;
|
||||
g_model.mixData[4].weight = 100;
|
||||
for (uint8_t i=0; i<10; i++) {
|
||||
simuSetSwitch(1, 1);
|
||||
evalMixes(1);
|
||||
EXPECT_EQ(chans[0], CHANNEL_MAX);
|
||||
EXPECT_EQ(chans[1], CHANNEL_MAX);
|
||||
EXPECT_EQ(chans[2], CHANNEL_MAX);
|
||||
EXPECT_EQ(chans[3], CHANNEL_MAX);
|
||||
EXPECT_EQ(chans[4], CHANNEL_MAX);
|
||||
simuSetSwitch(1, 0);
|
||||
evalMixes(1);
|
||||
EXPECT_EQ(chans[0], -CHANNEL_MAX);
|
||||
EXPECT_EQ(chans[1], -CHANNEL_MAX);
|
||||
EXPECT_EQ(chans[2], -CHANNEL_MAX);
|
||||
EXPECT_EQ(chans[3], -CHANNEL_MAX);
|
||||
EXPECT_EQ(chans[4], -CHANNEL_MAX);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_F(MixerTest, InfiniteRecursiveChannels)
|
||||
{
|
||||
@@ -600,56 +472,6 @@ TEST_F(MixerTest, RecursiveAddChannelAfterInactivePhase)
|
||||
EXPECT_EQ(chans[1], CHANNEL_MAX);
|
||||
}
|
||||
|
||||
#if !defined(CPUARM)
|
||||
TEST_F(MixerTest, SlowOnSwitch)
|
||||
{
|
||||
g_model.mixData[0].destCh = 0;
|
||||
g_model.mixData[0].mltpx = MLTPX_ADD;
|
||||
g_model.mixData[0].srcRaw = MIXSRC_MAX;
|
||||
g_model.mixData[0].weight = 100;
|
||||
g_model.mixData[0].swtch = SWSRC_THR;
|
||||
g_model.mixData[0].speedUp = SLOW_STEP*5;
|
||||
g_model.mixData[0].speedDown = SLOW_STEP*5;
|
||||
|
||||
s_mixer_first_run_done = true;
|
||||
|
||||
evalFlightModeMixes(e_perout_mode_normal, 0);
|
||||
EXPECT_EQ(chans[0], 0);
|
||||
|
||||
simuSetSwitch(1, 1);
|
||||
CHECK_SLOW_MOVEMENT(0, +1, 250);
|
||||
|
||||
simuSetSwitch(1, -1);
|
||||
CHECK_SLOW_MOVEMENT(0, -1, 250);
|
||||
}
|
||||
|
||||
TEST_F(MixerTest, SlowUpOnSwitch)
|
||||
{
|
||||
g_model.mixData[0].destCh = 0;
|
||||
g_model.mixData[0].mltpx = MLTPX_ADD;
|
||||
g_model.mixData[0].srcRaw = MIXSRC_MAX;
|
||||
g_model.mixData[0].weight = 100;
|
||||
g_model.mixData[0].swtch = SWSRC_THR;
|
||||
g_model.mixData[0].speedUp = SLOW_STEP*5;
|
||||
g_model.mixData[0].speedDown = 0;
|
||||
|
||||
simuSetSwitch(1, 0);
|
||||
evalFlightModeMixes(e_perout_mode_normal, 0);
|
||||
s_mixer_first_run_done = true;
|
||||
EXPECT_EQ(chans[0], 0);
|
||||
|
||||
simuSetSwitch(1, 1);
|
||||
CHECK_SLOW_MOVEMENT(0, +1, 250);
|
||||
|
||||
simuSetSwitch(1, 0);
|
||||
evalFlightModeMixes(e_perout_mode_normal, 1);
|
||||
EXPECT_EQ(chans[0], 0);
|
||||
|
||||
lastAct = 0;
|
||||
simuSetSwitch(1, 1);
|
||||
CHECK_SLOW_MOVEMENT(0, +1, 100);
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_F(MixerTest, SlowOnPhase)
|
||||
{
|
||||
@@ -673,36 +495,6 @@ TEST_F(MixerTest, SlowOnPhase)
|
||||
CHECK_SLOW_MOVEMENT(0, -1, 250);
|
||||
}
|
||||
|
||||
#if !defined(CPUARM)
|
||||
TEST_F(MixerTest, SlowOnSwitchAndPhase)
|
||||
{
|
||||
g_model.flightModeData[1].swtch = TR(SWSRC_THR, SWSRC_SA0);
|
||||
g_model.mixData[0].destCh = 0;
|
||||
g_model.mixData[0].mltpx = MLTPX_ADD;
|
||||
g_model.mixData[0].srcRaw = MIXSRC_MAX;
|
||||
g_model.mixData[0].weight = 100;
|
||||
g_model.mixData[0].swtch = TR(SWSRC_THR, SWSRC_SA0);
|
||||
#if defined(CPUARM)
|
||||
g_model.mixData[0].flightModes = 0x2 + 0x4 + 0x8 + 0x10 + 0x20 + 0x40 + 0x80 + 0x100 /*only enabled in phase 0*/;
|
||||
#else
|
||||
g_model.mixData[0].flightModes = 0x2 + 0x4 + 0x8 + 0x10 /*only enabled in phase 0*/;
|
||||
#endif
|
||||
g_model.mixData[0].speedUp = SLOW_STEP*5;
|
||||
g_model.mixData[0].speedDown = SLOW_STEP*5;
|
||||
|
||||
s_mixer_first_run_done = true;
|
||||
evalFlightModeMixes(e_perout_mode_normal, 0);
|
||||
EXPECT_EQ(chans[0], 0);
|
||||
|
||||
simuSetSwitch(1, 1);
|
||||
mixerCurrentFlightMode = 0;
|
||||
CHECK_SLOW_MOVEMENT(0, +1, 250);
|
||||
|
||||
simuSetSwitch(1, -1);
|
||||
mixerCurrentFlightMode = 1;
|
||||
CHECK_SLOW_MOVEMENT(0, -1, 250);
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_F(MixerTest, SlowOnSwitchSource)
|
||||
{
|
||||
@@ -775,63 +567,7 @@ TEST_F(MixerTest, DelayOnSwitch)
|
||||
EXPECT_EQ(chans[0], 0);
|
||||
}
|
||||
|
||||
#if !defined(CPUARM)
|
||||
TEST_F(MixerTest, SlowAndDelayOnReplace3POSSource)
|
||||
{
|
||||
g_model.mixData[0].destCh = 0;
|
||||
g_model.mixData[0].mltpx = MLTPX_REP;
|
||||
g_model.mixData[0].srcRaw = MIXSRC_3POS;
|
||||
g_model.mixData[0].weight = 100;
|
||||
g_model.mixData[0].delayUp = 10;
|
||||
g_model.mixData[0].speedUp = SLOW_STEP*5;
|
||||
g_model.mixData[0].speedDown = SLOW_STEP*5;
|
||||
|
||||
s_mixer_first_run_done = true;
|
||||
|
||||
simuSetSwitch(0, -1);
|
||||
CHECK_SLOW_MOVEMENT(0, -1, 250);
|
||||
EXPECT_EQ(chans[0], -CHANNEL_MAX);
|
||||
|
||||
simuSetSwitch(0, 0);
|
||||
CHECK_DELAY(0, 500);
|
||||
CHECK_SLOW_MOVEMENT(0, +1, 250/*half course*/);
|
||||
EXPECT_EQ(chans[0], 0);
|
||||
|
||||
simuSetSwitch(0, 1);
|
||||
CHECK_DELAY(0, 500);
|
||||
CHECK_SLOW_MOVEMENT(0, +1, 250);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM)
|
||||
TEST_F(MixerTest, SlowOnSwitchReplace)
|
||||
{
|
||||
g_model.mixData[0].destCh = 0;
|
||||
g_model.mixData[0].mltpx = MLTPX_ADD;
|
||||
g_model.mixData[0].srcRaw = MIXSRC_MAX;
|
||||
g_model.mixData[0].weight = 50;
|
||||
g_model.mixData[1].destCh = 0;
|
||||
g_model.mixData[1].mltpx = MLTPX_REP;
|
||||
g_model.mixData[1].srcRaw = MIXSRC_MAX;
|
||||
g_model.mixData[1].weight = 100;
|
||||
g_model.mixData[1].swtch = SWSRC_THR;
|
||||
g_model.mixData[1].speedDown = SLOW_STEP*5;
|
||||
|
||||
simuSetSwitch(1, 0);
|
||||
evalFlightModeMixes(e_perout_mode_normal, 1);
|
||||
EXPECT_EQ(chans[0], CHANNEL_MAX/2);
|
||||
|
||||
simuSetSwitch(1, 1);
|
||||
evalFlightModeMixes(e_perout_mode_normal, 1);
|
||||
// slow is not applied, but it's better than the first mix not applied at all!
|
||||
EXPECT_EQ(chans[0], CHANNEL_MAX);
|
||||
|
||||
simuSetSwitch(1, 0);
|
||||
evalFlightModeMixes(e_perout_mode_normal, 1);
|
||||
// slow is not applied, but it's better than the first mix not applied at all!
|
||||
EXPECT_EQ(chans[0], CHANNEL_MAX/2);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(VIRTUAL_INPUTS)
|
||||
TEST_F(MixerTest, NoTrimOnInactiveMix)
|
||||
|
||||
@@ -29,21 +29,6 @@ TEST(getSwitch, undefCSW)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM)
|
||||
TEST(getSwitch, circularCSW)
|
||||
{
|
||||
MODEL_RESET();
|
||||
MIXER_RESET();
|
||||
g_model.logicalSw[0] = { SWSRC_SW1, SWSRC_SW1, LS_FUNC_OR };
|
||||
g_model.logicalSw[1] = { SWSRC_SW1, SWSRC_SW1, LS_FUNC_AND };
|
||||
|
||||
evalLogicalSwitches();
|
||||
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
|
||||
EXPECT_EQ(getSwitch(-SWSRC_SW1), true);
|
||||
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
|
||||
EXPECT_EQ(getSwitch(-SWSRC_SW2), true);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(VIRTUAL_INPUTS)
|
||||
void setLogicalSwitch(int index, uint16_t _func, int16_t _v1, int16_t _v2, int16_t _v3 = 0, uint8_t _delay = 0, uint8_t _duration = 0, int8_t _andsw = 0)
|
||||
@@ -99,38 +84,6 @@ TEST(getSwitch, nullSW)
|
||||
EXPECT_EQ(getSwitch(0), true);
|
||||
}
|
||||
|
||||
#if !defined(CPUARM)
|
||||
TEST(getSwitch, recursiveSW)
|
||||
{
|
||||
MODEL_RESET();
|
||||
MIXER_RESET();
|
||||
|
||||
g_model.logicalSw[0] = { SWSRC_RUD, -SWSRC_SW2, LS_FUNC_OR };
|
||||
g_model.logicalSw[1] = { SWSRC_ELE, -SWSRC_SW1, LS_FUNC_OR };
|
||||
|
||||
simuSetSwitch(2, 0); // RUD 0
|
||||
simuSetSwitch(3, 0); // ELE 0
|
||||
evalLogicalSwitches();
|
||||
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
|
||||
EXPECT_EQ(getSwitch(SWSRC_SW2), true);
|
||||
|
||||
LS_RECURSIVE_EVALUATION_RESET();
|
||||
evalLogicalSwitches();
|
||||
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
|
||||
EXPECT_EQ(getSwitch(SWSRC_SW2), true);
|
||||
|
||||
simuSetSwitch(2, 1); // RUD 1
|
||||
LS_RECURSIVE_EVALUATION_RESET();
|
||||
evalLogicalSwitches();
|
||||
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
|
||||
EXPECT_EQ(getSwitch(SWSRC_SW2), true);
|
||||
|
||||
LS_RECURSIVE_EVALUATION_RESET();
|
||||
evalLogicalSwitches();
|
||||
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
|
||||
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
|
||||
}
|
||||
#endif // #if !defined(CPUARM)
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
TEST(getSwitch, inputWithTrim)
|
||||
|
||||
@@ -20,16 +20,6 @@
|
||||
|
||||
#include "gtests.h"
|
||||
|
||||
#if !defined(CPUARM)
|
||||
#undef timerSet
|
||||
void timerSet(int idx, int16_t val)
|
||||
{
|
||||
TimerState & timerState = timersStates[idx];
|
||||
timerState.state = TMR_OFF; // is changed to RUNNING dep from mode
|
||||
timerState.val = val;
|
||||
timerState.val_10ms = 0 ;
|
||||
}
|
||||
#endif // #if !defined(CPUARM)
|
||||
|
||||
#if defined(ACCURAT_THROTTLE_TIMER)
|
||||
#define THR_100 128 // approximately 10% full throttle
|
||||
@@ -78,7 +68,6 @@ TEST(Timers, timerReset)
|
||||
EXPECT_TRUE(evalTimersForNSecondsAndTest(0, THR_100, 1, TMR_OFF, 0));
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
TEST(Timers, timerSet)
|
||||
{
|
||||
timerSet(0, 500);
|
||||
@@ -95,9 +84,7 @@ TEST(Timers, timerGreaterThan9hours)
|
||||
// test with 24 hours
|
||||
EXPECT_TRUE(evalTimersForNSecondsAndTest(24*3600, THR_100, 0, TMR_RUNNING, 24*3600));
|
||||
}
|
||||
#endif // #if defined(CPUARM)
|
||||
|
||||
#if defined(CPUARM) || defined(CPUM2560)
|
||||
TEST(Timers, saveRestoreTimers)
|
||||
{
|
||||
g_model.timers[0].persistent = 1;
|
||||
@@ -116,7 +103,6 @@ TEST(Timers, saveRestoreTimers)
|
||||
EXPECT_TRUE(evalTimersForNSecondsAndTest(0, THR_100, 0, TMR_OFF, 500));
|
||||
EXPECT_TRUE(evalTimersForNSecondsAndTest(0, THR_100, 1, TMR_OFF, 1500));
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST(Timers, timerOff)
|
||||
{
|
||||
@@ -149,12 +135,6 @@ TEST(Timers, timerAbsolute)
|
||||
EXPECT_TRUE(evalTimersForNSecondsAndTest(100, THR_100, 0, TMR_NEGATIVE, -1));
|
||||
EXPECT_TRUE(evalTimersForNSecondsAndTest(100, THR_100, 0, TMR_STOPPED, -101));
|
||||
|
||||
#if !defined(CPUARM)
|
||||
// min timer value test
|
||||
timerSet(0, TIMER_MIN+10);
|
||||
EXPECT_TRUE(evalTimersForNSecondsAndTest(1, THR_100, 0, TMR_RUNNING, TIMER_MIN+9));
|
||||
EXPECT_TRUE(evalTimersForNSecondsAndTest(100, THR_100, 0, TMR_RUNNING, TIMER_MIN));
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(Timers, timerThrottle)
|
||||
|
||||
Reference in New Issue
Block a user