This commit is contained in:
Bertrand Songis
2019-09-09 16:00:26 +02:00
parent e8c7229ff2
commit dd25e82214
6 changed files with 41 additions and 7 deletions
+7
View File
@@ -26,6 +26,12 @@ TEST(Conversions, ConversionX9DPFrom22)
EXPECT_EQ(80, model.mixData[0].weight);
EXPECT_EQ(900, model.limitData[0].max); // -100
EXPECT_EQ(80, model.expoData[0].weight);
EXPECT_EQ(CurveReference::CURVE_REF_CUSTOM, model.expoData[0].curve.type);
EXPECT_EQ(1, model.expoData[0].curve.value);
EXPECT_EQ(CurveReference::CURVE_REF_EXPO, model.expoData[1].curve.type);
EXPECT_EQ(20, model.expoData[1].curve.value);
EXPECT_EQ(HELI_SWASH_TYPE_120X, model.swashRingData.type);
EXPECT_EQ(10, model.flightModeData[0].gvars[0]);
EXPECT_STREQ("Tes", model.gvarData[0].name);
@@ -48,6 +54,7 @@ TEST(Conversions, ConversionX9DPFrom23)
ASSERT_EQ(true, store.load(radioData));
const GeneralSettings& settings = radioData.generalSettings;
EXPECT_EQ(8, settings.speakerVolume);
EXPECT_EQ(RawSwitch(SWITCH_TYPE_TELEMETRY, 1), settings.customFn[0].swtch);
EXPECT_EQ(FuncLogs, settings.customFn[0].func);
EXPECT_EQ(20, settings.customFn[0].param);
@@ -153,6 +153,10 @@ void convertModelData_218_to_219(ModelData &model)
memmove(&newModel.expoData[i], &oldModel.expoData[i], sizeof(ExpoData_v218));
newModel.expoData[i].srcRaw = convertSource_218_to_219(newModel.expoData[i].srcRaw); // from newModel to avoid overwrite
newModel.expoData[i].swtch = convertSwitch_218_to_219(newModel.expoData[i].swtch); // from newModel to avoid overwrite
#if LCD_W == 212
newModel.expoData[i].offset = oldModel.expoData[i].offset; // 212x64: expo name has been reduced to 6 chars instead of 8
newModel.expoData[i].curve = oldModel.expoData[i].curve; // 212x64: expo name has been reduced to 6 chars instead of 8
#endif
}
for (uint8_t i=0; i<MAX_CURVES_218; i++) {
+8 -4
View File
@@ -33,7 +33,7 @@ void loadEEPROMFile(const char * filename)
#if defined(PCBX9DP)
TEST(Conversions, ConversionX9DPFrom22)
{
loadEEPROMFile(TESTS_BUILD_PATH "/eeprom_22_x9d+.bin");
loadEEPROMFile(TESTS_PATH "/eeprom_22_x9d+.bin");
eepromOpen();
eeLoadGeneralSettingsData();
@@ -58,6 +58,10 @@ TEST(Conversions, ConversionX9DPFrom22)
EXPECT_EQ(80, g_model.mixData[0].weight);
EXPECT_EQ(-100, g_model.limitData[0].max); // 90.0
EXPECT_EQ(80, g_model.expoData[0].weight);
EXPECT_EQ(CURVE_REF_CUSTOM, g_model.expoData[0].curve.type);
EXPECT_EQ(1, g_model.expoData[0].curve.value);
EXPECT_EQ(CURVE_REF_EXPO, g_model.expoData[1].curve.type);
EXPECT_EQ(20, g_model.expoData[1].curve.value);
EXPECT_EQ(SWASH_TYPE_120X, g_model.swashR.type);
EXPECT_EQ(10, g_model.flightModeData[0].gvars[0]);
EXPECT_ZSTREQ("Tes", g_model.gvars[0].name);
@@ -72,7 +76,7 @@ TEST(Conversions, ConversionX9DPFrom22)
TEST(Conversions, ConversionX9DPFrom23)
{
loadEEPROMFile(TESTS_BUILD_PATH "/eeprom_23_x9d+.bin");
loadEEPROMFile(TESTS_PATH "/eeprom_23_x9d+.bin");
eepromOpen();
eeLoadGeneralSettingsData();
@@ -116,7 +120,7 @@ TEST(Conversions, ConversionX9DPFrom23)
#if defined(PCBXLITE)
TEST(Conversions, ConversionXLiteFrom22)
{
loadEEPROMFile(TESTS_BUILD_PATH "/eeprom_22_xlite.bin");
loadEEPROMFile(TESTS_PATH "/eeprom_22_xlite.bin");
eepromOpen();
eeLoadGeneralSettingsData();
@@ -164,7 +168,7 @@ TEST(Conversions, ConversionXLiteFrom22)
#if defined(PCBX7)
TEST(Conversions, ConversionX7From22)
{
loadEEPROMFile(TESTS_BUILD_PATH "/eeprom_22_x7.bin");
loadEEPROMFile(TESTS_PATH "/eeprom_22_x7.bin");
eepromOpen();
eeLoadGeneralSettingsData();
Binary file not shown.
Binary file not shown.
+22 -3
View File
@@ -56,7 +56,8 @@ TEST(FrSky, Vfas_0x39_HiPrecision)
MODEL_RESET();
TELEMETRY_RESET();
EXPECT_EQ(telemetryItems[0].value, 0);
telemetryStreaming = TELEMETRY_TIMEOUT10ms;
telemetryData.telemetryValid = 0x07;
allowNewSensors = true;
// normal precision, resolution 0.1V
@@ -77,7 +78,8 @@ TEST(FrSky, HubAltNegative)
MODEL_RESET();
TELEMETRY_RESET();
EXPECT_EQ(telemetryItems[0].value, 0);
telemetryStreaming = TELEMETRY_TIMEOUT10ms;
telemetryData.telemetryValid = 0x07;
allowNewSensors = true;
// altimeter auto offset
@@ -122,6 +124,8 @@ TEST(FrSky, Gps)
{
MODEL_RESET();
TELEMETRY_RESET();
telemetryStreaming = TELEMETRY_TIMEOUT10ms;
telemetryData.telemetryValid = 0x07;
allowNewSensors = true;
EXPECT_EQ(telemetryItems[0].value, 0);
@@ -181,6 +185,8 @@ TEST(FrSkySPORT, FrSkyDCells)
{
MODEL_RESET();
TELEMETRY_RESET();
telemetryStreaming = TELEMETRY_TIMEOUT10ms;
telemetryData.telemetryValid = 0x07;
allowNewSensors = true;
uint8_t pkt1[] = { 0x7E, 0x98, 0x10, 0x06, 0x00, 0x07, 0xD0, 0x00, 0x00, 0x12 };
@@ -209,6 +215,8 @@ TEST(FrSkySPORT, frskySetCellVoltage)
MODEL_RESET();
TELEMETRY_RESET();
telemetryStreaming = TELEMETRY_TIMEOUT10ms;
telemetryData.telemetryValid = 0x07;
allowNewSensors = true;
// test that simulates 3 cell battery
@@ -300,6 +308,8 @@ TEST(FrSkySPORT, StrangeCellsBug)
{
MODEL_RESET();
TELEMETRY_RESET();
telemetryStreaming = TELEMETRY_TIMEOUT10ms;
telemetryData.telemetryValid = 0x07;
allowNewSensors = true;
uint8_t pkt[] = { 0x7E, 0x48, 0x10, 0x00, 0x03, 0x30, 0x15, 0x50, 0x81, 0xD5 };
@@ -316,6 +326,8 @@ TEST(FrSkySPORT, frskySetCellVoltageTwoSensors)
MODEL_RESET();
TELEMETRY_RESET();
telemetryStreaming = TELEMETRY_TIMEOUT10ms;
telemetryData.telemetryValid = 0x07;
allowNewSensors = true;
//sensor 1: 3 cell battery
@@ -387,6 +399,8 @@ TEST(FrSkySPORT, frskyVfas)
MODEL_RESET();
TELEMETRY_RESET();
telemetryStreaming = TELEMETRY_TIMEOUT10ms;
telemetryData.telemetryValid = 0x07;
allowNewSensors = true;
// tests for Vfas
@@ -426,10 +440,13 @@ TEST(FrSkySPORT, frskyCurrent)
MODEL_RESET();
TELEMETRY_RESET();
telemetryStreaming = TELEMETRY_TIMEOUT10ms;
telemetryData.telemetryValid = 0x07;
allowNewSensors = true;
// tests for Curr
generateSportFasCurrentPacket(packet, 0); sportProcessTelemetryPacket(packet);
generateSportFasCurrentPacket(packet, 0);
sportProcessTelemetryPacket(packet);
g_model.telemetrySensors[0].custom.offset = -5; /* unit: 1/10 amps */
generateSportFasCurrentPacket(packet, 0); sportProcessTelemetryPacket(packet);
EXPECT_EQ(telemetryItems[0].value, 0);
@@ -459,6 +476,8 @@ TEST(FrSkySPORT, frskyCurrent)
// test with positive offset
TELEMETRY_RESET();
telemetryStreaming = TELEMETRY_TIMEOUT10ms;
telemetryData.telemetryValid = 0x07;
g_model.telemetrySensors[0].custom.offset = +5; /* unit: 1/10 amps */
generateSportFasCurrentPacket(packet, 0); sportProcessTelemetryPacket(packet);