1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-19 14:25:11 +03:00

Merge pull request #2290 from opentx/bsongis/issue_2266_set_failsafe_custom_function

Fixes #2266
This commit is contained in:
Bertrand Songis 2015-06-29 22:57:23 +02:00
commit ff409321ff
18 changed files with 35 additions and 20 deletions

View file

@ -371,10 +371,26 @@ void evalFunctions()
}
#endif
#if defined(CPUARM)
case FUNC_SET_FAILSAFE:
{
unsigned int moduleIndex = CFN_PARAM(cfn);
if (moduleIndex < NUM_MODULES) {
for (int ch=0; ch<NUM_CHNOUT; ch++) {
if (ch < g_model.moduleData[moduleIndex].channelsStart || ch >= NUM_CHANNELS(moduleIndex) + g_model.moduleData[moduleIndex].channelsStart) {
g_model.moduleData[moduleIndex].failsafeChannels[ch] = 0;
}
else if (g_model.moduleData[moduleIndex].failsafeChannels[ch] < FAILSAFE_CHANNEL_HOLD) {
g_model.moduleData[moduleIndex].failsafeChannels[ch] = channelOutputs[ch];
}
}
}
}
#endif
#if defined(DANGEROUS_MODULE_FUNCTIONS)
case FUNC_RANGECHECK:
case FUNC_BIND:
case FUNC_MODULE_OFF:
{
unsigned int moduleIndex = CFN_PARAM(cfn);
if (moduleIndex < NUM_MODULES) {