Add sane defaults for X10/X12. Also set battery warnings when creating general settings in simulator/companion (#5465)
This commit is contained in:
committed by
Bertrand Songis
parent
a7e4b0b062
commit
6bc02fd838
@@ -1178,7 +1178,6 @@ GeneralSettings::GeneralSettings()
|
|||||||
memset(this, 0, sizeof(GeneralSettings));
|
memset(this, 0, sizeof(GeneralSettings));
|
||||||
|
|
||||||
contrast = 25;
|
contrast = 25;
|
||||||
vBatWarn = 90;
|
|
||||||
|
|
||||||
for (int i=0; i < CPN_MAX_ANALOGS; ++i) {
|
for (int i=0; i < CPN_MAX_ANALOGS; ++i) {
|
||||||
calibMid[i] = 0x200;
|
calibMid[i] = 0x200;
|
||||||
@@ -1189,7 +1188,29 @@ GeneralSettings::GeneralSettings()
|
|||||||
Firmware * firmware = Firmware::getCurrentVariant();
|
Firmware * firmware = Firmware::getCurrentVariant();
|
||||||
Board::Type board = firmware->getBoard();
|
Board::Type board = firmware->getBoard();
|
||||||
|
|
||||||
for (int i=0; i<getBoardCapability(board, Board::FactoryInstalledSwitches); i++) {
|
// vBatWarn is voltage in 100mV, vBatMin is in 100mV but with -9V offset, vBatMax has a -12V offset
|
||||||
|
vBatWarn = 90;
|
||||||
|
if (IS_TARANIS_X9E(board) || IS_HORUS_X12S(board)) {
|
||||||
|
// NI-MH 9.6V
|
||||||
|
vBatWarn = 87;
|
||||||
|
vBatMin = -5; //8,5V
|
||||||
|
vBatMax = -5; //11,5V
|
||||||
|
}
|
||||||
|
else if (IS_HORUS_X10(board)) {
|
||||||
|
// Lipo 2V
|
||||||
|
vBatWarn = 66;
|
||||||
|
vBatMin = -28; // 6.2V
|
||||||
|
vBatMax = -38; // 8.2V
|
||||||
|
}
|
||||||
|
else if (IS_TARANIS(board)) {
|
||||||
|
// NI-MH 7.2V, X9D, X9D+ and X7
|
||||||
|
vBatWarn = 65;
|
||||||
|
vBatMin = -30; //6V
|
||||||
|
vBatMax = -40; //8V
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for (int i=0; i<getBoardCapability(board, Board::FactoryInstalledSwitches); i++) {
|
||||||
switchConfig[i] = Boards::getSwitchInfo(board, i).config;
|
switchConfig[i] = Boards::getSwitchInfo(board, i).config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-6
@@ -259,16 +259,22 @@ void generalDefault()
|
|||||||
g_eeGeneral.switchConfig = 0x00007bff; // 6x3POS, 1x2POS, 1xTOGGLE
|
g_eeGeneral.switchConfig = 0x00007bff; // 6x3POS, 1x2POS, 1xTOGGLE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBX9E)
|
// vBatWarn is voltage in 100mV, vBatMin is in 100mV but with -9V offset, vBatMax has a -12V offset
|
||||||
|
#if defined(PCBX9E) || defined(PCBX12S)
|
||||||
// NI-MH 9.6V
|
// NI-MH 9.6V
|
||||||
g_eeGeneral.vBatWarn = 87;
|
g_eeGeneral.vBatWarn = 87;
|
||||||
g_eeGeneral.vBatMin = -5;
|
g_eeGeneral.vBatMin = -5; //8,5V
|
||||||
g_eeGeneral.vBatMax = -5;
|
g_eeGeneral.vBatMax = -5; //11,5V
|
||||||
|
#elif defined(PCBX10)
|
||||||
|
// Lipo 2V
|
||||||
|
g_eeGeneral.vBatWarn = 66;
|
||||||
|
g_eeGeneral.vBatMin = -28; // 6.2V
|
||||||
|
g_eeGeneral.vBatMax = -38; // 8.2V
|
||||||
#elif defined(PCBTARANIS)
|
#elif defined(PCBTARANIS)
|
||||||
// NI-MH 7.2V
|
// NI-MH 7.2V, X9D, X9D+ and X7
|
||||||
g_eeGeneral.vBatWarn = 65;
|
g_eeGeneral.vBatWarn = 65;
|
||||||
g_eeGeneral.vBatMin = -30;
|
g_eeGeneral.vBatMin = -30; //6V
|
||||||
g_eeGeneral.vBatMax = -40;
|
g_eeGeneral.vBatMax = -40; //8V
|
||||||
#else
|
#else
|
||||||
g_eeGeneral.vBatWarn = 90;
|
g_eeGeneral.vBatWarn = 90;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user