mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-04 16:38:12 +00:00
Frankie dsm fwrd prg enhancements (#806)
* #751 DSM Enhancements #751 DSM Forward Programming Enhancements (New GUI, etc) * Make both work on EdgeTx and OpenTX * #751 Turn OFF simulation by default Distribution code with RX simulation OFF Simulation should be only for Development * #751 Update Readme Documentation Updated the Readme.txt documentation and removed compiled luac file that was check in by mistake * #751 Fix problems With Reset RX 1. Fix problem when trying to Factory Reset. Enter Bind Mode. Save backup, Restore Backup 2. Found a way to advance on the Gyro initial Setup menus.. a bit of a hack, but works. 3. Handle RX resets properly. It needed after initial setup * #751 Cosmetic and Show Orientation Images #751 1. Fix problems when text contradictions between Menu/Line Headers and List Values 2. Show Images of RX orientations 3. Able to Hack getting into Initial Setup and other menus who was failing before 4. Custumize the way Flight Mode reports the Value on Screen * #751 add check for required libraries Add check that the required files in DSMLIB exist * #751 Write documentation about the protocol so that we don't forget later what we know, and enable others to understand the logs and maybe help solve problems. * #766 Change the way to detect that the files exist. now works on both ETX and OTX * #766 Strange Flickering in OTX Strange Flickering happening on OTX. Refreshing the screen on every cycle fixed the problem * #766 Change way of dectecting EdgeTX Change way of detecting OTX in multiple versions: OTX 2.3.14 and 2.3.15 * #766 make editable Gain Values Gains and other settings should be editable even when they are VALUE_NOCHANGING. Flight Mode is an exception that is handled properly. Right align numbers. * #766 More enhacements Added AR630 Make numbers right justified Cleanup some log messages and line types. Updated DSM FWD prog documentation * #751 more cosmetic things 1. Added AR10360T, 2. Simplify way to configured the hack for more receivers. 3. Change some texts on menus to march spektrum 4. Background color in Spektrum theme to match * #751 A few final changes 1. Update channel names to include channel number. i.e: Ch5 (Gear) 2, Fix flight mode display for Heli Receiver 3. i think the unknown lines are to request info about the TX settings * #751 1. Added Warning Screen 2. Correct handling of Unknown lines in Gyro Settings->Initial Setup * #751 New v0.51 version. - Added new menus to configure Model/Wing type. Without it, the initial setup will not work properly. * #751 More fixes on mixers and servo reverse -- Fix problem reversing servos when using vtail/delta mix -- Properly detect ch order of multimodule * #751 Updated channel naming and docs Updated readme documentation Consistent naming of Ch across the code. * #751 Fix message displaying data path * #751 More improvements 1. Much easier to select channels > Ch6 for FMode, Gain and Panic channels 2. B&W version for smaller screens (128x64).. Memory footprint still a problem. 3. Fix a lot typos/misspell/grammar in the documentation Co-authored-by: pascallanger <pascal_langer@yahoo.fr>
This commit is contained in:
parent
90bb5f8871
commit
f49f03d7da
@ -1,5 +1,5 @@
|
||||
local toolName = "TNS|DSM Forward Prog v0.52 (Text B&W) |TNE"
|
||||
local VERSION = "v0.52"
|
||||
local toolName = "TNS|DSM Forward Prog v0.53 (Text B&W) |TNE"
|
||||
local VERSION = "v0.53"
|
||||
|
||||
|
||||
---- #########################################################################
|
||||
@ -109,8 +109,12 @@ end
|
||||
|
||||
local function GUI_Diplay_Button(x,y,w,h,text,selected)
|
||||
local attr = (selected) and INVERS or 0 -- INVERS if line Selected
|
||||
lcd.drawText(x+5,y+2, text, attr + TEXT_SIZE)
|
||||
lcd.drawRectangle(x, y, w, h, LINE_COLOR)
|
||||
if (TEXT_SIZE~=SMLSIZE) then
|
||||
lcd.drawText(x+5,y+2, text, attr + TEXT_SIZE)
|
||||
lcd.drawRectangle(x, y, w, h, LINE_COLOR)
|
||||
else -- SMALL Screen
|
||||
lcd.drawText(x,y, text, attr + TEXT_SIZE)
|
||||
end
|
||||
end
|
||||
|
||||
local function GUI_Display_Menu(menu)
|
||||
@ -120,11 +124,9 @@ local function GUI_Display_Menu(menu)
|
||||
-- Center Header
|
||||
local tw = openTx_lcd_sizeText(menu.Text)
|
||||
local x = w/2 - tw/2 -- Center of Screen - Center of Text
|
||||
if (x < 0) then x=0 end -- in case text is too wide
|
||||
|
||||
local bold = 0
|
||||
if (TEXT_SIZE~=SMLSIZE) then -- Ignore Bold on small size screens
|
||||
bold = BOLD
|
||||
end
|
||||
local bold = BOLD
|
||||
lcd.drawText(x,LCD_Y_MENU_TITLE,menu.Text,bold + TEXT_SIZE)
|
||||
|
||||
-- Back
|
||||
@ -154,17 +156,16 @@ local function GUI_Display_Line_Menu(x,y,w,h,line,selected)
|
||||
-- Menu Line
|
||||
text = text .. " >"
|
||||
else -- SubHeaders and plain text lines
|
||||
if (TEXT_SIZE~=SMLSIZE) then -- ignore bold on small size screens
|
||||
bold = (dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR.BOLD) and BOLD) or 0
|
||||
end
|
||||
bold = (dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR._BOLD) and BOLD) or 0
|
||||
|
||||
if dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR.RIGHT) then -- Right Align???
|
||||
if dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR._RIGHT) then -- Right Align???
|
||||
local tw = openTx_lcd_sizeText(line.Text)+4
|
||||
x = LCD_X_LINE_VALUE - tw -- Right
|
||||
elseif dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR.CENTER) then -- Center??
|
||||
elseif dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR._CENTER) then -- Center??
|
||||
local tw = openTx_lcd_sizeText(line.Text)
|
||||
x = x + (LCD_X_LINE_VALUE - LCD_X_LINE_MENU)/2 - tw/2 -- Center - 1/2 Text
|
||||
end
|
||||
if (x < 0) then x=0 end -- in case text is too wide
|
||||
end
|
||||
|
||||
lcd.drawText(x,y, text, attr + bold + TEXT_SIZE)
|
||||
@ -185,17 +186,16 @@ local function GUI_Display_Line_Value(lineNum, line, value, selected, editing)
|
||||
header = dsmLib.GetFlightModeValue(line)
|
||||
|
||||
-- Flight mode display attributes
|
||||
if (TEXT_SIZE~=SMLSIZE) then -- ignore bold on small size screens
|
||||
bold = (dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR.BOLD) and BOLD) or 0
|
||||
end
|
||||
bold = (dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR._BOLD) and BOLD) or 0
|
||||
|
||||
if dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR.RIGHT) then -- Right Align
|
||||
if dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR._RIGHT) then -- Right Align
|
||||
local tw = openTx_lcd_sizeText(header)+4
|
||||
x = LCD_X_LINE_VALUE - tw -- Right
|
||||
elseif dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR.CENTER) then -- Centered
|
||||
elseif dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR._CENTER) then -- Centered
|
||||
local tw = openTx_lcd_sizeText(header)
|
||||
x = x + (LCD_X_LINE_VALUE - LCD_X_LINE_TITLE)/2 - tw/2 -- Center - 1/2 Text
|
||||
end
|
||||
if (x < 0) then x=0 end -- in case text is too wide
|
||||
else
|
||||
-- No Flight Mode, no effects here
|
||||
header = header .. ":"
|
||||
@ -211,7 +211,7 @@ local function GUI_Display_Line_Value(lineNum, line, value, selected, editing)
|
||||
attrib = INVERS
|
||||
if editing then -- blink editing entry
|
||||
attrib = attrib + BLINK
|
||||
value = "[ " .. value .. " ]"
|
||||
value = "[" .. value .. "]"
|
||||
end
|
||||
end
|
||||
|
||||
@ -228,7 +228,14 @@ local function GUI_ShowBitmap(x,y,imgData)
|
||||
local f = string.gmatch(imgData, '([^%|]+)') -- Iterator over values split by '|'
|
||||
local imgName, imgMsg = f(), f()
|
||||
|
||||
lcd.drawText(x, y, imgMsg or "") -- Alternate Image MSG
|
||||
if (LCD_W > 128) then
|
||||
lcd.drawText(x, y, imgMsg or "", TEXT_SIZE) -- Alternate Image MSG
|
||||
else
|
||||
local f = string.gmatch(imgMsg, '([^%:]+)') -- Iterator over values split by ':'
|
||||
local msg1,msg2 = f(), f()
|
||||
lcd.drawText(x, y, (msg1 or "")..":", TEXT_SIZE) -- Alternate Image MSG
|
||||
lcd.drawText(x, y+10, msg2 or "", TEXT_SIZE) -- Alternate Image MSG
|
||||
end
|
||||
|
||||
-- NO IMAGES in Text B&W
|
||||
--local imgPath = IMAGE_PATH .. (imgName or "")
|
||||
@ -242,16 +249,22 @@ end
|
||||
local function GUI_Display()
|
||||
local ctx = DSM_Context
|
||||
lcd.clear()
|
||||
local header = "DSM Fwrd Programming "
|
||||
|
||||
if (TEXT_SIZE==SMLSIZE) then -- Small Screen no title
|
||||
header = ""
|
||||
end
|
||||
|
||||
local header = "DSM Fwrd Programming "
|
||||
if ctx.Phase ~= PHASE.RX_VERSION then
|
||||
header = header .. "RX "..ctx.RX.Name.." v"..ctx.RX.Version
|
||||
header = header .. ctx.RX.Name.." v"..ctx.RX.Version
|
||||
end
|
||||
|
||||
--Draw title
|
||||
if (TEXT_SIZE~=SMLSIZE) then -- ignore tool title small size screens
|
||||
lcd.drawFilledRectangle(0, 0, LCD_W, 20, TITLE_BGCOLOR)
|
||||
lcd.drawText(5, 0, header, MENU_TITLE_COLOR + TEXT_SIZE)
|
||||
else -- Small Screen
|
||||
lcd.drawText(20, LCD_Y_LOWER_BUTTONS+1, header, TEXT_SIZE)
|
||||
end
|
||||
--Draw RX Menu
|
||||
if ctx.Phase == PHASE.RX_VERSION then
|
||||
@ -402,6 +415,7 @@ local function GUI_HandleEvent(event, touchState)
|
||||
-- enter Edit the current line
|
||||
ctx.EditLine = ctx.SelLine
|
||||
originalValue = menuLines[ctx.SelLine].Val
|
||||
dsmLib.ChangePhase(PHASE.VALUE_CHANGING_WAIT)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -422,20 +436,20 @@ local function init_screen_pos()
|
||||
TEXT_SIZE = SMLSIZE
|
||||
LCD_W_USABLE = 128
|
||||
|
||||
LCD_W_BUTTONS = 30
|
||||
LCD_H_BUTTONS = 17
|
||||
LCD_X_RIGHT_BUTTONS = 128 - LCD_W_BUTTONS - 5
|
||||
LCD_W_BUTTONS = 16
|
||||
LCD_H_BUTTONS = 10
|
||||
LCD_X_RIGHT_BUTTONS = 128 - LCD_W_BUTTONS - 3
|
||||
|
||||
LCD_X_LINE_MENU = 0
|
||||
-- X offsets for (Title: [Value] debugInfo) lines
|
||||
LCD_X_LINE_TITLE = 0
|
||||
LCD_X_LINE_VALUE = 90
|
||||
LCD_X_LINE_VALUE = 75
|
||||
LCD_X_LINE_DEBUG = 110
|
||||
|
||||
LCD_Y_LINE_HEIGHT = 17
|
||||
LCD_Y_LINE_HEIGHT = 7
|
||||
LCD_Y_MENU_TITLE = 0
|
||||
LCD_Y_LINE_FIRST = LCD_Y_MENU_TITLE + 17
|
||||
LCD_Y_LOWER_BUTTONS = LCD_Y_LINE_FIRST + 7 * LCD_Y_LINE_HEIGHT
|
||||
LCD_Y_LINE_FIRST = LCD_Y_MENU_TITLE + 8
|
||||
LCD_Y_LOWER_BUTTONS = LCD_Y_LINE_FIRST + (7 * LCD_Y_LINE_HEIGHT)
|
||||
end
|
||||
end
|
||||
|
||||
@ -443,20 +457,32 @@ local function GUI_Warning(event)
|
||||
lcd.clear()
|
||||
local header = "DSM Forward Programming "..VERSION.." "
|
||||
--Draw title
|
||||
lcd.drawFilledRectangle(0, 0, LCD_W, 17, TITLE_BGCOLOR)
|
||||
lcd.drawText(5, 0, header, MENU_TITLE_COLOR + TEXT_SIZE)
|
||||
if (LCD_W > 128) then
|
||||
lcd.drawFilledRectangle(0, 0, LCD_W, 17, TITLE_BGCOLOR)
|
||||
lcd.drawText(5, 0, header, MENU_TITLE_COLOR + TEXT_SIZE)
|
||||
|
||||
lcd.drawText(100,20,"INFO", BOLD)
|
||||
lcd.drawText(5,40,"DSM Forward programing shares TX Servo/Output settings", 0)
|
||||
lcd.drawText(5,60,"with the RX. Make sure you setup your plane first in ", 0)
|
||||
lcd.drawText(5,80,"the TX before your start programming your RX.", 0)
|
||||
lcd.drawText(5,100,"Wing & Tail type can be configured using this tool.", 0)
|
||||
lcd.drawText(100,20,"INFO", BOLD)
|
||||
lcd.drawText(5,40,"DSM Forward programing shares TX Servo/Output settings", TEXT_SIZE)
|
||||
lcd.drawText(5,60,"with the RX. Make sure you setup your plane first in ", TEXT_SIZE)
|
||||
lcd.drawText(5,80,"the TX before your start programming your RX.", TEXT_SIZE)
|
||||
lcd.drawText(5,100,"Wing & Tail type can be configured using this tool.", TEXT_SIZE)
|
||||
|
||||
lcd.drawText(5,150,"TX Servo settings are sent to the RX during 'Initial Setup'", 0)
|
||||
lcd.drawText(5,170,"as well as when using RX menu 'Relearn Servo Settings'", 0)
|
||||
lcd.drawText(5,200,"ALWAYS TEST Gyro reactions after this conditions before flying.", BOLD)
|
||||
lcd.drawText(5,150,"TX Servo settings are sent to the RX during 'Initial Setup'", TEXT_SIZE)
|
||||
lcd.drawText(5,170,"as well as when using RX menu 'Relearn Servo Settings'", TEXT_SIZE)
|
||||
lcd.drawText(5,200,"ALWAYS TEST Gyro reactions after this conditions before flying.", BOLD+TEXT_SIZE)
|
||||
|
||||
lcd.drawText(100,250," OK ", INVERS + BOLD)
|
||||
lcd.drawText(100,250," OK ", INVERS + BOLD + TEXT_SIZE)
|
||||
else
|
||||
lcd.drawText(0,15,"Make sure you setup your plane", TEXT_SIZE)
|
||||
lcd.drawText(0,22,"first. Wing and Tail type.", TEXT_SIZE)
|
||||
|
||||
lcd.drawText(0,30,"TX Servo settings are sent to ", TEXT_SIZE)
|
||||
lcd.drawText(0,37,"the RX during 'Initial Setup' and ", TEXT_SIZE)
|
||||
lcd.drawText(0,45,"ALWAYS TEST Gyro reactions", TEXT_SIZE)
|
||||
lcd.drawText(0,52,"before flying!!!", TEXT_SIZE)
|
||||
|
||||
lcd.drawText(10,0," OK ", INVERS + BOLD + TEXT_SIZE)
|
||||
end
|
||||
|
||||
if event == EVT_VIRTUAL_EXIT or event == EVT_VIRTUAL_ENTER then
|
||||
warningScreenON = false
|
||||
|
@ -1,5 +1,5 @@
|
||||
local toolName = "TNS|DSM Forward Prog v0.52 (Color+Touch) |TNE"
|
||||
local VERSION = "v0.52"
|
||||
local toolName = "TNS|DSM Forward Prog v0.53 (Color+Touch) |TNE"
|
||||
local VERSION = "v0.53"
|
||||
|
||||
---- #########################################################################
|
||||
---- # #
|
||||
@ -210,12 +210,12 @@ local function GUI_Display_Line_Menu(lineNum,line,selected)
|
||||
-- Non Selectable Menu Lines, plain text
|
||||
-- Can be use for sub headers or just regular text lines (like warnings)
|
||||
|
||||
local bold = (dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR.BOLD) and BOLD) or 0
|
||||
local bold = (dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR._BOLD) and BOLD) or 0
|
||||
|
||||
if dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR.RIGHT) then -- Right Align???
|
||||
if dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR._RIGHT) then -- Right Align???
|
||||
local tw = my_lcd_sizeText(line.Text)+4
|
||||
x = LCD_X_LINE_VALUE - tw -- Right
|
||||
elseif dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR.CENTER) then -- Center??
|
||||
elseif dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR._CENTER) then -- Center??
|
||||
local tw = my_lcd_sizeText(line.Text)
|
||||
x = x + (LCD_X_LINE_VALUE - LCD_X_LINE_MENU)/2 - tw/2 -- Center - 1/2 Text
|
||||
end
|
||||
@ -240,12 +240,12 @@ local function GUI_Display_Line_Value(lineNum, line, value, selected, editing)
|
||||
header = dsmLib.GetFlightModeValue(line)
|
||||
|
||||
-- Bold Text???
|
||||
bold = (dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR.BOLD) and BOLD) or 0
|
||||
bold = (dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR._BOLD) and BOLD) or 0
|
||||
|
||||
if dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR.RIGHT) then -- Right Align
|
||||
if dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR._RIGHT) then -- Right Align
|
||||
local tw = my_lcd_sizeText(header)+4
|
||||
x = LCD_X_LINE_VALUE - tw -- Right
|
||||
elseif dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR.CENTER) then -- Centered
|
||||
elseif dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR._CENTER) then -- Centered
|
||||
local tw = my_lcd_sizeText(header)
|
||||
x = x + (LCD_X_LINE_VALUE - LCD_X_LINE_TITLE)/2 - tw/2 -- Center - 1/2 Text
|
||||
end
|
||||
@ -590,6 +590,7 @@ local function GUI_HandleEvent(event, touchState)
|
||||
else -- Edit the current value
|
||||
ctx.EditLine = ctx.SelLine
|
||||
originalValue = menuLines[ctx.SelLine].Val
|
||||
dsmLib.ChangePhase(PHASE.VALUE_CHANGING_WAIT)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -635,11 +636,11 @@ local function GUI_Warning(event,touchState)
|
||||
lcd.drawText(100,20,"INFO", BOLD)
|
||||
lcd.drawText(5,40,"DSM Forward programing shares TX Servo/Output settings", 0)
|
||||
lcd.drawText(5,60,"with the RX. Make sure you setup your plane first in ", 0)
|
||||
lcd.drawText(5,80,"the TX before your start programming your RX.", 0)
|
||||
lcd.drawText(5,80,"the TX before your start Fwrd programming your RX.", 0)
|
||||
lcd.drawText(5,100,"Wing & Tail type can be configured using this tool.", 0)
|
||||
|
||||
lcd.drawText(5,150,"TX Servo settings are sent to the RX during 'Initial Setup'", 0)
|
||||
lcd.drawText(5,170,"as well as when using RX menu 'Relearn Servo Settings'", 0)
|
||||
lcd.drawText(5,150,"TX Gyro Servo settings are sent to the RX during 'Initial Setup'", 0)
|
||||
lcd.drawText(5,170,"as well as when using RX 'Relearn Servo Settings'", 0)
|
||||
lcd.drawText(5,200,"ALWAYS TEST Gyro reactions after this conditions before flying.", BOLD)
|
||||
|
||||
lcd.drawText(100,250," OK ", INVERS + BOLD)
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
|
||||
local DEBUG_ON = ... -- Get Debug_ON from parameters. -- 0=NO DEBUG, 1=HIGH LEVEL 2=MORE DETAILS
|
||||
local LIB_VERSION = "0.52"
|
||||
local LIB_VERSION = "0.53"
|
||||
|
||||
local Lib = { Init_Text = function (rxId) end }
|
||||
|
||||
@ -105,8 +105,9 @@ local CH_MIX_TYPE = {
|
||||
NORM_REV = 0x70
|
||||
}
|
||||
|
||||
-- Bug in Lua compiler, confusing with global BOLD and RIGHT
|
||||
local DISP_ATTR = {
|
||||
BOLD = 0x01, RIGHT=0x02, CENTER=0x04, PERCENT = 0x10, DEGREES=0x20, FORCED_MENU = 0x40
|
||||
_BOLD = 0x01, _RIGHT=0x02, _CENTER=0x04, PERCENT = 0x10, DEGREES=0x20, FORCED_MENU = 0x40
|
||||
}
|
||||
|
||||
local DSM_Context = {
|
||||
@ -375,12 +376,13 @@ local function menuLine2String(l)
|
||||
end
|
||||
end
|
||||
|
||||
txt = string.format("L[#%s T=%s VId=0x%X Text=\"%s\"[0x%X] %s %s MId=0x%X ]",
|
||||
txt = string.format("L[#%s T=%s VId=0x%X Text=\"%s\"[0x%X] %s %s MId=0x%X A=0x%X]",
|
||||
l.lineNum, lineType2String(l.Type), l.ValId,
|
||||
l.Text, l.TextId,
|
||||
value,
|
||||
range,
|
||||
l.MenuId
|
||||
l.MenuId,
|
||||
l.TextAttr
|
||||
)
|
||||
end
|
||||
return txt
|
||||
@ -460,29 +462,33 @@ local function isDisplayAttr(attr, bit)
|
||||
end
|
||||
|
||||
local function ExtractDisplayAttr(text1, attr)
|
||||
local text, pos = string.gsub(text1, "/c", "")
|
||||
if (pos>0) then -- CENTER
|
||||
attr = bit32.bor(attr, DISP_ATTR.CENTER)
|
||||
end
|
||||
local text = text1, pos;
|
||||
|
||||
text, pos = string.gsub(text, "/r", "")
|
||||
if (pos>0) then -- RIGHT
|
||||
attr = bit32.bor(attr, DISP_ATTR.RIGHT)
|
||||
end
|
||||
for i=1,2 do
|
||||
text, pos = string.gsub(text, "/c$", "")
|
||||
if (pos>0) then -- CENTER
|
||||
attr = bit32.bor(attr, DISP_ATTR._CENTER)
|
||||
end
|
||||
|
||||
text, pos = string.gsub(text, "/p", "")
|
||||
if (pos>0) then -- Percent TEXT
|
||||
attr = bit32.bor(attr, DISP_ATTR.PERCENT)
|
||||
end
|
||||
text, pos = string.gsub(text, "/r$", "")
|
||||
if (pos>0) then -- RIGHT
|
||||
attr = bit32.bor(attr, DISP_ATTR._RIGHT)
|
||||
end
|
||||
|
||||
text, pos = string.gsub(text, "/b", "")
|
||||
if (pos>0) then -- BOLD TEXT
|
||||
attr = bit32.bor(attr, DISP_ATTR.BOLD)
|
||||
end
|
||||
text, pos = string.gsub(text, "/p$", "")
|
||||
if (pos>0) then -- Percent TEXT
|
||||
attr = bit32.bor(attr, DISP_ATTR.PERCENT)
|
||||
end
|
||||
|
||||
text, pos = string.gsub(text, "/m", "")
|
||||
if (pos>0) then -- FORCED MENU Button
|
||||
attr = bit32.bor(attr, DISP_ATTR.FORCED_MENU)
|
||||
text, pos = string.gsub(text, "/b$", "")
|
||||
if (pos>0) then -- BOLD TEXT
|
||||
attr = bit32.bor(attr, DISP_ATTR._BOLD)
|
||||
end
|
||||
|
||||
text, pos = string.gsub(text, "/m$", "")
|
||||
if (pos>0) then -- FORCED MENU Button
|
||||
attr = bit32.bor(attr, DISP_ATTR.FORCED_MENU)
|
||||
end
|
||||
end
|
||||
|
||||
return text, attr
|
||||
@ -631,7 +637,12 @@ local function DSM_ReadTxModelData()
|
||||
local ch = MODEL.modelOutputChannel[i]
|
||||
if (ch~=nil) then
|
||||
MODEL.TX_CH_TEXT[i] = ch.formatCh
|
||||
MODEL.PORT_TEXT[i] = string.format("Port%i (%s) ",i+1,MODEL.TX_CH_TEXT[i])
|
||||
if LCD_W <= 128 then -- SMALLER SCREENS
|
||||
MODEL.PORT_TEXT[i] = string.format("P%i (%s) ",i+1,MODEL.TX_CH_TEXT[i])
|
||||
else
|
||||
MODEL.PORT_TEXT[i] = string.format("Port%i (%s) ",i+1,MODEL.TX_CH_TEXT[i])
|
||||
end
|
||||
|
||||
LOG_write("Port%d %s [%d,%d] Rev=%d, Off=%d, ppmC=%d, syn=%d\n",i+1,MODEL.TX_CH_TEXT[i],math.floor(ch.min/10),math.floor(ch.max/10), ch.revert, ch.offset, ch.ppmCenter, ch.symetrical)
|
||||
end
|
||||
end
|
||||
@ -853,14 +864,17 @@ end
|
||||
|
||||
local function DSM_validateMenuValue(valId, text, line)
|
||||
if (DEBUG_ON) then LOG_write("SEND DSM_validateMenuValue(ValueId=0x%X) Extra: Text=\"%s\" Value=%s\n", valId, text, lineValue2String(line)) end
|
||||
DSM_send(0x19, 0x06, int16_MSB(valId), int16_LSB(valId))
|
||||
-- Pascal: i think the 2nd byte is the leghts of the entire message in bytes, so instead of 0x06, should be 0x04 for here.. work both ways
|
||||
DSM_send(0x19, 0x04, int16_MSB(valId), int16_LSB(valId))
|
||||
end
|
||||
|
||||
local function DSM_menuValueChangingWait(valId, text, line)
|
||||
if (DEBUG_ON) then LOG_write("SEND DSM_menuValueChangingWait(ValueId=0x%X) Extra: Text=\"%s\" Value=%s\n", valId, text, lineValue2String(line)) end
|
||||
DSM_send(0x1A, 0x06, int16_MSB(valId), int16_LSB(valId))
|
||||
-- Pascal: i think the 2nd byte is the leghts of the entire message in bytes, so instead of 0x06, should be 0x04 for here.. work both ways
|
||||
local function DSM_menuValueChangingWait(lineNum, text, line)
|
||||
if (DEBUG_ON) then LOG_write("SEND DSM_menuValueChangingWait(lineNo=0x%X) Extra: Text=\"%s\" Val=%s\n", lineNum, text, lineValue2String(line)) end
|
||||
DSM_send(0x1A, 0x04, int16_MSB(lineNum), int16_LSB(lineNum))
|
||||
end
|
||||
|
||||
local function DSM_menuValueChangingWaitEnd(lineNum, text, line)
|
||||
if (DEBUG_ON) then LOG_write("SEND DSM_menuValueChangingEnd(lineNo=0x%X) Extra: Text=\"%s\" Value=%s\n", lineNum, text, lineValue2String(line)) end
|
||||
DSM_send(0x1B, 0x04, int16_MSB(lineNum), int16_LSB(lineNum))
|
||||
end
|
||||
|
||||
-- Send the functionality of the RX channel Port (channel)
|
||||
@ -1008,25 +1022,29 @@ local function DSM_sendRequest()
|
||||
DSM_getNextMenuValue(ctx.Menu.MenuId, line.ValId, line.Text)
|
||||
|
||||
elseif ctx.Phase == PHASE.VALUE_CHANGING then -- send value
|
||||
local line = ctx.MenuLines[ctx.SelLine] -- Updated Value of SELECTED line
|
||||
local line = ctx.MenuLines[ctx.SelLine] -- Updated Value of SELECTED line
|
||||
DSM_updateMenuValue(line.ValId, line.Val, line.Text, line)
|
||||
ctx.Phase = PHASE.VALUE_CHANGING_WAIT
|
||||
|
||||
elseif ctx.Phase == PHASE.VALUE_CHANGING_WAIT then
|
||||
local line = ctx.MenuLines[ctx.SelLine]
|
||||
DSM_menuValueChangingWait(line.ValId, line.Text, line)
|
||||
DSM_menuValueChangingWait(line.lineNum, line.Text, line)
|
||||
|
||||
elseif ctx.Phase == PHASE.VALUE_CHANGE_END then -- send value
|
||||
-- This is a 2 step operation.. Send the value first, then send the Verification.. Value_Changed_Step used for that
|
||||
-- on the validation, the RX will set a valid value if the value is invalid. A Menu_Value Message will come from the RX
|
||||
|
||||
local line = ctx.MenuLines[ctx.SelLine] -- Updat Value of SELECTED line
|
||||
local line = ctx.MenuLines[ctx.SelLine] -- Update Value of SELECTED line
|
||||
if Value_Change_Step == 0 then
|
||||
DSM_updateMenuValue(line.ValId, line.Val, line.Text, line)
|
||||
Value_Change_Step = 1
|
||||
Waiting_RX = 0 -- Keep on Transmitin State, since we want to send a ValidateMenuValue inmediatly after
|
||||
else -- Validate the value
|
||||
elseif Value_Change_Step == 1 then -- Validate the value
|
||||
DSM_validateMenuValue(line.ValId, line.Text, line)
|
||||
Value_Change_Step = 2
|
||||
Waiting_RX = 0 -- Keep on Transmitin State, since we want to send a ValidateMenuValue inmediatly after
|
||||
else -- No more waiting for changes
|
||||
DSM_menuValueChangingWaitEnd(line.lineNum, line.Text, line)
|
||||
Value_Change_Step = 0
|
||||
end
|
||||
|
||||
@ -1373,7 +1391,7 @@ end
|
||||
local function DSM_Init_Text(rxId)
|
||||
--Text to be displayed
|
||||
-- For menu lines who are not navigation to other menus (SubHeders or Plain text)
|
||||
-- you can use some formatting options:
|
||||
-- you can use some formatting options AT THE END OF THE STRING :
|
||||
|
||||
-- Text allightment: /c = CENTER, /r = RIGHT
|
||||
-- Text effects: /b = BOLD
|
||||
@ -1382,7 +1400,7 @@ local function DSM_Init_Text(rxId)
|
||||
-- is usually a message line.. but sometimes, we want to navigate to the same page to refresh values
|
||||
|
||||
-- array List_Values:
|
||||
-- For some Menu LIST VALUES, special Lines of type:LIST_MENU1, the valod options seems not
|
||||
-- For some Menu LIST VALUES, special Lines of type:LIST_MENU1, the valur options seems not
|
||||
-- to be contiguos, the array "Menu_List_Values" can help narrow down the
|
||||
-- valid menu options. I think this should come from the RX, but cant find where.
|
||||
-- Most of the times, Limes of type LIST_MENU1 comes with a 0->244 value range that is not correct
|
||||
@ -1435,7 +1453,7 @@ local function DSM_Init_Text(rxId)
|
||||
Text[0x0040] = "Roll"
|
||||
Text[0x0041] = "Pitch"
|
||||
Text[0x0042] = "Yaw"
|
||||
Text[0x0043] = "Gain /c/b" -- FC6250HX, AR631
|
||||
Text[0x0043] = "Gain/c/b" -- FC6250HX, AR631
|
||||
Text[0x0045] = "Differential"
|
||||
Text[0x0046] = "Priority"
|
||||
Text[0x0049] = "Output Setup" -- FC6250HX, AR631
|
||||
@ -1454,6 +1472,16 @@ local function DSM_Init_Text(rxId)
|
||||
Text[0x0055] = "Output Channel 5"
|
||||
Text[0x0056] = "Output Channel 6"
|
||||
|
||||
if LCD_W <= 128 then -- Override for smaller screens
|
||||
Text[0x0051] = "Output Ch 1"
|
||||
Text[0x0052] = "Output Ch 2"
|
||||
Text[0x0053] = "Output Ch 3"
|
||||
Text[0x0054] = "Output Ch 4"
|
||||
Text[0x0055] = "Output Ch 5"
|
||||
Text[0x0056] = "Output Ch 6"
|
||||
end
|
||||
|
||||
|
||||
if (rxId ~= RX.FC6250HX) then -- Restrictions for non FC6250HX
|
||||
List_Values[0x0051]=servoOutputValues
|
||||
List_Values[0x0052]=servoOutputValues
|
||||
@ -1508,7 +1536,7 @@ local function DSM_Init_Text(rxId)
|
||||
Text[0x009A] = "Capture Failsafe Positions"
|
||||
Text[0x009C] = "Custom Failsafe"
|
||||
|
||||
Text[0x009F] = "Save Settings " -- Save & Reboot RX
|
||||
Text[0x009F] = "Save Settings" -- Save & Reboot RX
|
||||
|
||||
Text[0x00A5] = "First Time Setup"
|
||||
Text[0x00AA] = "Capture Gyro Gains"
|
||||
@ -1521,7 +1549,7 @@ local function DSM_Init_Text(rxId)
|
||||
|
||||
-- Flight Modes List Options
|
||||
List_Text[0x00B5] = "Inhibit"
|
||||
for i = 1, 10 do List_Text[0x00B5 + i] = "Flight Mode " .. i end
|
||||
for i = 1, 10 do List_Text[0x00B5 + i] = "F Mode " .. i end
|
||||
|
||||
Text[0x00BE] = "Unknown_BE" -- Used in Reset menu (0x0001) while the RX is rebooting
|
||||
|
||||
@ -1530,33 +1558,36 @@ local function DSM_Init_Text(rxId)
|
||||
Text[0x00CA] = "SAFE/Panic Mode Setup"
|
||||
Text[0x00CD] = "Level model and capture attitude/m"; -- Different from List_Text , and force it to be a menu button
|
||||
|
||||
if LCD_W <= 128 then -- Override for small screens
|
||||
Text[0x00CD] = "Level model, cap attitude/m"; -- Different from List_Text , and force it to be a menu button
|
||||
end
|
||||
|
||||
-- RX Orientations for AR631/AR637, Optionally attach an Image + Alt Text to display
|
||||
List_Text[0x00CB] = "Position 1"; List_Text_Img[0x00CB] = "rx_pos_1.png|Pilot View: RX Label Up, Pins Back"
|
||||
List_Text[0x00CC] = "Position 2"; List_Text_Img[0x00CC] = "rx_pos_2.png|Pilot View: RX Label Left, Pins Back"
|
||||
List_Text[0x00CD] = "Position 3"; List_Text_Img[0x00CD] = "rx_pos_3.png|Pilot View: RX Label Down, Pins Back"
|
||||
List_Text[0x00CE] = "Position 4"; List_Text_Img[0x00CE] = "rx_pos_4.png|Pilot View: RX Label Right, Pins Back"
|
||||
List_Text[0x00CF] = "Position 5"; List_Text_Img[0x00CF] = "rx_pos_5.png|Pilot View: RX Label UP, Pins to Front"
|
||||
List_Text[0x00D0] = "Position 6"; List_Text_Img[0x00D0] = "rx_pos_6.png|Pilot View: RX Label Left, Pins Front"
|
||||
List_Text[0x00D1] = "Position 7"; List_Text_Img[0x00D1] = "rx_pos_7.png|Pilot View: RX Label Down, Pins Front"
|
||||
List_Text[0x00D2] = "Position 8"; List_Text_Img[0x00D2] = "rx_pos_8.png|Pilot View: RX Label Right, Pins Front"
|
||||
List_Text[0x00D3] = "Position 9"; List_Text_Img[0x00D3] = "rx_pos_9.png|Pilot View: RX Label Up, Pins Left"
|
||||
List_Text[0x00D4] = "Position 10"; List_Text_Img[0x00D4] = "rx_pos_10.png|Pilot View: RX Label Back, Pins Left"
|
||||
List_Text[0x00D5] = "Position 11"; List_Text_Img[0x00D5] = "rx_pos_11.png|Pilot View: RX Label Down, Pins Left"
|
||||
List_Text[0x00D6] = "Position 12"; List_Text_Img[0x00D6] = "rx_pos_12.png|Pilot View: RX Label Front, Pins Left"
|
||||
List_Text[0x00D7] = "Position 13"; List_Text_Img[0x00D7] = "rx_pos_13.png|Pilot View: RX Label Up, Pins Right"
|
||||
List_Text[0x00D8] = "Position 14"; List_Text_Img[0x00D8] = "rx_pos_14.png|Pilot View: RX Label Back, Pins Right"
|
||||
List_Text[0x00D9] = "Position 15"; List_Text_Img[0x00D9] = "rx_pos_15.png|Pilot View: RX Label Down, Pins Right"
|
||||
List_Text[0x00DA] = "Position 16"; List_Text_Img[0x00DA] = "rx_pos_16.png|Pilot View: RX Label Front, Pins Right"
|
||||
List_Text[0x00DB] = "Position 17"; List_Text_Img[0x00DB] = "rx_pos_17.png|Pilot View: RX Label Back, Pins Down"
|
||||
List_Text[0x00DC] = "Position 18"; List_Text_Img[0x00DC] = "rx_pos_18.png|Pilot View: RX Label Left, Pins Down"
|
||||
List_Text[0x00DD] = "Position 19"; List_Text_Img[0x00DD] = "rx_pos_19.png|Pilot View: RX Label Front, Pins Down"
|
||||
List_Text[0x00DE] = "Position 20"; List_Text_Img[0x00DE] = "rx_pos_20.png|Pilot View: RX Label Right, Pins Down"
|
||||
List_Text[0x00DF] = "Position 21"; List_Text_Img[0x00DF] = "rx_pos_21.png|Pilot View: RX Label Back, Pins Up"
|
||||
List_Text[0x00E0] = "Position 22"; List_Text_Img[0x00E0] = "rx_pos_22.png|Pilot View: RX Label Left, Pins Up"
|
||||
List_Text[0x00E1] = "Position 23"; List_Text_Img[0x00E1] = "rx_pos_23.png|Pilot View: RX Label Front, Pins Up"
|
||||
List_Text[0x00E2] = "Position 24"; List_Text_Img[0x00E2] = "rx_pos_24.png|Pilot View: RX Label Right, Pins Up"
|
||||
List_Text[0x00E3] = "Position Invalid"; List_Text_Img[0x00E3] = "rx_pos_25.png|Cannot detect orientation of RX"
|
||||
List_Text[0x00CB] = "Pos 1"; List_Text_Img[0x00CB] = "rx_pos_1.png|Pilot View: RX Label Up, Pins Back"
|
||||
List_Text[0x00CC] = "Pos 2"; List_Text_Img[0x00CC] = "rx_pos_2.png|Pilot View: RX Label Left, Pins Back"
|
||||
List_Text[0x00CD] = "Pos 3"; List_Text_Img[0x00CD] = "rx_pos_3.png|Pilot View: RX Label Down, Pins Back"
|
||||
List_Text[0x00CE] = "Pos 4"; List_Text_Img[0x00CE] = "rx_pos_4.png|Pilot View: RX Label Right, Pins Back"
|
||||
List_Text[0x00CF] = "Pos 5"; List_Text_Img[0x00CF] = "rx_pos_5.png|Pilot View: RX Label UP, Pins to Front"
|
||||
List_Text[0x00D0] = "Pos 6"; List_Text_Img[0x00D0] = "rx_pos_6.png|Pilot View: RX Label Left, Pins Front"
|
||||
List_Text[0x00D1] = "Pos 7"; List_Text_Img[0x00D1] = "rx_pos_7.png|Pilot View: RX Label Down, Pins Front"
|
||||
List_Text[0x00D2] = "Pos 8"; List_Text_Img[0x00D2] = "rx_pos_8.png|Pilot View: RX Label Right, Pins Front"
|
||||
List_Text[0x00D3] = "Pos 9"; List_Text_Img[0x00D3] = "rx_pos_9.png|Pilot View: RX Label Up, Pins Left"
|
||||
List_Text[0x00D4] = "Pos 10"; List_Text_Img[0x00D4] = "rx_pos_10.png|Pilot View: RX Label Back, Pins Left"
|
||||
List_Text[0x00D5] = "Pos 11"; List_Text_Img[0x00D5] = "rx_pos_11.png|Pilot View: RX Label Down, Pins Left"
|
||||
List_Text[0x00D6] = "Pos 12"; List_Text_Img[0x00D6] = "rx_pos_12.png|Pilot View: RX Label Front, Pins Left"
|
||||
List_Text[0x00D7] = "Pos 13"; List_Text_Img[0x00D7] = "rx_pos_13.png|Pilot View: RX Label Up, Pins Right"
|
||||
List_Text[0x00D8] = "Pos 14"; List_Text_Img[0x00D8] = "rx_pos_14.png|Pilot View: RX Label Back, Pins Right"
|
||||
List_Text[0x00D9] = "Pos 15"; List_Text_Img[0x00D9] = "rx_pos_15.png|Pilot View: RX Label Down, Pins Right"
|
||||
List_Text[0x00DA] = "Pos 16"; List_Text_Img[0x00DA] = "rx_pos_16.png|Pilot View: RX Label Front, Pins Right"
|
||||
List_Text[0x00DB] = "Pos 17"; List_Text_Img[0x00DB] = "rx_pos_17.png|Pilot View: RX Label Back, Pins Down"
|
||||
List_Text[0x00DC] = "Pos 18"; List_Text_Img[0x00DC] = "rx_pos_18.png|Pilot View: RX Label Left, Pins Down"
|
||||
List_Text[0x00DD] = "Pos 19"; List_Text_Img[0x00DD] = "rx_pos_19.png|Pilot View: RX Label Front, Pins Down"
|
||||
List_Text[0x00DE] = "Pos 20"; List_Text_Img[0x00DE] = "rx_pos_20.png|Pilot View: RX Label Right, Pins Down"
|
||||
List_Text[0x00DF] = "Pos 21"; List_Text_Img[0x00DF] = "rx_pos_21.png|Pilot View: RX Label Back, Pins Up"
|
||||
List_Text[0x00E0] = "Pos 22"; List_Text_Img[0x00E0] = "rx_pos_22.png|Pilot View: RX Label Left, Pins Up"
|
||||
List_Text[0x00E1] = "Pos 23"; List_Text_Img[0x00E1] = "rx_pos_23.png|Pilot View: RX Label Front, Pins Up"
|
||||
List_Text[0x00E2] = "Pos 24"; List_Text_Img[0x00E2] = "rx_pos_24.png|Pilot View: RX Label Right, Pins Up"
|
||||
List_Text[0x00E3] = "Pos Invalid"; List_Text_Img[0x00E3] = "rx_pos_25.png|Cannot detect orientation of RX"
|
||||
|
||||
Text[0x00D1] = "Receiver will Reboot/b"
|
||||
--FC6250HX
|
||||
@ -1585,13 +1616,13 @@ local function DSM_Init_Text(rxId)
|
||||
List_Text[0x00F3] = "Adjustable"
|
||||
|
||||
Text[0x00F9] = "Gyro settings"
|
||||
Text[0x00FE] = "Stick Priority/c/b " --SubTitle
|
||||
Text[0x00FE] = "Stick Priority/c/b" --SubTitle
|
||||
|
||||
Text[0x0100] = "Make sure the model has been"
|
||||
Text[0x0101] = "configured, including wing type,"
|
||||
Text[0x0102] = "reversing, travel, trimmed, etc."
|
||||
Text[0x0103] = "before continuing setup."
|
||||
Text[0x0104] = "" -- empty??
|
||||
Text[0x0101] = "configured, including wing"
|
||||
Text[0x0102] = "type, reversing, travel,"
|
||||
Text[0x0103] = "trimmed, etc. before "
|
||||
Text[0x0104] = "continuing setup."
|
||||
Text[0x0105] = "" -- empty??
|
||||
|
||||
Text[0x0106] = "Any wing type, channel assignment,"
|
||||
@ -1626,7 +1657,7 @@ local function DSM_Init_Text(rxId)
|
||||
--Inh, Self-Level/Angle Dem, Envelope -- (L_M was wide open range 0->244)
|
||||
Text[0x01F8] = "Safe Mode"; List_Values[0x01F8]=safeModeOptions
|
||||
|
||||
Text[0x01F9] = "SAFE Select/c/b " -- SubTitle
|
||||
Text[0x01F9] = "SAFE Select/c/b" -- SubTitle
|
||||
Text[0x01FC] = "Panic Flight Mode"
|
||||
Text[0x01FD] = "SAFE Failsafe FMode"
|
||||
Text[0x0208] = "Decay"
|
||||
@ -1656,7 +1687,7 @@ local function DSM_Init_Text(rxId)
|
||||
Text[0x0223] = "and try again."
|
||||
|
||||
Text[0x0224] = "Continue"
|
||||
Text[0x0226] = "Angle Limits/c/b "
|
||||
Text[0x0226] = "Angle Limits/c/b"
|
||||
Text[0x0227] = "Other settings"
|
||||
Text[0x0229] = "Set Orientation Manually"
|
||||
|
||||
@ -1686,6 +1717,7 @@ local function DSM_Init_Text(rxId)
|
||||
Text[0x023D] = "Copy Flight Mode Settings"
|
||||
Text[0x023E] = "Source Flight Mode"
|
||||
Text[0x023F] = "Target Flight Mode"
|
||||
|
||||
Text[0x0240] = "Utilities"
|
||||
|
||||
-- Gain Capture Page
|
||||
|
@ -664,6 +664,7 @@ local function AR631_loadMenu(menuId)
|
||||
ctx.MenuLines[1] = { Type = LINE_TYPE.MENU, TextId = 0x0101, ValId = 0x104F }
|
||||
ctx.MenuLines[2] = { Type = LINE_TYPE.MENU, TextId = 0x0102, ValId = 0x104F }
|
||||
ctx.MenuLines[3] = { Type = LINE_TYPE.MENU, TextId = 0x0103, ValId = 0x104F }
|
||||
ctx.MenuLines[4] = { Type = LINE_TYPE.MENU, TextId = 0x0104, ValId = 0x104F }
|
||||
ctx.SelLine = dsmLib.NEXT_BUTTON
|
||||
lastGoodMenu = menuId
|
||||
elseif (menuId==0x1050) then
|
||||
@ -679,6 +680,7 @@ local function AR631_loadMenu(menuId)
|
||||
ctx.MenuLines[1] = { Type = LINE_TYPE.MENU, TextId = 0x0107, ValId = 0x1050 }
|
||||
ctx.MenuLines[2] = { Type = LINE_TYPE.MENU, TextId = 0x0108, ValId = 0x1050 }
|
||||
ctx.MenuLines[3] = { Type = LINE_TYPE.MENU, TextId = 0x0109, ValId = 0x1050 }
|
||||
ctx.MenuLines[4] = { Type = LINE_TYPE.MENU, TextId = 0x010A, ValId = 0x1050 }
|
||||
ctx.SelLine = dsmLib.NEXT_BUTTON
|
||||
lastGoodMenu = menuId
|
||||
elseif (menuId==0x1051) then
|
||||
|
@ -24,7 +24,7 @@
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
local DEBUG_ON, SIMULATION_ON = ... -- Get DebugON from parameters
|
||||
local SETUP_LIB_VERSION = "0.52"
|
||||
local SETUP_LIB_VERSION = "0.53"
|
||||
|
||||
local DATA_PATH = "/MODELS/DSMDATA" -- Path to store model settings files
|
||||
local dsmLib = assert(loadScript("/SCRIPTS/TOOLS/DSMLIB/DsmFwPrgLib.lua"))(DEBUG_ON)
|
||||
@ -698,7 +698,7 @@ local function ST_LoadMenu(menuId)
|
||||
|
||||
if (menuDataChanged) then
|
||||
ctx.MenuLines[4] = { Type = LINE_TYPE.MENU, Text="Save Changes", TextId = 0, ValId = 0x1005 }
|
||||
ctx.MenuLines[5] = { Type = LINE_TYPE.MENU, Text="Discart Changes", TextId = 0, ValId = 0x1006 }
|
||||
ctx.MenuLines[5] = { Type = LINE_TYPE.MENU, Text="Discard Changes", TextId = 0, ValId = 0x1006 }
|
||||
ctx.SelLine = 4
|
||||
else
|
||||
if (SIMULATION_ON) then
|
||||
@ -841,7 +841,8 @@ local function ST_LoadMenu(menuId)
|
||||
ctx.MenuLines[3] = { Type = LINE_TYPE.LIST_MENU_NC, Text=MODEL.PORT_TEXT[PORT.PORT4], TextId = 0, ValId = MEMU_VAR.PORT4_MODE, Min=300, Max=301, Def=300, Val=MENU_DATA[MEMU_VAR.PORT4_MODE], Format = formatTXRevert(PORT.PORT4) }
|
||||
ctx.MenuLines[4] = { Type = LINE_TYPE.LIST_MENU_NC, Text=MODEL.PORT_TEXT[PORT.PORT5], TextId = 0, ValId = MEMU_VAR.PORT5_MODE, Min=300, Max=301, Def=300, Val=MENU_DATA[MEMU_VAR.PORT5_MODE], Format = formatTXRevert(PORT.PORT5) }
|
||||
|
||||
ctx.MenuLines[6] = { Type = LINE_TYPE.MENU, Text=" Usually Rud/Ail needs to be the oposite of the TX", TextId = 0, ValId = 0x1030 }
|
||||
ctx.MenuLines[5] = { Type = LINE_TYPE.MENU, Text="Only Thr/Ail/Rud/Ele. This affects AS3X/SAFE reaction dir./b", TextId = 0, ValId = 0x1030 }
|
||||
ctx.MenuLines[6] = { Type = LINE_TYPE.MENU, Text="Any changes, use RX 'Relearn Servo Settings'/b", TextId = 0, ValId = 0x1030 }
|
||||
|
||||
ctx.SelLine = 0
|
||||
lastGoodMenu = menuId
|
||||
@ -854,7 +855,8 @@ local function ST_LoadMenu(menuId)
|
||||
ctx.MenuLines[3] = { Type = LINE_TYPE.LIST_MENU_NC, Text=MODEL.PORT_TEXT[PORT.PORT9], TextId = 0, ValId = MEMU_VAR.PORT9_MODE, Min=300, Max=301, Def=300, Val=MENU_DATA[MEMU_VAR.PORT9_MODE], Format = formatTXRevert(PORT.PORT9) }
|
||||
ctx.MenuLines[4] = { Type = LINE_TYPE.LIST_MENU_NC, Text=MODEL.PORT_TEXT[PORT.PORT10], TextId = 0, ValId = MEMU_VAR.PORT10_MODE, Min=300, Max=301, Def=300, Val=MENU_DATA[MEMU_VAR.PORT10_MODE], Format = formatTXRevert(PORT.PORT10) }
|
||||
|
||||
ctx.MenuLines[6] = { Type = LINE_TYPE.MENU, Text=" Usually Rud/Ail needs to be the oposite of the TX", TextId = 0, ValId = 0x1031 }
|
||||
ctx.MenuLines[5] = { Type = LINE_TYPE.MENU, Text="Only Thr/Ail/Rud/Ele. This affects AS3X/SAFE reaction dir./b", TextId = 0, ValId = 0x1031 }
|
||||
ctx.MenuLines[6] = { Type = LINE_TYPE.MENU, Text="Any changes, use RX 'Relearn Servo Settings'/b", TextId = 0, ValId = 0x1031 }
|
||||
|
||||
ctx.SelLine = 0
|
||||
lastGoodMenu = menuId
|
||||
|
@ -2,72 +2,96 @@
|
||||
Code is based on the code/work by: Pascal Langer (Author of the Multi-Module)
|
||||
Rewrite/Enhancements by: Francisco Arzu
|
||||
|
||||
Thanks to many other people who volunteer to test it.
|
||||
Thanks to all the people volunteered to test it.
|
||||
|
||||
# Introduction (v0.52)
|
||||
# Introduction (v0.53)
|
||||
|
||||
This script library enhace the original DSM Forward Programming tool. DSM Forward Programming is needed to setup many of
|
||||
the new Spektrum Receivers with Gyro AS3X/SAFE features. For the Gyro (/Safe) to correct the plane in flight, it needs to move the right surfaces, the RX needs to know the
|
||||
configuration of the plane (Wing Type, Tail Type, Mixers, Servo Assigments, Servo Reverse). That info tells the RX where the aileron(s) are (one of two), where the elevator(s) are (one or two), V-Tail, Delta Wing, etc.
|
||||
This script library enhances the original DSM Forward Programming tool. DSM Forward Programming is needed to setup many of the new Spektrum Receivers with Gyro AS3X/SAFE features. For the Gyro (/Safe) to correct the plane in flight, it needs to move the right surfaces therefore the RX needs to know the configuration of the plane (Wing Type, Tail Type, Mixers, Servo Assignments, Servo Reverse). That info tells the RX where the aileron(s) are (one or two), where the elevator(s) are (one or two), V-Tail, Delta Wing, etc.
|
||||
|
||||
Since EdgeTx/OpenTx don't have equivalent setup that is persisted/stored in the radio, we had to create our own version. This info is stored inside the `/MODELS/DSMDATA` directory/folder (needs to be created by hand).
|
||||
Since EdgeTx/OpenTx doesn’t have an equivalent setup that is stored in the radio, we have to create our own version. This info is stored inside the `/MODELS/DSMDATA` directory/folder (which needs to be created by manually).
|
||||
|
||||
During `"Gyro Settings->initial setup"`, the RX asks the TX for model information behind the scenes. After setup, `"Gyro Settings->System Tools-> Relearn Servo Settings"` request the TX configuration and store it in the RX.
|
||||
During `"Gyro Settings->initial setup"`, the RX asks the TX for model information behind the scenes. After setup, `"Gyro Settings->System Tools-> Relearn Servo Settings"` requests the TX configuration and stores it in the RX.
|
||||
|
||||
# Deployment
|
||||
Make sure to manually create `/MODELS/DSMDATA` . The script will complain at startup.
|
||||
|
||||
/SCRIPTS/TOOLS/DsmFwdPrg_05_BW.lua -- black/white text only radios
|
||||
/SCRIPTS/TOOLS/DsmFwdPrg_05_Color.lua -- Color+touch radios
|
||||
/SCRIPTS/TOOLS/DsmFwdPrg_05_Color.lua -- Color and touch radios
|
||||
/SCRIPTS/TOOLS/DSMLIB/ -- (ALL CAPITALS) Libraries ane extra files
|
||||
/SCRIPTS/TOOLS/DSMLIB/DsmFwPrgLib.lua -- DSM Protocol Message and Menu engine
|
||||
/SCRIPTS/TOOLS/DSMLIB/DsmFwPrgLib.lua -- DSM Protocol Message and Menu engine
|
||||
/SCRIPTS/TOOLS/DSMLIB/DsmFwPrgSIMLib.lua -- Simulation of AR631, FC6250HX
|
||||
/SCRIPTS/TOOLS/DSMLIB/SetupLib.lua -- Model Setup Screns
|
||||
/SCRIPTS/TOOLS/DSMLIB/SetupLib.lua -- Model Setup Screens
|
||||
/SCRIPTS/TOOLS/DSMLIB/img --Images for RX orientations
|
||||
|
||||
Other Directories
|
||||
|
||||
/MODELS/DSMDATA --(ALL CAPITALS) Data of model config (Wing Type, Servo Assigments)
|
||||
/LOGS/dsm_log.txt --Readable log of the last RX/TX session, usefull for debuging problems
|
||||
/MODELS/DSMDATA --(ALL CAPITALS) Data of model config (Wing Type, Servo Assignments)
|
||||
/LOGS/dsm_log.txt --Readable log of the last RX/TX session, usefull for debugging problems
|
||||
|
||||
When upgrading from a previous version of this tool, delete your /SCRIPTS/TOOLS/DSMLIB before copying the new one (if you customized your images, inside "DSMLIB/img" do a backup first)
|
||||
When upgrading from a previous version of this tool, delete your /SCRIPTS/TOOLS/DSMLIB before copying the new one (if you customized your images, inside "DSMLIB/img" do a backup first)
|
||||
|
||||
# Common Questions
|
||||
1. `RX not accepting channels greater Ch6 for Flight-mode o Gains:` The RX corrects your channel to ch5 or ch6. This means that the RX is not detecting the upper channles from the TX. You need to exersise (move the switch) so that the RX detects it. Put the Channel Field on edit (changing) mode, change it to Ch7 (or any other), flip the switch for Ch7 3 times, now confim the edit. The RX now will not reject it. All Spektrum RX are 20 channels internally, even if it only have 6 external Ch/Ports to connect servos.
|
||||
1. `RX not accepting channels higher than Ch6 for Flight-mode o Gains:`
|
||||
V0.53 improve this.. you can select any channel now. Additionally, if you already mapped the Switch to the channel, togling once the switch will select the channel on the menu field.
|
||||
<s>V0.52 and prior: The RX corrects your channel to ch5 or ch6. This means that the RX is not
|
||||
detecting the upper channels from the TX. You need to exercise (move the switch) so that the RX detects it. Put the Channel Field on edit (changing) mode, change it to Ch7 (or any other), flip the switch for Ch7 3 times, now confirm the edit. The RX now will not reject it. All Spektrum RX are 20 channels internally, even if it only has 6 external Ch/Ports to connect servos. </s>
|
||||
|
||||
2. `Why Ch1 says Ch1 (TX:Ch3/Thr)?`:
|
||||
Radios with Multi-Module are usually configured to work the standard AETR convention. Spektrum uses TAER. The multi-module does the conversion when transmiting the signals. So `Spektrum Ch1 (Throttle)` really comes from the `TX Ch3`. We show both information (+name from the TX output). If your multi-module/radio is setup as TAER, the script will not do the re-arrangement.
|
||||
Radios with Multi-Module are usually configured to work the standard AETR convention. Spektrum uses TAER. The multi-module does the conversion when transmitting the signals. So `Spektrum Ch1 (Throttle)` really comes from the `TX Ch3`. We show both information (+name from the TX output). If your multi-module/radio is setup as TAER, the script will not do the re-arrangement.
|
||||
|
||||
3. `If i change the model name, the original model settings are lost.` This is correct, the model name is used to generate the file name (inside /MODEL/DSMDATA) who stores the model configuration. Currently EdgeTx and OpenTX has differt features where i could get either the Model Name or the YAML file where the EdgeTX model configuration is stored.. to keep the code compatible, the model name is used.
|
||||
|
||||
4. `Reversing a channel in my TX do not reverse the AS3X/SAFE reaction.` Correct, the chanel stick direction and the Gyro direction are two separate things.
|
||||
|
||||
4.1: First, you have setup your model so that the sticks and switches moves the surfaces in the right direction.
|
||||
|
||||
4.2: Go to the script, `Model Setup` and setup your wing type, tail type, and select the channel assigment for each surface. Leave the servo settings the same as the values in the TX to start.
|
||||
|
||||
4.3: AR63X family: Go to `Forward programming->Gyro Setting->Initial Setup` (New/factory reset), or `Forward programming->Gyro Setting->System Setup->Relearn Servo Settings` (not new). This will load your urrent Gyro servo settings into the plane's RX.
|
||||
|
||||
4.4: Verify that the AS3X and SAFE reacts in the proper direction. You can use the Flight mode confugured as "Safe Mode: Auto-Level" to see if it moves the surfaces in the right direction.
|
||||
|
||||
4.5: If a surface don't move in the right direction, go to the `Model Setup->Gyro Channel Reverse` to reverse the Gyro on the channels needed, and do again the `Forward programming->Gyro Setting->System Setup->Relearn Servo Settings` to tranfer the new settings to the RX.
|
||||
|
||||
4.6: Specktrum TX always passes the TX servo reverse as the Gyro Reverse, but on many OpenTX/EdgeTX radios, the Rud/Ail are usually reversed by default compared to Specktrum. So far i don't think that i can use this as a rule, that is why the `Gyro Channel Reverse` page exist.
|
||||
|
||||
|
||||
|
||||
---
|
||||
---
|
||||
|
||||
# Changes and fixes
|
||||
V0.53:
|
||||
1. Improved channel selection (Flight mode, Panic Channel, Gains Channel). Now during editing a channel, you can select any channel (>Ch4). Also, of you toggle the switch/channel it will populate the screen.
|
||||
2. Support for smaller screens (128x64) in B&W. The problem with this older radios is memory. In some, it does not have enouth memory to load the additional DSMLIB libraries.
|
||||
3. Fix formatting problem with some TX channel names who could affect the screen.. for example, rud channel should show "Ch4/rud", but shows "Ch4ud" because /r is for right justify formatting on messages. Now the formatting is only if it appears at the end of the message.
|
||||
|
||||
V0.52:
|
||||
1. Menus to be able to configure Plane in a similar way as Spektrum Radio (v0.52)
|
||||
1. Make "Gyro Settings"->"Initial Setup" works (Tested on AR631,AR637xx with PLANE type of arcraft)
|
||||
2. Properly reset and restart after initial configuration and SAFE changes.
|
||||
3. Write Log of the conversation between RX/TX. To be use for debugging when some reports a problem.
|
||||
4. Provide a simulation of RX to do GUI development in Companion, and undestand patterns of how the data is organized.
|
||||
2. Make "Gyro Settings"->"Initial Setup" works (Tested on AR631,AR637xx with PLANE type of aircraft)
|
||||
3. Properly reset and restart after initial configuration and SAFE changes.
|
||||
4. Write Log of the conversation between RX/TX. To be used for debugging a problem is reported.
|
||||
5. Provide a simulation of RX to do GUI development in Companion, and understand patterns of how the data is organized.
|
||||
|
||||
# Tested RXs
|
||||
- AR631/AR637xx
|
||||
- FC6250HX (Blade 230S V2 Helicopter)
|
||||
- AR636 (Blade 230S V1 Heli firmaware 4.40)
|
||||
- AR636 (Blade 230S V1 Heli firmware 4.40)
|
||||
|
||||
Please report of you have test it with other receivers to update the documentation. Code should work up to 10 channels for the main surfaces (Ail/Ele/etc). All Spektrum RX are internally 20 channels, so you can use Ch7 for Flight Mode even if your RX is only 6 channels (See common Questions)
|
||||
Please report if you have tested it with other receivers to allow us to update the documentation. Code should work up to 10 channels for the main surfaces (Ail/Ele/etc). All Spektrum RX are internally 20 channels, so you can use Ch7 for Flight Mode even if your RX is only 6 channels (See common Questions)
|
||||
|
||||
# Flight mode/Gain channels
|
||||
|
||||
I ran into a case where trying to set Aux2 or Aux3 for flight mode, but the RX was correcting it to Aux1.. the RX only was allowing Gear or Aux1 (AR631/AR637).
|
||||
This is because the RX don't know that we are using more than 6 channels. To make the RX aware that there are other channels, while edditing the channel, you have to toggle the switch to excersist the channel (3 times), and now the RX will recognize it.
|
||||
|
||||
Fixed in version 0.53. no longer a tick to select it.
|
||||
<s>I ran into a case where trying to set Aux2 or Aux3 for flight mode, but the RX was correcting it to Aux1.. the RX only was allowing Gear or Aux1 (AR631/AR637).
|
||||
This is because the RX doesn’t know that we are using more than 6 channels. To make the RX aware that there are other channels, while editing the channel, you have to toggle the switch to exercise the channel (3 times), and now the RX will recognize it.</s>
|
||||
|
||||
|
||||
# Messages Displayed in the GUI
|
||||
|
||||
If in a screen you get text that looks like `Unknown_XX` (ex: Unknown_D3), that message has not been setup in the script in english. If you can get what is the proper message, you can send us a message to be added to the library.
|
||||
If in a screen you get text that looks like `Unknown_XX` (ex: Unknown_D3), that message has not been setup in the script in english. If you can determine what the proper message is, you can send us a message to be added to the library.
|
||||
The `XX` represents a Hex Number (0..9,A..F) message ID.
|
||||
|
||||
If you want to fix it in your local copy, all messages are towards the end in the file `SCRIPT\TOOS\DSMLIB\DsmFwPrgLib.lua`. Messages for Haders are stored in `Text` and messages for Options are stored in `List_Text`. Lua scripts are text files, and can be editted with Notepad or equivalent.
|
||||
If you want to fix it in your local copy, all messages are towards the end in the file `SCRIPT\TOOS\DSMLIB\DsmFwPrgLib.lua`. Messages for Headers are stored in `Text` and messages for Options are stored in `List_Text`. Lua scripts are text files, and can be edited with Notepad or equivalent.
|
||||
|
||||
Portion of DsmFwPrgLib.lua:
|
||||
|
||||
@ -83,7 +107,7 @@ Portion of DsmFwPrgLib.lua:
|
||||
Text[0x00AA] = "Capture Gyro Gains"
|
||||
Text[0x00AD] = "Gain Channel Select"
|
||||
|
||||
-- Safe mode options, Ihnibit + thi values
|
||||
-- Safe mode options, Inhibit + the values
|
||||
local safeModeOptions = {0x0003,0x00B0,0x00B1} -- inh (gap), "Self-Level/Angle Dem, Envelope
|
||||
List_Text[0x00B0] = "Self-Level/Angle Dem"
|
||||
List_Text[0x00B1] = "Envelope"
|
||||
@ -100,9 +124,9 @@ For example, if you get `Unknown_9D` in the GUI and your now that it should say
|
||||
|
||||
# LOG File
|
||||
|
||||
The log file of the last use of the script is located at `/LOGS/dsm_log.txt`. **It is overriden on every start to avoid filling up the SD card**. So if you want to keep it, copy or rename it before starting the script again. (can be renamed in the TX by browsing the SD card)
|
||||
The log file of the last use of the script is located at `/LOGS/dsm_log.txt`. **It is overridden on every start to avoid filling up the SD card**. So if you want to keep it, copy or rename it before starting the script again. (it can be renamed in the TX by browsing the SD card)
|
||||
|
||||
The log is human readable. The first number is the number of seconds since the start, and then what is the current state of the Library, and what is been sent and received. The info in the log can be easilly used to create a new simulation for that RX in the future.
|
||||
The log is human readable. The first number is the number of seconds since the start, and then what is the current state of the Library, and what has been sent and received. The info in the log can be easily used to create a new simulation for that RX in the future.
|
||||
|
||||
Example Log:
|
||||
|
||||
@ -119,7 +143,7 @@ Example Log:
|
||||
5.970 MENU_LINES: RESPONSE MenuLine: L[#3 T=M VId=0x1022 Text="System Setup"[0x86] MId=0x1010 ]
|
||||
6.020 MENU_LINES: SEND DSM_getNextLine(MenuId=0x1010,LastLine=3
|
||||
|
||||
Exmple of the Unknown_0x05 Lines correctly processed (receiving lines 0..5):
|
||||
Example of the Unknown_0x05 Lines correctly processed (receiving lines 0..5):
|
||||
|
||||
0.130 MENU_TITLE: SEND DSM_getMainMenu()
|
||||
0.230 MENU_TITLE: RESPONSE Menu: M[Id=0x1000 P=0x0 N=0x0 B=0x0 Text="Main Menu"[0x4B]]
|
||||
@ -134,7 +158,7 @@ Exmple of the Unknown_0x05 Lines correctly processed (receiving lines 0..5):
|
||||
|
||||
# Validation of data by the RX
|
||||
|
||||
When you change a value in the GUI, the RX validates that the value is valid.
|
||||
<s>When you change a value in the GUI, the RX validates that the value is valid.
|
||||
For example, I ran into a case where trying to set Aux2 or Aux3 for flight mode, but the RX was correcting it back to Aux1.. the RX only was allowing Gear or Aux1 (AR631/AR637).. in this case, toggle the Switch while editing it on the screen.
|
||||
|
||||
If you go to the logs, you can see that the RX was correcting the value:
|
||||
@ -142,33 +166,37 @@ If you go to the logs, you can see that the RX was correcting the value:
|
||||
20.520 VALUE_CHANGE_END: SEND DSM_updateMenuValue(ValueId=0x1000,val=7) Extra: Text="FM Channel" Value=7|"Aux2"
|
||||
20.570 VALUE_CHANGE_END: SEND DSM_validateMenuValue(ValueId=0x1000) Extra: Text="FM Channel" Value=7|"Aux2"
|
||||
20.680 VALUE_CHANGE_END: RESPONSE MenuValue: UPDATED: L[#0 T=L_m1 VId=0x1000 Text="FM Channel"[0x78] Val=6|"Aux1" NL=(0->32,0,S=53) [53->85,53] MId=0x7CA6 ]
|
||||
|
||||
</s>
|
||||
|
||||
---
|
||||
# Version 0.53
|
||||
- Improve Channel selection in menus
|
||||
- Support smaller screens 128x64 in the black/white mode.
|
||||
|
||||
# Version 0.52
|
||||
- Fix Reversing of Servos
|
||||
- Properly detect Moltimodule Ch settings AETR
|
||||
- Properly detect Multimodule Ch settings AETR
|
||||
---
|
||||
|
||||
# Version 0.51 (voluteer testing version, not for production)
|
||||
# Version 0.51 (volunteer testing version, not for production)
|
||||
- New Screens to Configure Model (Wing Type/Tail Tail, etc)
|
||||
- Finally got understanding that the previous unknown 0x05 lines are to send Model/Servo data to RX.
|
||||
- Fix use of AR636B (Firmare version 4.40.0 for Blade 230 heli, is the only one with Forward Programing)
|
||||
- Fix use of AR636B (Firmware version 4.40.0 for Blade 230 heli, is the only one with Forward Programming)
|
||||
- Aircraft types: Tested With Plane type only.. Glider and other in progress
|
||||
|
||||
### Know Problems:
|
||||
### Known Problems:
|
||||
- 4-Servo Wing type (Dual Ail/Tail) in planes give conflicting servo assignments by defaults.. Solution choose your own Ch.
|
||||
- Glider, Heli, Drong: Still in development. In glider, only a few wing type works.. needs to restrict menu options for the only valid one.
|
||||
- Glider, Heli, Drone: Still in development. In glider, only a few wing type works.. needs to restrict menu options for the only valid one.
|
||||
|
||||
|
||||
# Version 0.5
|
||||
|
||||
- Make the code more readable and understadable
|
||||
- Separate the DSM Forwards Programing logic from the GUI
|
||||
- Log the comunnication with the RX on a /LOGS/dsm_log.txt to allow to debug it easier
|
||||
- Make the code more readable and understandable
|
||||
- Separate the DSM Forwards Programming logic from the GUI
|
||||
- Log the communication with the RX on a /LOGS/dsm_log.txt to allow to debug it easier
|
||||
and see the exchange of data between the RX/TX
|
||||
- Created a black/white Text only version with only Key/Roller Inputs
|
||||
- Created a nicer GUI for EdgeTX touchscreen color Radios
|
||||
- Created a nicer GUI for EdgeTX touch screen color Radios
|
||||
- RX simulation for GUI development: turn on `SIMULATION_ON=true` in the beginning of the lua file
|
||||
- Test it on AR631, AR637xx, FC6250HX (Helicopter)
|
||||
|
||||
@ -192,4 +220,3 @@ For Helicopter, use airplane normal wing and normal tail
|
||||
# Version 0.2
|
||||
Original Version from Pascal Langer
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user