Very rough POC pinmap set

This commit is contained in:
3djc
2019-02-11 10:37:15 +01:00
parent 1baf2e740e
commit b58aaaa19a
13 changed files with 39 additions and 16 deletions
+22 -5
View File
@@ -1743,20 +1743,27 @@ void menuModelFailsafe(event_t event)
void menuModelPinmap(event_t event)
{
const int lim = (g_model.extendedLimits ? (512 * LIMIT_EXT_PERCENT / 100) : 512) * 2;
uint8_t wbar = LCD_W / 2 - 20;
SIMPLE_SUBMENU_NOTITLE(sentModuleChannels(g_moduleIdx) + 1);
lcdDrawTextAlignedCenter(0, PINMAPSET);
lcdDrawTextAlignedLeft(0, STR_PINMAPSET);
for (uint8_t pos=0; pos<PXX2_LEN_REGISTRATION_ID; pos++) {
lcdDrawHexChar(50 + pos*FW*2, 0, g_model.moduleData[INTERNAL_MODULE].pxx2.receivers[g_receiverIdx].rxID[pos], 0);
}
lcdInvertLine(0);
//const coord_t x = 1;
const coord_t x = 1;
coord_t y = FH + 1;
uint8_t line = (menuVerticalPosition >= sentModuleChannels(g_moduleIdx) ? 2 : 0);
uint8_t pin = (menuVerticalPosition >= 8 ? 8 : 0) + line;
for (; line < 8; line++) {
const int32_t channelValue = channelOutputs[getPinOuput(g_receiverIdx, g_moduleIdx, pin)];
//Pin
lcdDrawTextAlignedLeft(y, "Pin");
lcdDrawNumber(lcdLastRightPos+5, y, pin);
lcdDrawNumber(lcdLastRightPos+5, y, pin+1);
lcdDrawText(lcdLastRightPos+5, y, " -> ");
@@ -1764,11 +1771,21 @@ void menuModelPinmap(event_t event)
LcdFlags flags = SMLSIZE;
if (menuVerticalPosition == pin) {
flags |= INVERS;
if (s_editMode) {
if (s_editMode > 0) {
uint8_t channel = getPinOuput(g_receiverIdx, g_moduleIdx, pin);
flags |= BLINK;
CHECK_INCDEC_MODELVAR(event, channel, 0, sentModuleChannels(g_moduleIdx));
setPinOuput(g_receiverIdx, g_moduleIdx, pin, channel);
}
}
lcdDrawNumber(lcdLastRightPos+5, y, getPinOuput(g_receiverIdx, g_moduleIdx, pin), flags);
//lcdDrawNumber(lcdLastRightPos+5, y, getPinOuput(g_receiverIdx, g_moduleIdx, pin)+1, flags);
putsChn(lcdLastRightPos+5, y, getPinOuput(g_receiverIdx, g_moduleIdx, pin)+1, flags);
const uint8_t lenChannel = limit<uint8_t>(1, (abs(channelValue) * wbar/2 + lim/2) / lim, wbar/2);
const coord_t xChannel = (channelValue>0) ? x+LCD_W-3-wbar/2 : x+LCD_W-2-wbar/2-lenChannel;
lcdDrawHorizontalLine(xChannel, y+1, lenChannel, DOTTED, 0);
lcdDrawHorizontalLine(xChannel, y+2, lenChannel, DOTTED, 0);
y += FH;
+6
View File
@@ -22,6 +22,7 @@
#define _MODULES_H_
#include "myeeprom.h"
#include "bitfield.h"
#define CROSSFIRE_CHANNELS_COUNT 16
@@ -205,6 +206,11 @@ inline uint8_t getPinOuput(uint8_t receiverIdx, uint8_t moduleIdx, uint8_t pin)
return ((g_model.moduleData[moduleIdx].pxx2.receivers[receiverIdx].channelMapping >> (pin + ((pin & 0x01) ? -1 : 1 )) * 4) & 0x0F);
}
inline void setPinOuput(uint8_t receiverIdx, uint8_t moduleIdx, uint8_t pin, uint8_t chan)
{
BF_SET(g_model.moduleData[moduleIdx].pxx2.receivers[receiverIdx].channelMapping, chan, (pin + ((pin & 0x01) ? -1 : 1 )) * 4, 4);
}
inline int8_t maxModuleChannels_M8(uint8_t idx)
{
if (isExtraModule(idx))
+1 -1
View File
@@ -921,7 +921,7 @@
#define TR_EXTERNALRF "Externí RF modul"
#define TR_FAILSAFE TR("Failsafe", "Mód Failsafe")
#define TR_FAILSAFESET "NASTAVENÍ FAILSAFE"
#define TR_PINMAPSET "Set PIN to CH map"
#define TR_PINMAPSET "PINMAP"
#define TR_HOLD "HOLD"
#define TR_NONE "NONE"
#define TR_MENUSENSOR "SENZOR"
+1 -1
View File
@@ -926,7 +926,7 @@
#define TR_EXTERNALRF "Externes HF-Modul"
#define TR_FAILSAFE TR(INDENT "Failsafe", INDENT "Failsafe Mode")
#define TR_FAILSAFESET "Failsafe setzen"
#define TR_PINMAPSET "Set PIN to CH map"
#define TR_PINMAPSET "PINMAP"
#define TR_HOLD "HOLD"
#define TR_NONE "NONE"
#define TR_MENUSENSOR "SENSOR"
+1 -1
View File
@@ -925,7 +925,7 @@
#define TR_EXTERNALRF "External RF"
#define TR_FAILSAFE TR(INDENT "Failsafe", INDENT "Failsafe mode")
#define TR_FAILSAFESET "FAILSAFE SETTINGS"
#define TR_PINMAPSET "Set PIN to CH map"
#define TR_PINMAPSET "PINMAP"
#define TR_HOLD "HOLD"
#define TR_NONE "NONE"
#define TR_MENUSENSOR "SENSOR"
+1 -1
View File
@@ -932,7 +932,7 @@
#define TR_EXTERNALRF "Externa RF"
#define TR_FAILSAFE INDENT"Modo sgdad."
#define TR_FAILSAFESET "AJUSTES SGDAD."
#define TR_PINMAPSET "Set PIN to CH map"
#define TR_PINMAPSET "PINMAP"
#define TR_HOLD "HOLD"
#define TR_NONE "NONE"
#define TR_MENUSENSOR "SENSOR"
+1 -1
View File
@@ -924,7 +924,7 @@
#define TR_EXTERNALRF "External RF"
#define TR_FAILSAFE INDENT "Failsafe mode"
#define TR_FAILSAFESET "FAILSAFE SETTINGS"
#define TR_PINMAPSET "Set PIN to CH map"
#define TR_PINMAPSET "PINMAP"
#define TR_HOLD "HOLD"
#define TR_NONE "NONE"
#define TR_MENUSENSOR "SENSOR"
+1 -1
View File
@@ -936,7 +936,7 @@
#define TR_EXTERNALRF "HF externe"
#define TR_FAILSAFE TR(INDENT "Failsafe", INDENT "Type failsafe")
#define TR_FAILSAFESET "REGLAGES FAILSAFE"
#define TR_PINMAPSET "Set PIN to CH map"
#define TR_PINMAPSET "PINMAP"
#define TR_HOLD "HOLD"
#define TR_NONE "NONE"
#define TR_MENUSENSOR "CAPTEUR"
+1 -1
View File
@@ -926,7 +926,7 @@
#define TR_EXTERNALRF "Modulo esterno"
#define TR_FAILSAFE "Modo failsafe"
#define TR_FAILSAFESET TR("FAILSAFE","IMPOSTAZIONI FAILSAFE")
#define TR_PINMAPSET "Set PIN to CH map"
#define TR_PINMAPSET "PINMAP"
#define TR_HOLD "HOLD"
#define TR_NONE "NONE"
#define TR_MENUSENSOR "SENSOR"
+1 -1
View File
@@ -927,7 +927,7 @@
#define TR_EXTERNALRF "Externe RF"
#define TR_FAILSAFE TR(INDENT "Failsafe", INDENT "Failsafe Modus")
#define TR_FAILSAFESET "Failsafe instellen"
#define TR_PINMAPSET "Set PIN to CH map"
#define TR_PINMAPSET "PINMAP"
#define TR_HOLD "HOLD"
#define TR_NONE "NONE"
#define TR_MENUSENSOR "SENSOR"
+1 -1
View File
@@ -927,7 +927,7 @@
#define TR_EXTERNALRF "Zewn.Moduł RF"
#define TR_FAILSAFE TR(INDENT"Failsafe",INDENT"Tryb Failsafe")
#define TR_FAILSAFESET "USTAWIENIE FAILSAFE"
#define TR_PINMAPSET "Set PIN to CH map"
#define TR_PINMAPSET "PINMAP"
#define TR_HOLD "HOLD"
#define TR_NONE "NONE"
#define TR_MENUSENSOR "CZUJNIK"
+1 -1
View File
@@ -931,7 +931,7 @@
#define TR_EXTERNALRF "External RF"
#define TR_FAILSAFE "Failsafe mode"
#define TR_FAILSAFESET "FAILSAFE SETTINGS"
#define TR_PINMAPSET "Set PIN to CH map"
#define TR_PINMAPSET "PINMAP"
#define TR_HOLD "HOLD"
#define TR_NONE "NONE"
#define TR_MENUSENSOR "SENSOR"
+1 -1
View File
@@ -940,7 +940,7 @@
#define TR_EXTERNALRF "Extern Radiomodul"
#define TR_FAILSAFE TR(INDENT "Failsafe", INDENT "Failsafeläge")
#define TR_FAILSAFESET "FailsafeInställning"
#define TR_PINMAPSET "Set PIN to CH map"
#define TR_PINMAPSET "PINMAP"
#define TR_HOLD "HOLD"
#define TR_NONE "NONE"
#define TR_MENUSENSOR "SENSOR"