mirror of
https://github.com/opentx/opentx.git
synced 2025-07-24 16:55:20 +03:00
[9x stock] Some bytes saved with trims usage
This commit is contained in:
parent
bb0ab55830
commit
d3b66c849b
1 changed files with 2 additions and 3 deletions
|
@ -2293,12 +2293,10 @@ void checkTrims()
|
|||
uint8_t event = getEvent(true);
|
||||
if (event && !IS_KEY_BREAK(event)) {
|
||||
int8_t k = EVT_KEY_MASK(event) - TRM_BASE;
|
||||
int8_t s = g_model.trimInc + 2; // TODO check flash usage, below we do arithmetics again ...
|
||||
#else
|
||||
uint8_t checkTrim(uint8_t event)
|
||||
{
|
||||
int8_t k = EVT_KEY_MASK(event) - TRM_BASE;
|
||||
int8_t s = g_model.trimInc + 2; // TODO check flash usage, below we do arithmetics again ...
|
||||
if (k>=0 && k<8 && !IS_KEY_BREAK(event)) {
|
||||
#endif
|
||||
// LH_DWN LH_UP LV_DWN LV_UP RV_DWN RV_UP RH_DWN RH_UP
|
||||
|
@ -2329,7 +2327,8 @@ uint8_t checkTrim(uint8_t event)
|
|||
before = getRawTrimValue(phase, idx);
|
||||
thro = (idx==THR_STICK && g_model.thrTrim);
|
||||
#endif
|
||||
int8_t v = (s==0) ? min(32, abs(before)/4+1) : 1 << (s-1); // 1=>1 2=>2 3=>4 4=>8
|
||||
int8_t trimInc = g_model.trimInc + 1;
|
||||
int8_t v = (trimInc==-1) ? min(32, abs(before)/4+1) : (1 << trimInc);
|
||||
if (thro) v = 4; // if throttle trim and trim trottle then step=4
|
||||
int16_t after = (k&1) ? before + v : before - v; // positive = k&1
|
||||
#if defined(CPUARM)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue