1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-24 00:35:18 +03:00

5 pins were displayed when max was 4 in RX options

This commit is contained in:
Bertrand Songis 2019-04-23 09:26:39 +02:00
parent 16a0baf4e1
commit b18fa3b60b
3 changed files with 30 additions and 19 deletions

View file

@ -122,29 +122,31 @@ void menuModelReceiverOptions(event_t event)
// Pin
{
uint8_t pin = i - ITEM_RECEIVER_PINMAP_FIRST;
uint8_t channel = g_model.moduleData[g_moduleIdx].channelsStart + reusableBuffer.hardwareAndSettings.receiverSettings.outputsMapping[pin];
int32_t channelValue = channelOutputs[channel];
lcdDrawText(0, y, "Pin");
lcdDrawNumber(lcdLastRightPos + 1, y, pin + 1);
putsChn(7 * FW, y, channel + 1, attr);
if (pin < reusableBuffer.hardwareAndSettings.receiverSettings.outputsCount) {
uint8_t channel = g_model.moduleData[g_moduleIdx].channelsStart + reusableBuffer.hardwareAndSettings.receiverSettings.outputsMapping[pin];
int32_t channelValue = channelOutputs[channel];
lcdDrawText(0, y, "Pin");
lcdDrawNumber(lcdLastRightPos + 1, y, pin + 1);
putsChn(7 * FW, y, channel + 1, attr);
// Channel
if (attr) {
channel = checkIncDec(event, channel, 0, sentModuleChannels(g_moduleIdx) - 1);
if (checkIncDec_Ret) {
reusableBuffer.hardwareAndSettings.receiverSettings.outputsMapping[pin] = channel;
reusableBuffer.hardwareAndSettings.receiverSettings.dirty = true;
// Channel
if (attr) {
channel = checkIncDec(event, channel, 0, sentModuleChannels(g_moduleIdx) - 1);
if (checkIncDec_Ret) {
reusableBuffer.hardwareAndSettings.receiverSettings.outputsMapping[pin] = channel;
reusableBuffer.hardwareAndSettings.receiverSettings.dirty = true;
}
}
}
// Bargraph
// Bargraph
#if !defined(PCBX7) // X7 LCD doesn't like too many horizontal lines
lcdDrawRect(LCD_W - 3 - wbar, y + 1, wbar + 1, 4);
lcdDrawRect(LCD_W - 3 - wbar, y + 1, wbar + 1, 4);
#endif
const uint8_t lenChannel = limit<uint8_t>(1, (abs(channelValue) * wbar / 2 + lim / 2) / lim, wbar / 2);
const coord_t xChannel = (channelValue > 0) ? LCD_W - 3 - wbar / 2 : LCD_W - 2 - wbar / 2 - lenChannel;
lcdDrawHorizontalLine(xChannel, y + 2, lenChannel, SOLID, 0);
lcdDrawHorizontalLine(xChannel, y + 3, lenChannel, SOLID, 0);
const uint8_t lenChannel = limit<uint8_t>(1, (abs(channelValue) * wbar / 2 + lim / 2) / lim, wbar / 2);
const coord_t xChannel = (channelValue > 0) ? LCD_W - 3 - wbar / 2 : LCD_W - 2 - wbar / 2 - lenChannel;
lcdDrawHorizontalLine(xChannel, y + 2, lenChannel, SOLID, 0);
lcdDrawHorizontalLine(xChannel, y + 3, lenChannel, SOLID, 0);
}
break;
}
}

View file

@ -1358,7 +1358,7 @@ void menuModelSetup(event_t event)
if (attr && EVT_KEY_MASK(event) == KEY_ENTER) {
killEvents(event);
if (isPXX2ReceiverEmpty(moduleIdx, receiverIdx)) {
if (!isSimu() && isPXX2ReceiverEmpty(moduleIdx, receiverIdx)) {
onPXX2ReceiverMenu(STR_BIND);
}
else {

View file

@ -1400,4 +1400,13 @@ enum JackMode {
#include "gyro.h"
#endif
inline bool isSimu()
{
#if defined(SIMU)
return true;
#else
return false;
#endif
}
#endif // _OPENTX_H_