Merge branch 'origin/next'
This commit is contained in:
@@ -896,7 +896,12 @@ class ExpoField: public TransformedField {
|
||||
|
||||
virtual void afterImport()
|
||||
{
|
||||
expo.weight = smallGvarToC9x(_weight);
|
||||
if (IS_TARANIS(board) && version < 216) {
|
||||
expo.srcRaw = RawSource(SOURCE_TYPE_STICK, expo.chn);
|
||||
}
|
||||
|
||||
expo.weight = smallGvarToC9x(_weight);
|
||||
|
||||
if (!IS_TARANIS(board) || version < 216) {
|
||||
if (!_curveMode)
|
||||
expo.curve = CurveReference(CurveReference::CURVE_REF_EXPO, smallGvarToC9x(_curveParam));
|
||||
|
||||
@@ -521,12 +521,14 @@ void MdiChild::writeEeprom() // write to Tx
|
||||
if (path.isEmpty()) {
|
||||
QMessageBox::warning(this, tr("Taranis radio not found"), tr("Impossible to identify the radio on your system, please verify the eeprom disk is connected."));
|
||||
return;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
QStringList str;
|
||||
str << path << backupFile;
|
||||
avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Backup EEPROM From Tx")); //, AVR_DIALOG_KEEP_OPEN);
|
||||
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
|
||||
ad->exec();
|
||||
delete ad;
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
@@ -549,10 +551,9 @@ void MdiChild::writeEeprom() // write to Tx
|
||||
sleep(1);
|
||||
QString restoreFile = tempDir + "/compat.bin";
|
||||
if (!((MainWindow *)this->parent())->convertEEPROM(tempFile, restoreFile, tempFlash)) {
|
||||
int ret = QMessageBox::question(this, "Error", tr("Cannot check eeprom compatibility! Continue anyway?") ,
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (ret==QMessageBox::No)
|
||||
return;
|
||||
int ret = QMessageBox::question(this, tr("Error"), tr("Cannot check eeprom compatibility! Continue anyway?"), QMessageBox::Yes | QMessageBox::No);
|
||||
if (ret == QMessageBox::No)
|
||||
return;
|
||||
}
|
||||
else {
|
||||
int rev=((MainWindow *)this->parent())->getEpromVersion(restoreFile);
|
||||
@@ -591,6 +592,7 @@ void MdiChild::writeEeprom() // write to Tx
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_TARANIS(eepromInterface->getBoard())) {
|
||||
QString path=((MainWindow *)this->parent())->FindTaranisPath();
|
||||
if (path.isEmpty()) {
|
||||
@@ -602,7 +604,7 @@ void MdiChild::writeEeprom() // write to Tx
|
||||
str << tempFile << path;
|
||||
avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Write EEPROM To Tx"), AVR_DIALOG_SHOW_DONE); //, AVR_DIALOG_KEEP_OPEN);
|
||||
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
|
||||
ad->show();
|
||||
ad->exec();
|
||||
delete ad;
|
||||
sleep(1);
|
||||
}
|
||||
@@ -611,7 +613,7 @@ void MdiChild::writeEeprom() // write to Tx
|
||||
QStringList str = ((MainWindow *)this->parent())->GetSendEEpromCommand(tempFile);
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, ((MainWindow *)this->parent())->GetAvrdudeLocation(), str, "Write EEPROM To Tx", AVR_DIALOG_SHOW_DONE);
|
||||
ad->setWindowIcon(CompanionIcon("write_eeprom.png"));
|
||||
ad->show();
|
||||
ad->exec();
|
||||
delete ad;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +162,8 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
|
||||
|
||||
#ifdef PHONON
|
||||
playBT[i] = new QPushButton(this);
|
||||
playBT[i]->setObjectName(QString("play_%1").arg(i));
|
||||
playBT[i]->setProperty("index", i);
|
||||
playBT[i]->setProperty("state", "play");
|
||||
playBT[i]->setIcon(CompanionIcon("play.png"));
|
||||
paramLayout->addWidget(playBT[i]);
|
||||
connect(playBT[i], SIGNAL(pressed()), this, SLOT(playMusic()));
|
||||
@@ -222,42 +223,43 @@ void CustomFunctionsPanel::mediaPlayer_state(Phonon::State newState, Phonon::Sta
|
||||
|
||||
void CustomFunctionsPanel::playMusic()
|
||||
{
|
||||
QPushButton *playButton = qobject_cast<QPushButton*>(sender());
|
||||
int index=playButton->objectName().mid(5,2).toInt();
|
||||
QString function=playButton->objectName().left(4);
|
||||
QString path = g.profile[g.id()].sdPath();
|
||||
QPushButton * button = qobject_cast<QPushButton*>(sender());
|
||||
int index = button->property("index").toInt();
|
||||
QString function = button->property("state").toString();
|
||||
QString path = g.profile[g.id()].sdPath();
|
||||
QDir qd(path);
|
||||
QString track;
|
||||
if (qd.exists()) {
|
||||
if (GetEepromInterface()->getCapability(VoicesAsNumbers)) {
|
||||
track=path+QString("/%1.wav").arg(int(fswtchParam[index]->value()),4,10,(const QChar)'0');
|
||||
track = path + QString("/%1.wav").arg(int(fswtchParam[index]->value()), 4, 10, (const QChar)'0');
|
||||
}
|
||||
else {
|
||||
path.append("/SOUNDS/");
|
||||
QString lang = generalSettings.ttsLanguage;
|
||||
if (lang.isEmpty())
|
||||
lang="en";
|
||||
lang = "en";
|
||||
path.append(lang);
|
||||
if (fswtchParamArmT[index]->currentText()!="----") {
|
||||
track=path+"/"+fswtchParamArmT[index]->currentText()+".wav";
|
||||
if (fswtchParamArmT[index]->currentText() != "----") {
|
||||
track = path + "/" + fswtchParamArmT[index]->currentText() + ".wav";
|
||||
}
|
||||
}
|
||||
QFile file(track);
|
||||
if (!file.exists()) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Unable to find sound file %1!").arg(track));
|
||||
track.clear();
|
||||
return;
|
||||
}
|
||||
#ifdef PHONON
|
||||
if (function=="play" && !track.isEmpty()) {
|
||||
if (function=="play") {
|
||||
clickObject->clear();
|
||||
clickObject->setCurrentSource(Phonon::MediaSource(track));
|
||||
clickObject->play();
|
||||
playBT[index]->setObjectName(QString("stop_%1").arg(index));
|
||||
playBT[index]->setProperty("state", "stop");
|
||||
playBT[index]->setIcon(CompanionIcon("stop.png"));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
clickObject->stop();
|
||||
clickObject->clear();
|
||||
playBT[index]->setObjectName(QString("play_%1").arg(index));
|
||||
playBT[index]->setProperty("state", "play");
|
||||
playBT[index]->setIcon(CompanionIcon("play.png"));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -83,7 +83,10 @@ void InputsPanel::update()
|
||||
curDest = md->chn;
|
||||
}
|
||||
else {
|
||||
str = " ";
|
||||
if (GetEepromInterface()->getCapability(VirtualInputs))
|
||||
str = " ";
|
||||
else
|
||||
str = " ";
|
||||
}
|
||||
|
||||
if (GetEepromInterface()->getCapability(VirtualInputs)) {
|
||||
|
||||
@@ -476,7 +476,7 @@ void Setup::on_extendedLimits_toggled(bool checked)
|
||||
|
||||
void Setup::on_throttleWarning_toggled(bool checked)
|
||||
{
|
||||
model.disableThrottleWarning = checked;
|
||||
model.disableThrottleWarning = !checked;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
@@ -549,7 +549,7 @@ void Setup::update()
|
||||
|
||||
ui->throttleReverse->setChecked(model.throttleReversed);
|
||||
populateTTraceCB(ui->throttleSource, model.thrTraceSrc);
|
||||
ui->throttleWarning->setChecked(model.disableThrottleWarning);
|
||||
ui->throttleWarning->setChecked(!model.disableThrottleWarning);
|
||||
|
||||
//trim inc, thro trim, thro expo, instatrim
|
||||
ui->trimIncrement->setCurrentIndex(model.trimInc+2);
|
||||
|
||||
+2272
-3366
File diff suppressed because it is too large
Load Diff
@@ -67,6 +67,14 @@ EXT = STD
|
||||
# Values = YES, NO, CHOICE
|
||||
FAI = NO
|
||||
|
||||
# the latests deliveries for Turnigy 9x transmitters (since 2 years now, 2014) do not stop sending if no pulses are generated.
|
||||
# This fact totally breaks the nice throttle and switch warning concept, because even we prevent sending pulses the
|
||||
# transmitter modul ignores this, and continous to send the last value or 0 at beginning. And 0 means in the middle of throttle -> 50%.
|
||||
# To cope with this situation, we need a new concept how to handle throttle and switch warnings.
|
||||
# if you have a 0 value (50% ) for throttle, while throttle warning is active, you should activate this switch
|
||||
# Values = YES, NO
|
||||
TURNIGY_TRANSMITTER_FIX = NO
|
||||
|
||||
# Enable heli menu
|
||||
# Values = YES, NO
|
||||
HELI = NO
|
||||
@@ -761,6 +769,14 @@ ifeq ($(NAVIGATION), ROTENC)
|
||||
CPPDEFS += -DROTARY_ENCODER_NAVIGATION
|
||||
endif
|
||||
|
||||
ifeq ($(TURNIGY_TRANSMITTER_FIX), YES)
|
||||
ifeq ($(PCB), TARANIS)
|
||||
$(warning TURNIGY_TRANSMITTER_FIX is not available on Taranis)
|
||||
else
|
||||
CPPDEFS += -DMODULE_ALWAYS_SEND_PULSES
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(AUTOSWITCH), YES)
|
||||
CPPDEFS += -DAUTOSWITCH
|
||||
endif
|
||||
|
||||
@@ -212,9 +212,27 @@ PACK(typedef struct {
|
||||
|
||||
}) ModelData_v215;
|
||||
|
||||
PACK(typedef struct {
|
||||
uint8_t version;
|
||||
uint16_t variant;
|
||||
int16_t calibMid[NUM_STICKS+NUM_POTS];
|
||||
int16_t calibSpanNeg[NUM_STICKS+NUM_POTS];
|
||||
int16_t calibSpanPos[NUM_STICKS+NUM_POTS];
|
||||
uint16_t chkSum;
|
||||
}) GeneralSettings_v215;
|
||||
|
||||
void ConvertGeneralSettings_215_to_216(EEGeneral &settings)
|
||||
{
|
||||
GeneralSettings_v215 oldSettings;
|
||||
memcpy(&oldSettings, &settings, sizeof(oldSettings));
|
||||
|
||||
settings.version = 216;
|
||||
for (int i=0; i<NUM_STICKS+NUM_POTS; i++) {
|
||||
settings.calib[i].mid = oldSettings.calibMid[i];
|
||||
settings.calib[i].spanNeg = oldSettings.calibSpanNeg[i];
|
||||
settings.calib[i].spanPos = oldSettings.calibSpanPos[i];
|
||||
}
|
||||
settings.chkSum = evalChkSum();
|
||||
}
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
@@ -592,6 +610,7 @@ void ConvertModel_215_to_216(ModelData &model)
|
||||
|
||||
for (uint8_t i=0; i<9; i++) {
|
||||
memcpy(&g_model.phaseData[i], &oldModel.phaseData[i], sizeof(oldModel.phaseData[i])); // the last 4 gvars will remain blank
|
||||
g_model.phaseData[i].swtch = ConvertSwitch_215_to_216(oldModel.phaseData[i].swtch);
|
||||
#if defined(PCBTARANIS)
|
||||
for (uint8_t t=0; t<4; t++) {
|
||||
int trim = oldModel.phaseData[i].trim[t];
|
||||
|
||||
@@ -318,7 +318,9 @@ void displayTopBar()
|
||||
/* RTC time */
|
||||
struct gtm t;
|
||||
gettime(&t);
|
||||
lcd_putcAtt(BAR_TIME_X+1, BAR_Y+1, ':', BLINK);
|
||||
if (t.tm_sec % 2) {
|
||||
lcd_putcAtt(BAR_TIME_X+1, BAR_Y+1, ':', 0);
|
||||
}
|
||||
lcd_outdezNAtt(BAR_TIME_X+1, BAR_Y+1, t.tm_hour, LEADING0, 2);
|
||||
lcd_outdezNAtt(BAR_TIME_X+3*FWNUM-1, BAR_Y+1, t.tm_min, LEADING0, 2);
|
||||
|
||||
|
||||
+142
-45
@@ -51,6 +51,9 @@ int24_t act [MAX_MIXERS] = {0};
|
||||
SwOn swOn [MAX_MIXERS]; // TODO better name later...
|
||||
|
||||
uint8_t mixWarning;
|
||||
#if defined(MODULE_ALWAYS_SEND_PULSES)
|
||||
uint8_t startupWarningState;
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define MENUS_STACK_SIZE 2000
|
||||
@@ -1247,9 +1250,11 @@ getvalue_t getValue(uint8_t i)
|
||||
else if (i==MIXSRC_SH) return (switchState(SW_SH0) ? -1024 : 1024);
|
||||
else if (i<=MIXSRC_LAST_CSW) return getSwitch(SWSRC_FIRST_CSW+i-MIXSRC_FIRST_CSW) ? 1024 : -1024;
|
||||
#else
|
||||
else if (i==MIXSRC_3POS) return (switchState(SW_ID0) ? -1024 : (switchState(SW_ID1) ? 0 : 1024));
|
||||
else if (i==MIXSRC_3POS) return (getSwitch(SW_ID0-SW_BASE+1) ? -1024 : (getSwitch(SW_ID1-SW_BASE+1) ? 0 : 1024));
|
||||
// don't use switchState directly to give getSwitch possibility to hack values if needed for switch warning
|
||||
#if defined(EXTRA_3POS)
|
||||
else if (i==MIXSRC_3POS2) return (switchState(SW_ID3) ? -1024 : (switchState(SW_ID4) ? 0 : 1024));
|
||||
else if (i==MIXSRC_3POS2) return (getSwitch(SW_ID3-SW_BASE+1) ? -1024 : (getSwitch(SW_ID4-SW_BASE+1) ? 0 : 1024));
|
||||
// don't use switchState directly to give getSwitch possibility to hack values if needed for switch warning
|
||||
#endif
|
||||
else if (i<=MIXSRC_LAST_CSW) return getSwitch(SWSRC_THR+i-MIXSRC_THR) ? 1024 : -1024;
|
||||
#endif
|
||||
@@ -1382,6 +1387,10 @@ void getSwitchesPosition()
|
||||
|
||||
int16_t csLastValue[NUM_CSW];
|
||||
#define CS_LAST_VALUE_INIT -32768
|
||||
// param swtch may be (negativ sign ignored)
|
||||
// 0 --> no source
|
||||
// 1 .. 9 (or max switches) --> returns switch value including 3pos
|
||||
// others internal switches etc.
|
||||
bool getSwitch(int8_t swtch)
|
||||
{
|
||||
bool result;
|
||||
@@ -1396,6 +1405,20 @@ bool getSwitch(int8_t swtch)
|
||||
}
|
||||
else if (cs_idx <= SWSRC_LAST_SWITCH) {
|
||||
result = SWITCH_POSITION(cs_idx-SWSRC_FIRST_SWITCH);
|
||||
#if defined(MODULE_ALWAYS_SEND_PULSES)
|
||||
if (startupWarningState < STARTUP_WARNING_DONE) {
|
||||
// if throttle or switch warning is currently active, ignore actual stick position and use wanted values
|
||||
if (cs_idx <= 3) {
|
||||
if (!(g_model.nSwToWarn&1)) { // ID1 to ID3 is just one bit in nSwToWarn
|
||||
result = (cs_idx)==((g_model.switchWarningStates&3)+1); // overwrite result with desired value
|
||||
}
|
||||
}
|
||||
else if (!(g_model.nSwToWarn & (1<<(cs_idx-3)))) {
|
||||
// current switch should not be ignored for warning
|
||||
result = g_model.switchWarningStates & (1<<(cs_idx-2)); // overwrite result with desired value
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#if defined(PCBTARANIS)
|
||||
else if (cs_idx <= SWSRC_P26) {
|
||||
@@ -1621,6 +1644,30 @@ int8_t getMovedSwitch()
|
||||
}
|
||||
}
|
||||
#else
|
||||
// saves about 50 bytes flash
|
||||
// return delivers 1 to 3 for ID1 to ID3
|
||||
// 4..8 for all other switches if changed to true
|
||||
// -4..-8 for all other switches if changed to false
|
||||
// 9 for Trainer switch if changed to true; Change to false is ignored
|
||||
|
||||
swstate_t mask=0x80;
|
||||
for (uint8_t i=NUM_PSWITCH; i>1; i--) {
|
||||
bool prev;
|
||||
// mask= (1<<(i-2));
|
||||
prev=(switches_states & mask);
|
||||
// don't use getSwitch here to always get the proper value, even getSwitch manipulates
|
||||
// bool next = getSwitch(i);
|
||||
bool next = switchState((EnumKeys)(SW_BASE+i-1));
|
||||
if (prev!=next) {
|
||||
if (((i<NUM_PSWITCH) && (i>3)) || next==true)
|
||||
result = next ? i : -i;
|
||||
if ((i<=3) && (result==0)) result=1;
|
||||
switches_states ^= mask;
|
||||
}
|
||||
mask>>=1;
|
||||
} //endfor
|
||||
|
||||
/*
|
||||
for (uint8_t i=NUM_PSWITCH; i>0; i--) {
|
||||
bool prev;
|
||||
swstate_t mask = 0;
|
||||
@@ -1631,7 +1678,9 @@ int8_t getMovedSwitch()
|
||||
mask = (1<<(i-2));
|
||||
prev = (switches_states & mask);
|
||||
}
|
||||
bool next = getSwitch(i);
|
||||
// don't use getSwitch here to always get the proper value, because getSwitch manipulates
|
||||
// bool next = getSwitch(i);
|
||||
bool next = switchState((EnumKeys)(SW_BASE+i-1));
|
||||
if (prev != next) {
|
||||
if (i!=NUM_PSWITCH || next==true)
|
||||
result = next ? i : -i;
|
||||
@@ -1641,7 +1690,7 @@ int8_t getMovedSwitch()
|
||||
switches_states = (switches_states & 0xFC) | (i-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
} //endfor */
|
||||
#endif
|
||||
|
||||
if ((tmr10ms_t)(get_tmr10ms() - s_move_last_time) > 10)
|
||||
@@ -2237,8 +2286,12 @@ void checkAll()
|
||||
checkLowEEPROM();
|
||||
#endif
|
||||
|
||||
#if defined(MODULE_ALWAYS_SEND_PULSES)
|
||||
startupWarningState = STARTUP_WARNING_THROTTLE;
|
||||
#else
|
||||
checkTHR();
|
||||
checkSwitches();
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
if (modelHasNotes() && g_model.displayText) {
|
||||
@@ -2252,6 +2305,18 @@ void checkAll()
|
||||
clearKeyEvents();
|
||||
}
|
||||
|
||||
#if defined(MODULE_ALWAYS_SEND_PULSES)
|
||||
void checkStartupWarnings()
|
||||
{
|
||||
if (startupWarningState < STARTUP_WARNING_DONE) {
|
||||
if (startupWarningState == STARTUP_WARNING_THROTTLE)
|
||||
checkTHR();
|
||||
else
|
||||
checkSwitches();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(PCBSKY9X)
|
||||
void checkLowEEPROM()
|
||||
{
|
||||
@@ -2264,41 +2329,46 @@ void checkLowEEPROM()
|
||||
|
||||
void checkTHR()
|
||||
{
|
||||
if (g_model.disableThrottleWarning) return;
|
||||
uint8_t thrchn = ((g_model.thrTraceSrc==0) || (g_model.thrTraceSrc>NUM_POTS)) ? THR_STICK : g_model.thrTraceSrc+NUM_STICKS-1;
|
||||
// throttle channel is either the stick according stick mode (already handled in evalInputs)
|
||||
// or P1 to P3;
|
||||
// in case an output channel is choosen as throttle source (thrTraceSrc>NUM_POTS) we assume the throttle stick is the input
|
||||
// no other information available at the moment, and good enough to my option (otherwise too much exceptions...)
|
||||
|
||||
uint8_t thrchn = (2-(stickMode&1)); //stickMode=0123 -> thr=2121
|
||||
|
||||
#ifdef SIMU
|
||||
int16_t lowLim = THRCHK_DEADBAND - 1024 ;
|
||||
#if defined(MODULE_ALWAYS_SEND_PULSES)
|
||||
int16_t v = calibratedStick[thrchn];
|
||||
if (v<=THRCHK_DEADBAND-1024 || g_model.disableThrottleWarning || pwrCheck()==e_power_off || keyDown()) {
|
||||
startupWarningState = STARTUP_WARNING_THROTTLE+1;
|
||||
}
|
||||
else {
|
||||
calibratedStick[thrchn] = -1024;
|
||||
#if !defined(PCBTARANIS)
|
||||
rawAnas[thrchn] = anas[thrchn] = calibratedStick[thrchn];
|
||||
#endif
|
||||
MESSAGE(STR_THROTTLEWARN, STR_THROTTLENOTIDLE, STR_PRESSANYKEYTOSKIP, AU_THROTTLE_ALERT);
|
||||
}
|
||||
#else
|
||||
getADC(); // if thr is down - do not display warning at all
|
||||
CalibData * calib = &g_eeGeneral.calib[thrchn];
|
||||
int16_t lowLim = calib->mid;
|
||||
lowLim = (g_model.throttleReversed ? - lowLim - calib->spanPos : lowLim - calib->spanNeg);
|
||||
lowLim += THRCHK_DEADBAND;
|
||||
#endif
|
||||
int16_t v = thrAnaIn(thrchn);
|
||||
|
||||
if (v<=lowLim) return;
|
||||
|
||||
// first - display warning
|
||||
MESSAGE(STR_THROTTLEWARN, STR_THROTTLENOTIDLE, STR_PRESSANYKEYTOSKIP, AU_THROTTLE_ALERT);
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (g_model.disableThrottleWarning) return;
|
||||
getADC();
|
||||
evalInputs(e_perout_mode_notrainer); // let do evalInputs do the job
|
||||
int16_t v = calibratedStick[thrchn];
|
||||
if (v<=(THRCHK_DEADBAND-1024)) return; // prevent warning if throttle input OK
|
||||
// first - display warning; also deletes inputs if any have been before
|
||||
MESSAGE(STR_THROTTLEWARN, STR_THROTTLENOTIDLE, STR_PRESSANYKEYTOSKIP, AU_THROTTLE_ALERT);
|
||||
|
||||
while (1) {
|
||||
SIMU_SLEEP(1);
|
||||
|
||||
getADC();
|
||||
|
||||
int16_t v = thrAnaIn(thrchn);
|
||||
|
||||
if (pwrCheck()==e_power_off || keyDown() || v<=lowLim)
|
||||
evalInputs(e_perout_mode_notrainer); // let do evalInputs do the job
|
||||
v = calibratedStick[thrchn];
|
||||
if (pwrCheck()==e_power_off || keyDown() || v<=(THRCHK_DEADBAND-1024))
|
||||
break;
|
||||
|
||||
|
||||
checkBacklight();
|
||||
|
||||
wdt_reset();
|
||||
}
|
||||
}//endwhile
|
||||
#endif
|
||||
}
|
||||
|
||||
void checkAlarm() // added by Gohst
|
||||
@@ -2309,21 +2379,28 @@ void checkAlarm() // added by Gohst
|
||||
|
||||
void checkSwitches()
|
||||
{
|
||||
#if defined(MODULE_ALWAYS_SEND_PULSES)
|
||||
static swstate_t last_bad_switches = 0xff;
|
||||
#else
|
||||
swstate_t last_bad_switches = 0xff;
|
||||
#endif
|
||||
swstate_t states = g_model.switchWarningStates;
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
uint8_t bad_pots = 0, last_bad_pots = 0xff;
|
||||
#endif
|
||||
|
||||
#if !defined(MODULE_ALWAYS_SEND_PULSES)
|
||||
while (1) {
|
||||
|
||||
#if defined(TELEMETRY_MOD_14051) || defined(PCBTARANIS)
|
||||
getADC();
|
||||
#endif
|
||||
#endif // !defined(MODULE_ALWAYS_SEND_PULSES)
|
||||
|
||||
getMovedSwitch();
|
||||
|
||||
uint8_t warn = false;
|
||||
bool warn = false;
|
||||
#if defined(PCBTARANIS)
|
||||
for (uint8_t i=0; i<NUM_SWITCHES-1; i++) {
|
||||
if (!(g_model.nSwToWarn & (1<<i))) {
|
||||
@@ -2346,16 +2423,24 @@ void checkSwitches()
|
||||
for (uint8_t i=0; i<NUM_SWITCHES-1; i++) {
|
||||
if (!(g_model.nSwToWarn & (1<<i))) {
|
||||
if (i == 0) {
|
||||
if((states & 0x03) != (switches_states & 0x03))
|
||||
warn = true;
|
||||
}
|
||||
else if((states & (1<<(i+1))) != (switches_states & (1<<(i+1))))
|
||||
warn = true;
|
||||
if ((states & 0x03) != (switches_states & 0x03)) {
|
||||
warn = true;
|
||||
}
|
||||
}
|
||||
else if ((states & (1<<(i+1))) != (switches_states & (1<<(i+1)))) {
|
||||
warn = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if(!warn) return;
|
||||
if (!warn) {
|
||||
#if defined(MODULE_ALWAYS_SEND_PULSES)
|
||||
startupWarningState = STARTUP_WARNING_SWITCHES+1;
|
||||
last_bad_switches = 0xff;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// first - display warning
|
||||
#if defined(PCBTARANIS)
|
||||
@@ -2411,7 +2496,13 @@ void checkSwitches()
|
||||
last_bad_switches = switches_states;
|
||||
}
|
||||
|
||||
if (pwrCheck()==e_power_off || keyDown()) return; // Usb on or power off
|
||||
#if defined(MODULE_ALWAYS_SEND_PULSES)
|
||||
if (pwrCheck()==e_power_off || keyDown()) {
|
||||
startupWarningState = STARTUP_WARNING_SWITCHES+1;
|
||||
last_bad_switches = 0xff;
|
||||
}
|
||||
#else
|
||||
if (pwrCheck()==e_power_off || keyDown()) return;
|
||||
|
||||
checkBacklight();
|
||||
|
||||
@@ -2419,6 +2510,7 @@ void checkSwitches()
|
||||
|
||||
SIMU_SLEEP(1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void alert(const pm_char * t, const pm_char *s MESSAGE_SOUND_ARG)
|
||||
@@ -2640,12 +2732,6 @@ uint16_t BandGap = 2040 ;
|
||||
uint16_t BandGap ;
|
||||
#endif
|
||||
|
||||
int16_t thrAnaIn(uint8_t chan)
|
||||
{
|
||||
int16_t v = anaIn(chan);
|
||||
return (g_model.throttleReversed) ? -v : v;
|
||||
}
|
||||
|
||||
#if !defined(SIMU)
|
||||
uint16_t anaIn(uint8_t chan)
|
||||
{
|
||||
@@ -3508,6 +3594,10 @@ void perOut(uint8_t mode, uint8_t tick10ms)
|
||||
{
|
||||
evalInputs(mode);
|
||||
|
||||
#if defined(MODULE_ALWAYS_SEND_PULSES)
|
||||
checkStartupWarnings();
|
||||
#endif
|
||||
|
||||
#if defined(HELI)
|
||||
if (g_model.swashR.value) {
|
||||
uint32_t v = ((int32_t)anas[ELE_STICK]*anas[ELE_STICK] + (int32_t)anas[AIL_STICK]*anas[AIL_STICK]);
|
||||
@@ -4488,6 +4578,13 @@ void perMain()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(MODULE_ALWAYS_SEND_PULSES)
|
||||
if (startupWarningState < STARTUP_WARNING_DONE) {
|
||||
// don't do menu's until throttle and switch warnings are handled
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!usbPlugged()) {
|
||||
// TODO merge these 2 branches
|
||||
#if defined(PCBSKY9X)
|
||||
|
||||
+13
-1
@@ -803,6 +803,18 @@ enum PerOutMode {
|
||||
e_perout_mode_noinput = e_perout_mode_notrainer+e_perout_mode_notrims+e_perout_mode_nosticks
|
||||
};
|
||||
|
||||
|
||||
#if defined(MODULE_ALWAYS_SEND_PULSES)
|
||||
extern uint8_t startupWarningState;
|
||||
|
||||
enum StartupWarningStates {
|
||||
STARTUP_WARNING_THROTTLE,
|
||||
STARTUP_WARNING_SWITCHES,
|
||||
STARTUP_WARNING_DONE,
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
// Fiddle to force compiler to use a pointer
|
||||
#if defined(CPUARM) || defined(SIMU)
|
||||
#define FORCE_INDIRECT(ptr)
|
||||
@@ -1211,8 +1223,8 @@ int applyCurve(int x, int8_t idx);
|
||||
void applyExpos(int16_t *anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS_INC);
|
||||
int16_t applyLimits(uint8_t channel, int32_t value);
|
||||
|
||||
void evalInputs(uint8_t mode);
|
||||
uint16_t anaIn(uint8_t chan);
|
||||
int16_t thrAnaIn(uint8_t chan);
|
||||
extern int16_t calibratedStick[NUM_STICKS+NUM_POTS];
|
||||
|
||||
#define FLASH_DURATION 20 /*200ms*/
|
||||
|
||||
Reference in New Issue
Block a user