From 34db3d4f611096f99e60c9d26338763b4253a9bc Mon Sep 17 00:00:00 2001 From: 3djc Date: Fri, 12 Apr 2019 14:05:11 +0200 Subject: [PATCH] Module pinmaps need to obey channels limits --- radio/src/gui/128x64/model_receiver_options.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/radio/src/gui/128x64/model_receiver_options.cpp b/radio/src/gui/128x64/model_receiver_options.cpp index 6b48ac21d..ee6636e85 100644 --- a/radio/src/gui/128x64/model_receiver_options.cpp +++ b/radio/src/gui/128x64/model_receiver_options.cpp @@ -122,7 +122,8 @@ void menuModelReceiverOptions(event_t event) // Pin { uint8_t pin = i - ITEM_RECEIVER_PINMAP_FIRST; - uint8_t channel = reusableBuffer.hardwareAndSettings.receiverSettings.outputsMapping[pin]; + uint8_t lastChan = g_model.moduleData[g_moduleIdx].channelsStart + 8 + g_model.moduleData[g_moduleIdx].channelsCount - 1; + uint8_t channel = limit(g_model.moduleData[g_moduleIdx].channelsStart, reusableBuffer.hardwareAndSettings.receiverSettings.outputsMapping[pin], lastChan); int32_t channelValue = channelOutputs[channel]; lcdDrawText(0, y, "Pin"); lcdDrawNumber(lcdLastRightPos + 1, y, pin + 1); @@ -130,7 +131,7 @@ void menuModelReceiverOptions(event_t event) // Channel if (attr) { - channel = checkIncDec(event, channel, 0, sentModuleChannels(g_moduleIdx) - 1); + channel = checkIncDec(event, channel, g_model.moduleData[g_moduleIdx].channelsStart, g_model.moduleData[g_moduleIdx].channelsStart + 8 + g_model.moduleData[g_moduleIdx].channelsCount - 1); if (checkIncDec_Ret) { reusableBuffer.hardwareAndSettings.receiverSettings.outputsMapping[pin] = channel; reusableBuffer.hardwareAndSettings.receiverSettings.dirty = true;