mirror of
https://github.com/opentx/opentx.git
synced 2025-07-24 00:35:18 +03:00
CopyTrimsToOffset function added - #1323
This commit is contained in:
parent
b1f44d7101
commit
6908509d79
15 changed files with 43 additions and 3 deletions
|
@ -3853,6 +3853,9 @@ void onLimitsMenu(const char *result)
|
|||
else if (result == STR_COPY_STICKS_TO_OFS) {
|
||||
copySticksToOffset(ch);
|
||||
}
|
||||
else if (result == STR_COPY_TRIMS_TO_OFS) {
|
||||
copyTrimsToOffset(ch);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -3929,6 +3932,7 @@ void menuModelLimits(uint8_t event)
|
|||
if (sub==k && m_posHorz < 0 && event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
MENU_ADD_ITEM(STR_RESET);
|
||||
MENU_ADD_ITEM(STR_COPY_TRIMS_TO_OFS);
|
||||
MENU_ADD_ITEM(STR_COPY_STICKS_TO_OFS);
|
||||
menuHandler = onLimitsMenu;
|
||||
}
|
||||
|
|
|
@ -3054,13 +3054,11 @@ void copySticksToOffset(uint8_t ch)
|
|||
{
|
||||
pauseMixerCalculations();
|
||||
int32_t zero = (int32_t)channelOutputs[ch];
|
||||
int32_t old = chans[ch];
|
||||
|
||||
evalFlightModeMixes(e_perout_mode_nosticks+e_perout_mode_notrainer, 0);
|
||||
int32_t val = chans[ch];
|
||||
LimitData *ld = limitAddress(ch);
|
||||
limit_min_max_t lim = LIMIT_MIN(ld);
|
||||
TRACE("%d vs %d chan=%d vs %d - lim=%d", zero, channelOutputs[ch], val, old, lim);
|
||||
if (val < 0) {
|
||||
val = -val;
|
||||
lim = LIMIT_MIN(ld);
|
||||
|
@ -3075,6 +3073,31 @@ void copySticksToOffset(uint8_t ch)
|
|||
eeDirty(EE_MODEL);
|
||||
}
|
||||
|
||||
void copyTrimsToOffset(uint8_t ch)
|
||||
{
|
||||
int16_t zero;
|
||||
|
||||
pauseMixerCalculations();
|
||||
|
||||
evalFlightModeMixes(e_perout_mode_noinput, 0); // do output loop - zero input sticks and trims
|
||||
zero = applyLimits(ch, chans[ch]);
|
||||
|
||||
evalFlightModeMixes(e_perout_mode_noinput-e_perout_mode_notrims, 0); // do output loop - only trims
|
||||
|
||||
int16_t output = applyLimits(ch, chans[ch]) - zero;
|
||||
int16_t v = g_model.limitData[ch].offset;
|
||||
if (g_model.limitData[ch].revert) output = -output;
|
||||
#if defined(CPUARM)
|
||||
v += (output * 125) / 128;
|
||||
#else
|
||||
v += output;
|
||||
#endif
|
||||
g_model.limitData[ch].offset = limit((int16_t)-1000, (int16_t)v, (int16_t)1000); // make sure the offset doesn't go haywire
|
||||
|
||||
resumeMixerCalculations();
|
||||
eeDirty(EE_MODEL);
|
||||
}
|
||||
|
||||
void moveTrimsToOffsets() // copy state of 3 primary to subtrim
|
||||
{
|
||||
int16_t zeros[NUM_CHNOUT];
|
||||
|
|
|
@ -1176,6 +1176,7 @@ void applyDefaultTemplate();
|
|||
void incSubtrim(uint8_t idx, int16_t inc);
|
||||
void instantTrim();
|
||||
FORCEINLINE void evalTrims();
|
||||
void copyTrimsToOffset(uint8_t ch);
|
||||
void copySticksToOffset(uint8_t ch);
|
||||
void moveTrimsToOffsets();
|
||||
|
||||
|
|
|
@ -520,6 +520,7 @@ const pm_char STR_BLCOLOR[] PROGMEM = TR_BLCOLOR;
|
|||
const pm_char STR_PTS[] PROGMEM = TR_PTS;
|
||||
const pm_char STR_SMOOTH[] PROGMEM = TR_SMOOTH;
|
||||
const pm_char STR_COPY_STICKS_TO_OFS[] PROGMEM = TR_COPY_STICKS_TO_OFS;
|
||||
const pm_char STR_COPY_TRIMS_TO_OFS[] PROGMEM = TR_COPY_TRIMS_TO_OFS;
|
||||
const pm_char STR_TOP_BAR[] PROGMEM = TR_TOP_BAR;
|
||||
const pm_char STR_ALTITUDE[] PROGMEM = TR_ALTITUDE;
|
||||
const pm_char STR_SCALE[] PROGMEM = TR_SCALE;
|
||||
|
|
|
@ -701,6 +701,7 @@ extern const pm_char STR_BLCOLOR[];
|
|||
extern const pm_char STR_PTS[];
|
||||
extern const pm_char STR_SMOOTH[];
|
||||
extern const pm_char STR_COPY_STICKS_TO_OFS[];
|
||||
extern const pm_char STR_COPY_TRIMS_TO_OFS[];
|
||||
extern const pm_char STR_TOP_BAR[];
|
||||
extern const pm_char STR_ALTITUDE[];
|
||||
extern const pm_char STR_SCALE[];
|
||||
|
|
|
@ -804,6 +804,7 @@
|
|||
#define TR_PTS " b."
|
||||
#define TR_SMOOTH "Hladká"
|
||||
#define TR_COPY_STICKS_TO_OFS "Kopírovat stick do subtrimu"
|
||||
#define TR_COPY_TRIMS_TO_OFS "Copy trims to subtrim"
|
||||
#define TR_PERSISTENT_MAH TR(INDENT "Str mAh", INDENT "Ukládat mAh")
|
||||
#define TR_PREFLIGHT "Předletová kontrola"
|
||||
#define TR_CHECKLIST INDENT "Zobrazit poznámky"
|
||||
|
|
|
@ -804,6 +804,7 @@
|
|||
#define TR_PTS "Pts"
|
||||
#define TR_SMOOTH "Runden"
|
||||
#define TR_COPY_STICKS_TO_OFS "Kopie Stick to Servo-Mitte" // "Trims => Offset"
|
||||
#define TR_COPY_TRIMS_TO_OFS "Copy trims to subtrim"
|
||||
#define TR_PERSISTENT_MAH INDENT "Speichern mAh"
|
||||
#define TR_PREFLIGHT "----Preflight Checks----"
|
||||
#define TR_CHECKLIST INDENT "Display Checklist"
|
||||
|
|
|
@ -803,7 +803,8 @@
|
|||
#define TR_PT "pt"
|
||||
#define TR_PTS "pts"
|
||||
#define TR_SMOOTH "Smooth"
|
||||
#define TR_COPY_STICKS_TO_OFS "Copy Stick To Subtrim"
|
||||
#define TR_COPY_STICKS_TO_OFS "Copy sticks to subtrim"
|
||||
#define TR_COPY_TRIMS_TO_OFS "Copy trims to subtrim"
|
||||
#define TR_PERSISTENT_MAH TR(INDENT "Str mAh", INDENT "Persistent mAh")
|
||||
#define TR_PREFLIGHT "Preflight Checks"
|
||||
#define TR_CHECKLIST TR(INDENT "Checklist", INDENT "Display Checklist")
|
||||
|
|
|
@ -804,6 +804,7 @@
|
|||
#define TR_PTS "pts"
|
||||
#define TR_SMOOTH "Smooth"
|
||||
#define TR_COPY_STICKS_TO_OFS "Copy Sticks To Offset"
|
||||
#define TR_COPY_TRIMS_TO_OFS "Copy trims to subtrim"
|
||||
#define TR_PERSISTENT_MAH INDENT "Valor mAh"
|
||||
#define TR_PREFLIGHT "Preflight Checks"
|
||||
#define TR_CHECKLIST INDENT "Display Checklist"
|
||||
|
|
|
@ -804,6 +804,7 @@
|
|||
#define TR_PTS "pts"
|
||||
#define TR_SMOOTH "Smooth"
|
||||
#define TR_COPY_STICKS_TO_OFS "Copy Sticks To Offset"
|
||||
#define TR_COPY_TRIMS_TO_OFS "Copy trims to subtrim"
|
||||
#define TR_PERSISTENT_MAH INDENT "Store mAh"
|
||||
#define TR_PREFLIGHT "Preflight Checks"
|
||||
#define TR_CHECKLIST INDENT "Display Checklist"
|
||||
|
|
|
@ -804,6 +804,7 @@
|
|||
#define TR_PTS "pts"
|
||||
#define TR_SMOOTH "Lissage"
|
||||
#define TR_COPY_STICKS_TO_OFS "Manche vers subtrim"
|
||||
#define TR_COPY_TRIMS_TO_OFS "Trim vers subtrim"
|
||||
#define TR_PERSISTENT_MAH TR(INDENT "Enr. mAh", INDENT "Enregistrer mAh")
|
||||
#define TR_PREFLIGHT "Vérifications avant vol"
|
||||
#define TR_CHECKLIST TR(INDENT "Notes", INDENT "Afficher notes")
|
||||
|
|
|
@ -804,6 +804,7 @@
|
|||
#define TR_PTS "pti"
|
||||
#define TR_SMOOTH "Smussa"
|
||||
#define TR_COPY_STICKS_TO_OFS "Copia Stick su Offset"
|
||||
#define TR_COPY_TRIMS_TO_OFS "Copy trims to subtrim"
|
||||
#define TR_PERSISTENT_MAH INDENT "Memo mAh"
|
||||
#define TR_PREFLIGHT "Controlli Prevolo"
|
||||
#define TR_CHECKLIST INDENT "Mostra Checklist"
|
||||
|
|
|
@ -804,6 +804,7 @@
|
|||
#define TR_PTS "pkty"
|
||||
#define TR_SMOOTH "Gładka"
|
||||
#define TR_COPY_STICKS_TO_OFS "Skopiuj Stick Do Offsetu"
|
||||
#define TR_COPY_TRIMS_TO_OFS "Copy trims to subtrim"
|
||||
#define TR_PERSISTENT_MAH TR(INDENT "Zap. mAh", INDENT "Zapisz mAh")
|
||||
#define TR_PREFLIGHT "Lista Ostrzeżeń"
|
||||
#define TR_CHECKLIST TR(INDENT "Czeklista",INDENT "Pokaż Listę Ostrzeżeń")
|
||||
|
|
|
@ -804,6 +804,7 @@
|
|||
#define TR_PTS "pts"
|
||||
#define TR_SMOOTH "Smooth"
|
||||
#define TR_COPY_STICKS_TO_OFS "Copy Sticks To Offset"
|
||||
#define TR_COPY_TRIMS_TO_OFS "Copy trims to subtrim"
|
||||
#define TR_PERSISTENT_MAH INDENT "Store mAh"
|
||||
#define TR_PREFLIGHT "Preflight Checks"
|
||||
#define TR_CHECKLIST INDENT "Display Checklist"
|
||||
|
|
|
@ -804,6 +804,7 @@
|
|||
#define TR_PTS "pkt"
|
||||
#define TR_SMOOTH "Mjuk"
|
||||
#define TR_COPY_STICKS_TO_OFS "Spara sticks som offset"
|
||||
#define TR_COPY_TRIMS_TO_OFS "Copy trims to subtrim"
|
||||
#define TR_PERSISTENT_MAH INDENT "Lagra mAh"
|
||||
#define TR_PREFLIGHT "Startkontroller"
|
||||
#define TR_CHECKLIST TR(INDENT "Checklista", INDENT "Visa Checklista")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue