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

Cosmetics

This commit is contained in:
Bertrand Songis 2019-03-09 16:47:54 +01:00
parent 1c70646cf1
commit ec806234c6
2 changed files with 28 additions and 28 deletions

View file

@ -1908,7 +1908,7 @@ void menuModelFailsafe(event_t event)
enum MenuModelReceiverOptions { enum MenuModelReceiverOptions {
ITEM_RECEIVER_TELEMETRY, ITEM_RECEIVER_TELEMETRY,
ITEM_RECEIVER_PWM_RATE, ITEM_RECEIVER_PWM_RATE,
ITEM_RECEIVER_PINMAP ITEM_RECEIVER_PINMAP_FIRST
}; };
#define RECEIVER_OPTIONS_2ND_COLUMN 80 #define RECEIVER_OPTIONS_2ND_COLUMN 80
@ -1925,7 +1925,7 @@ void menuModelReceiverOptions(event_t event)
const int lim = (g_model.extendedLimits ? (512 * LIMIT_EXT_PERCENT / 100) : 512) * 2; const int lim = (g_model.extendedLimits ? (512 * LIMIT_EXT_PERCENT / 100) : 512) * 2;
uint8_t wbar = LCD_W / 2 - 20; uint8_t wbar = LCD_W / 2 - 20;
SUBMENU_NOTITLE(sentModuleChannels(g_moduleIdx) + ITEM_RECEIVER_PINMAP, {IF_TELEM_DISPLAYED(0), IF_PWM_RATE_DISPLAYED(0)}); SUBMENU_NOTITLE(sentModuleChannels(g_moduleIdx) + ITEM_RECEIVER_PINMAP_FIRST, {IF_TELEM_DISPLAYED(0), IF_PWM_RATE_DISPLAYED(0)});
int8_t sub = menuVerticalPosition; int8_t sub = menuVerticalPosition;
@ -1942,12 +1942,13 @@ void menuModelReceiverOptions(event_t event)
#if defined(SIMU) #if defined(SIMU)
reusableBuffer.receiverSetup.state = 0xFF; reusableBuffer.receiverSetup.state = 0xFF;
#endif #endif
if (reusableBuffer.receiverSetup.state != 0) { if (reusableBuffer.receiverSetup.state != 0) {
for (uint8_t k=0; k<LCD_LINES-1; k++) { for (uint8_t k=0; k<LCD_LINES-1; k++) {
coord_t y = MENU_HEADER_HEIGHT + 1 + k*FH; coord_t y = MENU_HEADER_HEIGHT + 1 + k*FH;
uint8_t i = k + menuVerticalOffset; uint8_t i = k + menuVerticalOffset;
LcdFlags attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0); LcdFlags attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
uint8_t pin = i - ITEM_RECEIVER_PINMAP; uint8_t pin = i - ITEM_RECEIVER_PINMAP_FIRST;
uint8_t channel = reusableBuffer.receiverSetup.channelMapping[pin]; uint8_t channel = reusableBuffer.receiverSetup.channelMapping[pin];
int32_t channelValue = channelOutputs[channel]; int32_t channelValue = channelOutputs[channel];
@ -1960,33 +1961,32 @@ void menuModelReceiverOptions(event_t event)
break; break;
default: default:
// Pin
lcdDrawText(0, y, "Pin");
lcdDrawNumber(lcdLastRightPos + 1, y, pin + 1);
// Pin // Channel
lcdDrawText(0, y, "Pin"); if (menuVerticalPosition == pin) {
lcdDrawNumber(lcdLastRightPos + 1, y, pin + 1); if (s_editMode > 0) {
channel = checkIncDec(event, channel, 0, sentModuleChannels(g_moduleIdx));
// Channel if (checkIncDec_Ret) {
if (menuVerticalPosition == pin) { reusableBuffer.receiverSetup.channelMapping[pin] = channel;
if (s_editMode > 0) { reusableBuffer.receiverSetup.state = 0x40;
channel = checkIncDec(event, channel, 0, sentModuleChannels(g_moduleIdx)); moduleSettings[reusableBuffer.receiverSetup.moduleIdx].mode = MODULE_MODE_RECEIVER_SETTINGS;
if (checkIncDec_Ret) { }
reusableBuffer.receiverSetup.channelMapping[pin] = channel;
reusableBuffer.receiverSetup.state = 0x40;
moduleSettings[reusableBuffer.receiverSetup.moduleIdx].mode = MODULE_MODE_RECEIVER_SETTINGS;
} }
} }
} putsChn(7 * FW, y, channel + 1, attr);
putsChn(7 * FW, y, channel + 1, attr);
// Bargraph // Bargraph
#if !defined(PCBX7) // X7 LCD doesn't like too many horizontal lines #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 #endif
const uint8_t lenChannel = limit<uint8_t>(1, (abs(channelValue) * wbar / 2 + lim / 2) / lim, wbar / 2); 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; 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 + 2, lenChannel, SOLID, 0);
lcdDrawHorizontalLine(xChannel, y + 3, lenChannel, SOLID, 0); lcdDrawHorizontalLine(xChannel, y + 3, lenChannel, SOLID, 0);
break; break;
} }
} }
} }

View file

@ -155,8 +155,8 @@ void Pxx2Pulses::setupReceiverSettingsFrame(uint8_t module)
addFrameType(PXX2_TYPE_C_MODULE, PXX2_TYPE_ID_RX_SETTINGS); addFrameType(PXX2_TYPE_C_MODULE, PXX2_TYPE_ID_RX_SETTINGS);
Pxx2Transport::addByte(reusableBuffer.receiverSetup.state + reusableBuffer.receiverSetup.receiverId); Pxx2Transport::addByte(reusableBuffer.receiverSetup.state + reusableBuffer.receiverSetup.receiverId);
uint8_t flag1 = 0; uint8_t flag1 = 0;
if(reusableBuffer.receiverSetup.pwmRate) if (reusableBuffer.receiverSetup.pwmRate)
flag1 ^= 0x30; flag1 |= 0x10;
Pxx2Transport::addByte(flag1); Pxx2Transport::addByte(flag1);
for (int i = 0; i < 24; i++) { for (int i = 0; i < 24; i++) {
Pxx2Transport::addByte(reusableBuffer.receiverSetup.channelMapping[i]); Pxx2Transport::addByte(reusableBuffer.receiverSetup.channelMapping[i]);