1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-24 00:35:18 +03:00

[X7] SH fix - #4143

This commit is contained in:
Bertrand Songis 2016-12-17 23:09:42 +01:00
parent ad8df76c37
commit 00ab6e2294
6 changed files with 54 additions and 40 deletions

View file

@ -150,8 +150,6 @@ int checkIncDec(event_t event, int val, int i_min, int i_max, unsigned int i_fla
int16_t checkIncDec(event_t event, int16_t i_pval, int16_t i_min, int16_t i_max, uint8_t i_flags=0);
#endif
int8_t checkIncDecMovedSwitch(int8_t val);
#if defined(CPUM64)
int8_t checkIncDecModel(event_t event, int8_t i_val, int8_t i_min, int8_t i_max);
int8_t checkIncDecModelZero(event_t event, int8_t i_val, int8_t i_max);

View file

@ -35,22 +35,6 @@ int16_t p1valdiff;
int8_t p2valdiff;
#endif
#if defined(AUTOSWITCH)
int8_t checkIncDecMovedSwitch(int8_t val)
{
if (s_editMode>0) {
int8_t swtch = getMovedSwitch();
if (swtch) {
if (IS_CONFIG_TOGGLE(swtch) && swtch==val)
val = -val;
else
val = swtch;
}
}
return val;
}
#endif
int8_t checkIncDec_Ret;
#if defined(PCBX7)

View file

@ -27,28 +27,6 @@ int8_t s_editMode;
uint8_t noHighlightCounter;
uint8_t menuCalibrationState;
int checkIncDecSelection = 0;
#if defined(AUTOSWITCH)
swsrc_t checkIncDecMovedSwitch(swsrc_t val)
{
if (s_editMode > 0) {
swsrc_t swtch = getMovedSwitch();
if (swtch) {
div_t info = switchInfo(swtch);
if (IS_CONFIG_TOGGLE(info.quot)) {
if (info.rem != 0) {
val = (val == swtch ? swtch-2 : swtch);
}
}
else {
val = swtch;
}
}
}
return val;
}
#endif
int8_t checkIncDec_Ret;
INIT_STOPS(stops100, 3, -100, 0, 100)

View file

@ -26,6 +26,7 @@ set(GUI_SRC
set(SRC
${SRC}
gui/common/widgets.cpp
gui/common/navigation.cpp
)
include_directories(gui gui/${GUI_DIR})

View file

@ -0,0 +1,51 @@
/*
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* 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 "opentx.h"
#if defined(AUTOSWITCH)
swsrc_t checkIncDecMovedSwitch(swsrc_t val)
{
if (s_editMode>0) {
swsrc_t swtch = getMovedSwitch();
if (swtch) {
#if defined(PCBTARANIS) || defined(PCBHORUS)
div_t info = switchInfo(swtch);
if (IS_CONFIG_TOGGLE(info.quot)) {
if (info.rem != 0) {
val = (val == swtch ? swtch-2 : swtch);
}
}
else {
val = swtch;
}
#else
if (IS_CONFIG_TOGGLE(swtch) && swtch==val) {
val = -val;
}
else {
val = swtch;
}
#endif
}
}
return val;
}
#endif

View file

@ -86,6 +86,8 @@ bool isSwitchWarningStateAvailable(int state);
void drawFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att=0);
#endif
swsrc_t checkIncDecMovedSwitch(swsrc_t val);
#if defined(CPUARM)
#include "telemetry/telemetry_sensors.h"
void drawValueWithUnit(coord_t x, coord_t y, int32_t val, uint8_t unit, LcdFlags flags);