Confirmation page added - not as nice as others ;) - Engine settings
applied (others remain to do). Flaps instead of Flaperons
This commit is contained in:
+27
-1
@@ -534,6 +534,18 @@ static int luaModelDeleteInput(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int luaModelDeleteInputs(lua_State *L)
|
||||
{
|
||||
clearInputs();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int luaModelDefaultInputs(lua_State *L)
|
||||
{
|
||||
defaultInputs();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int getFirstMix(int chn)
|
||||
{
|
||||
for (int i=0; i<MAX_MIXERS; i++) {
|
||||
@@ -562,6 +574,9 @@ static int getMixesCountFromFirst(int chn, int first)
|
||||
static int getMixesCount(int chn)
|
||||
{
|
||||
int first = getFirstMix(chn);
|
||||
if (first < 0) {
|
||||
return 0;
|
||||
}
|
||||
return getMixesCountFromFirst(chn, first);
|
||||
}
|
||||
|
||||
@@ -604,7 +619,8 @@ static int luaModelInsertMix(lua_State *L)
|
||||
int count = getMixesCountFromFirst(chn, first);
|
||||
|
||||
if (chn<NUM_CHNOUT && getExpoMixCount(0)<MAX_MIXERS && idx<=count) {
|
||||
idx = first+idx;
|
||||
if (first > 0)
|
||||
idx += first;
|
||||
s_currCh = chn+1;
|
||||
insertExpoMix(0, idx);
|
||||
MixData *mix = mixAddress(idx);
|
||||
@@ -652,6 +668,12 @@ static int luaModelDeleteMix(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int luaModelDeleteMixes(lua_State *L)
|
||||
{
|
||||
memset(g_model.mixData, 0, sizeof(g_model.mixData));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int luaModelGetLogicalSwitch(lua_State *L)
|
||||
{
|
||||
int idx = luaL_checkunsigned(L, 1);
|
||||
@@ -955,10 +977,13 @@ static const luaL_Reg modelLib[] = {
|
||||
{ "getInput", luaModelGetInput },
|
||||
{ "insertInput", luaModelInsertInput },
|
||||
{ "deleteInput", luaModelDeleteInput },
|
||||
{ "deleteInputs", luaModelDeleteInputs },
|
||||
{ "defaultInputs", luaModelDefaultInputs },
|
||||
{ "getMixesCount", luaModelGetMixesCount },
|
||||
{ "getMix", luaModelGetMix },
|
||||
{ "insertMix", luaModelInsertMix },
|
||||
{ "deleteMix", luaModelDeleteMix },
|
||||
{ "deleteMixes", luaModelDeleteMixes },
|
||||
{ "getLogicalSwitch", luaModelGetLogicalSwitch },
|
||||
{ "setLogicalSwitch", luaModelSetLogicalSwitch },
|
||||
{ "getCustomFunction", luaModelGetCustomFunction },
|
||||
@@ -1033,6 +1058,7 @@ void luaInit()
|
||||
lua_registerint(L, "EVT_PAGE_BREAK", EVT_KEY_BREAK(KEY_PAGE));
|
||||
lua_registerint(L, "EVT_PAGE_LONG", EVT_KEY_LONG(KEY_PAGE));
|
||||
lua_registerint(L, "EVT_ENTER_BREAK", EVT_KEY_BREAK(KEY_ENTER));
|
||||
lua_registerint(L, "EVT_ENTER_LONG", EVT_KEY_LONG(KEY_ENTER));
|
||||
lua_registerint(L, "EVT_EXIT_BREAK", EVT_KEY_BREAK(KEY_EXIT));
|
||||
lua_registerint(L, "EVT_PLUS_BREAK", EVT_KEY_BREAK(KEY_PLUS));
|
||||
lua_registerint(L, "EVT_MINUS_BREAK", EVT_KEY_BREAK(KEY_MINUS));
|
||||
|
||||
@@ -333,6 +333,32 @@ uint16_t evalChkSum()
|
||||
return sum;
|
||||
}
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
void clearInputs()
|
||||
{
|
||||
memset(g_model.expoData, 0, sizeof(g_model.expoData)); // clear all expos
|
||||
}
|
||||
|
||||
void defaultInputs()
|
||||
{
|
||||
clearInputs();
|
||||
|
||||
for (int i=0; i<NUM_STICKS; i++) {
|
||||
uint8_t stick_index = channel_order(i+1);
|
||||
ExpoData *expo = expoAddress(i);
|
||||
expo->srcRaw = MIXSRC_Rud - 1 + stick_index;
|
||||
expo->curve.type = CURVE_REF_EXPO;
|
||||
expo->chn = i;
|
||||
expo->weight = 100;
|
||||
expo->mode = 3; // TODO constant
|
||||
for (int c=0; c<4; c++) {
|
||||
g_model.inputNames[i][c] = char2idx(STR_VSRCRAW[1+STR_VSRCRAW[0]*stick_index+c]);
|
||||
}
|
||||
}
|
||||
eeDirty(EE_MODEL);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(TEMPLATES)
|
||||
inline void applyDefaultTemplate()
|
||||
{
|
||||
|
||||
@@ -1091,6 +1091,11 @@ int expo(int x, int k);
|
||||
#define APPLY_EXPOS_EXTRA_PARAMS
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
void clearInputs();
|
||||
void defaultInputs();
|
||||
#endif
|
||||
|
||||
void applyExpos(int16_t *anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS_INC);
|
||||
int16_t applyLimits(uint8_t channel, int32_t value);
|
||||
|
||||
|
||||
+4
-27
@@ -101,34 +101,11 @@ void mixSetWeight(MixData* md, int8_t weight)
|
||||
}
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
void clearInputs()
|
||||
{
|
||||
memset(g_model.expoData, 0, sizeof(g_model.expoData)); // clear all expos
|
||||
}
|
||||
|
||||
void defaultInputs()
|
||||
{
|
||||
clearInputs();
|
||||
|
||||
for (int i=0; i<NUM_STICKS; i++) {
|
||||
uint8_t stick_index = channel_order(i+1);
|
||||
ExpoData *expo = expoAddress(i);
|
||||
expo->srcRaw = MIXSRC_Rud - 1 + stick_index;
|
||||
expo->curve.type = CURVE_REF_EXPO;
|
||||
expo->chn = i;
|
||||
expo->weight = 100;
|
||||
expo->mode = 3; // TODO constant
|
||||
for (int c=0; c<4; c++) {
|
||||
g_model.inputNames[i][c] = char2idx(STR_VSRCRAW[1+STR_VSRCRAW[0]*stick_index+c]);
|
||||
}
|
||||
}
|
||||
eeDirty(EE_MODEL);
|
||||
}
|
||||
#define TMPL_INPUT(x) (MIXSRC_FIRST_INPUT+channel_order(x)-1)
|
||||
#define TMPL_INPUT(x) (MIXSRC_FIRST_INPUT+channel_order(x)-1)
|
||||
#else
|
||||
#define clearInputs()
|
||||
#define defaultInputs()
|
||||
#define TMPL_INPUT(x) (MIXSRC_Rud+x-1)
|
||||
#define clearInputs()
|
||||
#define defaultInputs()
|
||||
#define TMPL_INPUT(x) (MIXSRC_Rud+x-1)
|
||||
#endif
|
||||
|
||||
void clearMixes()
|
||||
|
||||
Reference in New Issue
Block a user