mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-04 16:48:10 +00:00
V0.54 Enhacements (#846)
* #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 * Create DSM_AR636_TextGen.lua Script to show Telemetry TextGen screens for AR636 Receiver. Really useful for BLADE helis using the AR636 Could replace dsmPID.lua Still needs to be ported to smaller screens. * #751 Enhancements for Lua Script tools Enhancements * Delete DSM_AR636_TextGen.lua The TextGen functionality is included in DSM_AR636_Tel.lua. No longer needed * Version 0.54 1. Fix problem with "Attitude Trim" Menu 2. New "MINimalistic" version for radios with very low memory 3. Externalized menu messages shared by all versions. the idea is to allow to translate it into other languages. 4. Correction of TextGen tools to work on black&white radios (some Lua functional differences). TextGen will be working on EdgeTx 2,8.3 --------- Co-authored-by: pascallanger <pascal_langer@yahoo.fr>
This commit is contained in:
parent
89023d4b55
commit
b2f8f482bb
@ -1,5 +1,5 @@
|
||||
local toolName = "TNS|DSM Forward Prog v0.53 (Text B&W) |TNE"
|
||||
local VERSION = "v0.53"
|
||||
local toolName = "TNS|DSM Forward Prog v0.54 (Text B&W) |TNE"
|
||||
local VERSION = "v0.54"
|
||||
|
||||
|
||||
---- #########################################################################
|
||||
@ -28,7 +28,7 @@ local VERSION = "v0.53"
|
||||
-- Rewrite/Enhancements By: Francisco Arzu
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
local SIMULATION_ON = false -- FALSE: use real communication to DSM RX (DEFAULT), TRUE: use a simulated version of RX
|
||||
local SIMULATION_ON = false -- FALSE: don't show simulation menu (DEFAULT), TRUE: show simulation menu
|
||||
local DEBUG_ON = 1 -- 0=NO DEBUG, 1=HIGH LEVEL 2=LOW LEVEL (Debug logged into the /LOGS/dsm.log)
|
||||
local DEBUG_ON_LCD = false -- Interactive Information on LCD of Menu data from RX
|
||||
|
||||
@ -269,9 +269,9 @@ local function GUI_Display()
|
||||
--Draw RX Menu
|
||||
if ctx.Phase == PHASE.RX_VERSION then
|
||||
if (ctx.isReset) then
|
||||
lcd.drawText(LCD_X_LINE_TITLE,50,"Waiting for RX to Restart", BLINK + TEXT_SIZE)
|
||||
lcd.drawText(LCD_X_LINE_TITLE,50,dsmLib.Get_Text(0x301), BLINK + TEXT_SIZE) -- Resetting
|
||||
else
|
||||
lcd.drawText(LCD_X_LINE_TITLE,50,"No compatible DSM RX...", BLINK + TEXT_SIZE)
|
||||
lcd.drawText(LCD_X_LINE_TITLE,50,dsmLib.Get_Text(0x300), BLINK + TEXT_SIZE) -- Waiting for RX Version
|
||||
end
|
||||
else
|
||||
local menu = ctx.Menu
|
||||
@ -390,11 +390,11 @@ local function GUI_HandleEvent(event, touchState)
|
||||
ctx.Refresh_Display=true
|
||||
if (DEBUG_ON) then dsmLib.LOG_write("%s: EVT_VIRTUAL_ENTER\n",dsmLib.phase2String(ctx.Phase)) end
|
||||
if ctx.SelLine == dsmLib.BACK_BUTTON then -- Back
|
||||
dsmLib.GotoMenu(menu.BackId,0)
|
||||
dsmLib.GotoMenu(menu.BackId,0x80)
|
||||
elseif ctx.SelLine == dsmLib.NEXT_BUTTON then -- Next
|
||||
dsmLib.GotoMenu(menu.NextId,0)
|
||||
dsmLib.GotoMenu(menu.NextId,0x82)
|
||||
elseif ctx.SelLine == dsmLib.PREV_BUTTON then -- Prev
|
||||
dsmLib.GotoMenu(menu.PrevId,0)
|
||||
dsmLib.GotoMenu(menu.PrevId,0x81)
|
||||
elseif menuLines[ctx.SelLine].ValId ~= 0 then
|
||||
if menuLines[ctx.SelLine].Type == LINE_TYPE.MENU then -- Next menu exist
|
||||
if (menuLines[ctx.SelLine].ValId==0xFFF1) then
|
||||
|
@ -1,5 +1,5 @@
|
||||
local toolName = "TNS|DSM Forward Prog v0.53 (Color+Touch) |TNE"
|
||||
local VERSION = "v0.53"
|
||||
local toolName = "TNS|DSM Forward Prog v0.54 (Color+Touch) |TNE"
|
||||
local VERSION = "v0.54"
|
||||
|
||||
---- #########################################################################
|
||||
---- # #
|
||||
@ -27,7 +27,7 @@ local VERSION = "v0.53"
|
||||
-- Rewrite/Enhancements By: Francisco Arzu
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
local SIMULATION_ON = false -- FALSE: use real communication to DSM RX (DEFAULT), TRUE: use a simulated version of RX
|
||||
local SIMULATION_ON = false -- FALSE:don't show simulation memu (DEFAULT), TRUE: show simulation menu
|
||||
local DEBUG_ON = 1 -- 0=NO DEBUG, 1=HIGH LEVEL 2=LOW LEVEL (Debug logged into the /LOGS/dsm.log)
|
||||
local DEBUG_ON_LCD = false -- Interactive Information on LCD of Menu data from RX
|
||||
local USE_SPECKTRUM_COLORS = true -- true: Use spectrum colors, false: use theme colors (default on OpenTX)
|
||||
@ -385,9 +385,9 @@ local function GUI_Display()
|
||||
--Draw RX Menu
|
||||
if ctx.Phase == PHASE.RX_VERSION then
|
||||
if (ctx.isReset) then
|
||||
lcd.drawText(LCD_X_LINE_TITLE,100,"Waiting for RX to Restart", BLINK)
|
||||
lcd.drawText(LCD_X_LINE_TITLE,100,dsmLib.Get_Text(0x301), BLINK) -- Waiting for Restart
|
||||
else
|
||||
lcd.drawText(LCD_X_LINE_TITLE,100,"No compatible DSM RX...", BLINK)
|
||||
lcd.drawText(LCD_X_LINE_TITLE,100,dsmLib.Get_Text(0x300), BLINK) -- Waiting for RX
|
||||
end
|
||||
else
|
||||
local menu = ctx.Menu
|
||||
@ -567,11 +567,11 @@ local function GUI_HandleEvent(event, touchState)
|
||||
ctx.Refresh_Display=true
|
||||
if (DEBUG_ON) then dsmLib.LOG_write("%s: EVT_VIRTUAL_ENTER, SelLine=%d\n",dsmLib.phase2String(ctx.Phase), ctx.SelLine) end
|
||||
if ctx.SelLine == dsmLib.BACK_BUTTON then -- Back
|
||||
dsmLib.GotoMenu(menu.BackId,0)
|
||||
dsmLib.GotoMenu(menu.BackId,0x80)
|
||||
elseif ctx.SelLine == dsmLib.NEXT_BUTTON then -- Next
|
||||
dsmLib.GotoMenu(menu.NextId,0)
|
||||
dsmLib.GotoMenu(menu.NextId,0x82)
|
||||
elseif ctx.SelLine == dsmLib.PREV_BUTTON then -- Prev
|
||||
dsmLib.GotoMenu(menu.PrevId,0)
|
||||
dsmLib.GotoMenu(menu.PrevId,0x81)
|
||||
elseif menuLines[ctx.SelLine].ValId ~= 0 then -- Menu or Value
|
||||
|
||||
if menuLines[ctx.SelLine].Type == LINE_TYPE.MENU then -- Navigate to Menu
|
||||
|
932
Lua_scripts/DSM FwdPrg_05_MIN.lua
Normal file
932
Lua_scripts/DSM FwdPrg_05_MIN.lua
Normal file
@ -0,0 +1,932 @@
|
||||
local toolName = "TNS|DSM Frwd Prog v0.54-beta (MIN)|TNE"
|
||||
|
||||
--local ModelParam = ...
|
||||
|
||||
---- #########################################################################
|
||||
---- # #
|
||||
---- # Copyright (C) OpenTX #
|
||||
-----# #
|
||||
---- # License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html #
|
||||
---- # #
|
||||
---- # This program is free software; you can redistribute it and/or modify #
|
||||
---- # it under the terms of the GNU General Public License version 2 as #
|
||||
---- # published by the Free Software Foundation. #
|
||||
---- # #
|
||||
---- # This program is distributed in the hope that it will be useful #
|
||||
---- # but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||
---- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||
---- # GNU General Public License for more details. #
|
||||
---- # #
|
||||
---- #########################################################################
|
||||
|
||||
|
||||
--###############################################################################
|
||||
-- Multi buffer for DSM description
|
||||
-- Multi_Buffer[0..2]=="DSM" -> Lua script is running
|
||||
-- Multi_Buffer[3]==0x70+len -> TX to RX data ready to be sent
|
||||
-- Multi_Buffer[4..9]=6 bytes of TX to RX data
|
||||
-- Multi_Buffer[10..25]=16 bytes of RX to TX data
|
||||
--
|
||||
-- To start operation:
|
||||
-- Write 0x00 at address 3
|
||||
-- Write 0x00 at address 10
|
||||
-- Write "DSM" at address 0..2
|
||||
--###############################################################################
|
||||
|
||||
local VERSION = "v0.54-MIN"
|
||||
local LANGUAGE = "en"
|
||||
local DSMLIB_PATH = "/SCRIPTS/TOOLS/DSMLIB/"
|
||||
|
||||
local LOG_FILE = "/LOGS/dsm_min_log.txt"
|
||||
local MSG_FILE = DSMLIB_PATH.."msg_fwdp_" .. LANGUAGE .. ".txt"
|
||||
local MSG_FILE_MIN = DSMLIB_PATH.."MIN_msg_fwdp_" .. LANGUAGE .. ".txt"
|
||||
|
||||
-- Phase
|
||||
local PH_RX_VER, PH_TITLE, PH_TX_INFO, PH_LINES, PH_VALUES = 1, 2, 3, 4, 5
|
||||
local PH_VAL_CHANGING, PH_VAL_WAIT, PH_VAL_CHNG_END = 6, 7, 8
|
||||
local PH_WAIT_CMD, PH_EXIT_REQ, PH_EXIT_DONE = 9, 10, 11
|
||||
|
||||
-- Line Types
|
||||
local LT_MENU = 0x1C
|
||||
local LT_LIST, LT_LIST_VALIDATE, LT_LIST_TOG = 0x6C, 0x0C, 0x4C
|
||||
local LT_VALUE_NOCHANGING = 0x60
|
||||
local LT_VALUE_PERCENT, LT_VALUE_DEGREES = 0xC0, 0xE0
|
||||
|
||||
local Phase = PH_RX_VER
|
||||
local Waiting_RX = 0
|
||||
|
||||
local Text = {}
|
||||
local List_Text = {}
|
||||
local List_Text_Img = {}
|
||||
local Flight_Mode = { [0] = "Flight Mode" }
|
||||
local RxName = {}
|
||||
|
||||
local InactivityTime = 0
|
||||
local Value_Change_Step = 0
|
||||
local TX_Info_Step = 0
|
||||
local TX_Info_Type = 0
|
||||
local originalValue = 0
|
||||
|
||||
local ctx = {
|
||||
SelLine = 0, -- Current Selected Line
|
||||
EditLine = nil, -- Current Editing Line
|
||||
CurLine = -1, -- Current Line Requested/Parsed via h message protocol
|
||||
isReset = false -- false when starting from scracts, true when starting from Reset
|
||||
}
|
||||
|
||||
local MODEL = {
|
||||
modelName = "", -- The name of the model comming from OTX/ETX
|
||||
modelOutputChannel = {}, -- Output information from OTX/ETX
|
||||
AirWingTailDesc = "",
|
||||
|
||||
--TX_CH_TEXT = {},
|
||||
--PORT_TEXT = {},
|
||||
DSM_ChannelInfo = {} -- Data Created by DSM Configuration Script
|
||||
}
|
||||
|
||||
local Menu = { MenuId = 0, Text = "", TextId = 0, PrevId = 0, NextId = 0, BackId = 0 }
|
||||
local MenuLines = {}
|
||||
local RX = { Name = "", Version = "" }
|
||||
|
||||
local logFile = nil
|
||||
local logCount = 0
|
||||
|
||||
local LCD_X_LINE_TITLE = 0
|
||||
local LCD_X_LINE_VALUE = 75
|
||||
|
||||
local LCD_W_BUTTONS = 19
|
||||
local LCD_H_BUTTONS = 10
|
||||
|
||||
local LCD_X_MAX = 128
|
||||
local LCD_X_RIGHT_BUTTONS = LCD_X_MAX - LCD_W_BUTTONS - 1
|
||||
|
||||
local LCD_Y_LINE_HEIGHT = 7
|
||||
local LCD_Y_LOWER_BUTTONS = (8 * LCD_Y_LINE_HEIGHT) + 2
|
||||
|
||||
local TEXT_ATTR = SMLSIZE
|
||||
|
||||
local function LOG_open()
|
||||
logFile = io.open(LOG_FILE, "w") -- Truncate Log File
|
||||
end
|
||||
|
||||
local function LOG_write(...)
|
||||
if (logFile == nil) then LOG_open() end
|
||||
local str = string.format(...)
|
||||
io.write(logFile, str)
|
||||
end
|
||||
|
||||
local function LOG_close()
|
||||
if (logFile ~= nil) then io.close(logFile) end
|
||||
end
|
||||
|
||||
---------------- DSM Values <-> Int16 Manipulation --------------------------------------------------------
|
||||
|
||||
local function int16_LSB(number) -- Less Significat byte
|
||||
local r, x = bit32.band(number, 0xFF)
|
||||
return r
|
||||
end
|
||||
|
||||
local function int16_MSB(number) -- Most signifcant byte
|
||||
return bit32.rshift(number, 8)
|
||||
end
|
||||
|
||||
local function Dsm_to_Int16(lsb, msb) -- Componse an Int16 value
|
||||
return bit32.lshift(msb, 8) + lsb
|
||||
end
|
||||
|
||||
local function Dsm_to_SInt16(lsb, msb) -- Componse a SIGNED Int16 value
|
||||
local value = bit32.lshift(msb, 8) + lsb
|
||||
if value >= 0x8000 then -- Negative value??
|
||||
return value - 0x10000
|
||||
end
|
||||
return value
|
||||
end
|
||||
|
||||
local function sInt16ToDsm(value) -- Convent to SIGNED DSM Value
|
||||
if value < 0 then
|
||||
value = 0x10000 + value
|
||||
end
|
||||
return value
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
local function Get_Text(index)
|
||||
local out = Text[index] or string.format("Unknown_%X", index)
|
||||
if (index >= 0x8000) then
|
||||
out = Flight_Mode[0]
|
||||
end
|
||||
return out
|
||||
end
|
||||
|
||||
local function Get_Text_Value(index)
|
||||
local out = List_Text[index] or Get_Text(index)
|
||||
return out
|
||||
end
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
local function Get_RxName(index)
|
||||
local out = RxName[index] or string.format("Unknown_%X", index)
|
||||
return out
|
||||
end
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
local function DSM_Release()
|
||||
multiBuffer(0, 0)
|
||||
Phase = PH_EXIT_DONE
|
||||
end
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
local function DSM_Send(...)
|
||||
local arg = { ... }
|
||||
for i = 1, #arg do
|
||||
multiBuffer(3 + i, arg[i])
|
||||
end
|
||||
multiBuffer(3, 0x70 + #arg)
|
||||
end
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function ChangePhase(newPhase)
|
||||
Phase = newPhase
|
||||
Waiting_RX = 0
|
||||
end
|
||||
|
||||
local function Value_Add(dir)
|
||||
local line = MenuLines[ctx.SelLine]
|
||||
|
||||
Speed = getRotEncSpeed()
|
||||
if Speed == ROTENC_MIDSPEED then
|
||||
line.Val = line.Val + (5 * dir)
|
||||
elseif Speed == ROTENC_HIGHSPEED then
|
||||
line.Val = line.Val + (15 * dir)
|
||||
else
|
||||
line.Val = line.Val + dir
|
||||
end
|
||||
|
||||
if line.Val > line.Max then
|
||||
line.Val = line.Max
|
||||
elseif line.Val < line.Min then
|
||||
line.Val = line.Min
|
||||
end
|
||||
|
||||
ChangePhase(PH_VAL_CHANGING)
|
||||
Value_Change_Step = 0
|
||||
end
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
|
||||
local function GotoMenu(menuId, lastSelectedLine)
|
||||
Menu.MenuId = menuId
|
||||
ctx.SelLine = lastSelectedLine
|
||||
-- Request to load the menu Again
|
||||
ChangePhase(PH_TITLE)
|
||||
end
|
||||
|
||||
local function isSelectable(line)
|
||||
if (line.TextId == 0x00CD) then return true end -- Exceptiom: Level model and capture attitude
|
||||
if (line.Type == LT_MENU and line.ValId == line.MenuId) then return false end -- Menu to same page
|
||||
if (line.Type ~= LT_MENU and line.Max == 0) then return false end -- Read only data line
|
||||
if (line.Type ~= 0 and line.TextId < 0x8000) then return true end -- Not Flight Mode
|
||||
return false;
|
||||
end
|
||||
|
||||
local function isListLine(line)
|
||||
return line.Type==LT_LIST or line.Type == LT_LIST_VALIDATE or line.Type == LT_LIST_TOG
|
||||
end
|
||||
|
||||
local function DSM_Menu(event)
|
||||
if event == EVT_VIRTUAL_EXIT then
|
||||
if Phase == PH_RX_VER then
|
||||
DSM_Release() -- Exit program
|
||||
else
|
||||
if ctx.EditLine ~= nil then -- Editing a Line, need to restore original value
|
||||
MenuLines[ctx.EditLine].Val = originalValue
|
||||
event = EVT_VIRTUAL_ENTER
|
||||
else
|
||||
ChangePhase(PH_EXIT_REQ)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if Phase == PH_RX_VER then return end -- nothing else to do
|
||||
|
||||
if event == EVT_VIRTUAL_NEXT then
|
||||
if ctx.EditLine ~= nil then
|
||||
Value_Add(1)
|
||||
else
|
||||
-- not changing a value
|
||||
|
||||
if ctx.SelLine < 7 then -- On a regular line
|
||||
local num = ctx.SelLine -- Find the prev selectable
|
||||
for i = ctx.SelLine + 1, 6, 1 do
|
||||
local line = MenuLines[i]
|
||||
if isSelectable(line) then
|
||||
ctx.SelLine = i
|
||||
break
|
||||
end
|
||||
end
|
||||
if num == ctx.SelLine then -- No Selectable Line
|
||||
if Menu.NextId ~= 0 then
|
||||
ctx.SelLine = 7 -- Next
|
||||
elseif Menu.PrevId ~= 0 then
|
||||
ctx.SelLine = 8 -- Prev
|
||||
end
|
||||
end
|
||||
elseif Menu.PrevId ~= 0 then
|
||||
ctx.SelLine = 8 -- Prev
|
||||
end
|
||||
end
|
||||
elseif event == EVT_VIRTUAL_PREV then
|
||||
if ctx.EditLine ~= nil then -- In Edit Mode
|
||||
Value_Add(-1)
|
||||
else
|
||||
if ctx.SelLine == 8 and Menu.NextId ~= 0 then
|
||||
ctx.SelLine = 7 -- Next
|
||||
elseif ctx.SelLine > 0 then
|
||||
if ctx.SelLine > 6 then
|
||||
ctx.SelLine = 7 --NEXT
|
||||
end
|
||||
local num = ctx.SelLine -- Find Prev Selectable line
|
||||
for i = ctx.SelLine - 1, 0, -1 do
|
||||
local line = MenuLines[i]
|
||||
if isSelectable(line) then
|
||||
ctx.SelLine = i
|
||||
break
|
||||
end
|
||||
end
|
||||
if num == ctx.SelLine then -- No Selectable Line
|
||||
if (Menu.BackId > 0) then
|
||||
ctx.SelLine = -1 -- Back
|
||||
end
|
||||
end
|
||||
else
|
||||
ctx.SelLine = -1 -- Back
|
||||
end
|
||||
end
|
||||
elseif event == EVT_VIRTUAL_ENTER_LONG then
|
||||
if ctx.EditLine ~= nil then
|
||||
-- reset the value to default
|
||||
--if MenuLines[ctx.SelLine].Type ~= LIST_MENU_NOCHANGING then
|
||||
MenuLines[ctx.SelLine].Val = MenuLines[ctx.SelLine].Def
|
||||
ChangePhase(PH_VAL_CHANGING)
|
||||
Value_Change_Step = 0
|
||||
--end
|
||||
end
|
||||
elseif event == EVT_VIRTUAL_ENTER then
|
||||
if ctx.SelLine == -1 then -- Back
|
||||
GotoMenu(Menu.BackId, 0x80)
|
||||
elseif ctx.SelLine == 7 then -- Next
|
||||
GotoMenu(Menu.NextId, 0x82)
|
||||
elseif ctx.SelLine == 8 then -- Prev
|
||||
GotoMenu(Menu.PrevId, 0x81)
|
||||
elseif ctx.SelLine >= 0 and MenuLines[ctx.SelLine].Type == LT_MENU then
|
||||
GotoMenu(MenuLines[ctx.SelLine].ValId, ctx.SelLine) -- ValId is the next menu
|
||||
else
|
||||
-- value entry
|
||||
if ctx.EditLine ~= nil then
|
||||
ctx.EditLine = nil -- Done Editting
|
||||
Value_Change_Step = 0
|
||||
ChangePhase(PH_VAL_CHNG_END)
|
||||
else -- Start Editing
|
||||
ctx.EditLine = ctx.SelLine
|
||||
originalValue = MenuLines[ctx.SelLine].Val
|
||||
ChangePhase(PH_VAL_WAIT)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
local function SendTxInfo(portNo)
|
||||
-- TxInfo_Type=0 : AR636 Main Menu (Send port/Channel info + SubTrim + Travel)
|
||||
-- TxInfo_Type=1 : AR630-637 Famly Main Menu (Only Send Port/Channel usage Msg 0x20)
|
||||
-- TxInfo_Type=1F : AR630-637 Initial Setup/Relearn Servo Settings (Send port/Channel info + SubTrim + Travel +0x24/Unknown)
|
||||
|
||||
|
||||
if (TX_Info_Step == 0) then
|
||||
-- AR630 family: Both TxInfo_Type (ManinMenu=0x1, Other First Time Configuration = 0x1F)
|
||||
local info = MODEL.DSM_ChannelInfo[portNo]
|
||||
DSM_Send(0x20, 0x06, portNo, portNo, info[0],info[1])
|
||||
LOG_write("DSM_TxInfo_20(Port=#%d, Port Use)\n", portNo)
|
||||
|
||||
if (TX_Info_Type == 0x1F) then
|
||||
TX_Info_Step = 1
|
||||
elseif (TX_Info_Type == 0x00) then
|
||||
TX_Info_Step = 2
|
||||
end
|
||||
elseif (TX_Info_Step == 1) then
|
||||
local info = MODEL.modelOutputChannel[portNo]
|
||||
local leftTravel = math.abs(math.floor(info.min/10))
|
||||
local rightTravel = math.abs(math.floor(info.max/10))
|
||||
|
||||
DSM_Send(0x23, 0x06, 0x00, leftTravel, 0x00, rightTravel)
|
||||
LOG_write("DSM_TxInfo_23(Port=#%d,ServoTravel(L=%d - R=%d))\n", portNo,leftTravel,rightTravel)
|
||||
|
||||
TX_Info_Step = 2
|
||||
elseif (TX_Info_Step == 2) then
|
||||
local data = {[0]= -- Start at 0
|
||||
{[0]= 0x0, 0x00, 0x07, 0xFF }, -- Ch1 Thr: 0 00 07 FF Subtrim ??
|
||||
{[0]= 0x0, 0x8E, 0x07, 0x72 }, -- Ch2 Ail: 0 8E 07 72 Subtrim 0
|
||||
{[0]= 0x0, 0x8E, 0x07, 0x72 }, -- Ch3 Elev: 0 8E 07 72 Subtrim 0
|
||||
{[0]= 0x0, 0x8E, 0x07, 0x72 }, -- Ch4 Rud: 0 8E 07 72 Subtrim 0
|
||||
{[0]= 0x0, 0x8E, 0x07, 0x72 }, -- Ch5 Gear: 0 8E 07 72 Subtrim 0
|
||||
{[0]= 0x0, 0x8E, 0x07, 0x72 }, -- Ch6 Aux1: 0 8E 07 72 Subtrim 0
|
||||
{[0]= 0x0, 0x8E, 0x07, 0x72 }, -- Ch7 Aux2: 0 8E 07 72 Subtrim 0
|
||||
{[0]= 0x0, 0x8E, 0x07, 0x72 }, -- Ch8 Aux3: 0 8E 07 72 Subtrim 0
|
||||
{[0]= 0x0, 0x8E, 0x07, 0x72 }, -- Ch9 Aux4: 0 8E 07 72 Subtrim 0
|
||||
{[0]= 0x0, 0x8E, 0x07, 0x72 }, -- Ch10 Aux5: 0 8E 07 72 Subtrim 0
|
||||
}
|
||||
local info = data[portNo]
|
||||
local b1,b2,b3,b4 = info[0], info[1], info[2], info[3]
|
||||
|
||||
DSM_Send(0x21, 0x06, b1,b2,b3,b4) -- Port is not send anywhere, since the previous 0x20 type message have it.
|
||||
LOG_write("DSM_TxInfo_21(Port=#%d, SubTrim)\n", portNo)
|
||||
|
||||
if (TX_Info_Type == 0x00) then
|
||||
TX_Info_Step = 5 -- End Step
|
||||
else
|
||||
TX_Info_Step = 3
|
||||
end
|
||||
elseif (TX_Info_Step == 3) then
|
||||
LOG_write("DSM_TxInfo_24?(Port=#%d)\n", portNo)
|
||||
DSM_Send(0x24, 0x06, 0x00, 0x83, 0x5A, 0xB5) -- Still Uknown
|
||||
TX_Info_Step = 4
|
||||
elseif (TX_Info_Step == 4) then
|
||||
LOG_write("DSM_TxInfo_24?(Port=#%d)\n", portNo)
|
||||
DSM_Send(0x24, 0x06, 0x06, 0x80, 0x25, 0x4B) -- Still Uknown
|
||||
TX_Info_Step = 5
|
||||
elseif (TX_Info_Step == 5) then
|
||||
LOG_write("DSM_TxInfo_22(Port=#%d, END of Data)\n", portNo)
|
||||
DSM_Send(0x22, 0x04, 0x00, 0x00)
|
||||
TX_Info_Step = 0 -- Done!!
|
||||
end
|
||||
|
||||
if (TX_Info_Step > 0) then
|
||||
Waiting_RX = 0 -- keep Transmitig
|
||||
end
|
||||
end
|
||||
|
||||
local function DSM_SendRequest()
|
||||
--LOG_write("DSM_SendRequest Phase=%d\n",Phase)
|
||||
-- Need to send a request
|
||||
if Phase == PH_RX_VER then -- request RX version
|
||||
DSM_Send(0x11, 0x06, 0x00, 0x14, 0x00, 0x00)
|
||||
LOG_write("GetVersion()\n")
|
||||
elseif Phase == PH_WAIT_CMD then -- keep connection open
|
||||
DSM_Send(0x00, 0x04, 0x00, 0x00)
|
||||
elseif Phase == PH_TITLE then -- request menu title
|
||||
local menuId = Menu.MenuId
|
||||
if menuId == 0 then
|
||||
DSM_Send(0x12, 0x06, 0x00, 0x14, 0x00, 0x00) -- first menu only
|
||||
else
|
||||
DSM_Send(0x16, 0x06, int16_MSB(menuId), int16_LSB(menuId), 0x00, ctx.SelLine)
|
||||
if (menuId == 0x0001) then -- Executed Save&Reset menu
|
||||
Phase = PH_RX_VER
|
||||
ctx.isReset = true
|
||||
end
|
||||
end
|
||||
LOG_write("GetMenu(M=0x%04X,L=%d)\n", menuId, ctx.SelLine)
|
||||
elseif Phase == PH_TX_INFO then -- TX Info
|
||||
SendTxInfo(ctx.CurLine)
|
||||
elseif Phase == PH_LINES then -- request menu lines
|
||||
local menuId = Menu.MenuId
|
||||
if ctx.CurLine == -1 then
|
||||
DSM_Send(0x13, 0x04, int16_MSB(menuId), int16_LSB(menuId)) -- GetFirstLine
|
||||
else
|
||||
DSM_Send(0x14, 0x06, int16_MSB(menuId), int16_LSB(menuId), 0x00, ctx.CurLine) -- line X
|
||||
end
|
||||
LOG_write("GetLines(LastLine=%d)\n", ctx.CurLine)
|
||||
elseif Phase == PH_VALUES then -- request menu values
|
||||
local menuId = Menu.MenuId
|
||||
local valId = MenuLines[ctx.CurLine].ValId
|
||||
DSM_Send(0x15, 0x06,
|
||||
int16_MSB(menuId), int16_LSB(menuId),
|
||||
int16_MSB(valId), int16_LSB(valId))
|
||||
LOG_write("GetValues(LastVId=0x%04X)\n", valId)
|
||||
elseif Phase == PH_VAL_CHANGING then -- send new value: Two steps, Update & Validate
|
||||
local line = MenuLines[ctx.SelLine]
|
||||
local valId = line.ValId
|
||||
if Value_Change_Step == 0 then
|
||||
local value = sInt16ToDsm(line.Val)
|
||||
DSM_Send(0x18, 0x06,
|
||||
int16_MSB(valId), int16_LSB(valId),
|
||||
int16_MSB(value), int16_LSB(value)) -- send current values
|
||||
LOG_write("ChangeValue(VId=0x%04X,Val=%d)\n", valId, value)
|
||||
|
||||
if line.Type == LT_LIST_VALIDATE then -- Incremental Validation??
|
||||
Value_Change_Step = 1
|
||||
Waiting_RX = 0 -- Do SEND in the next step
|
||||
end
|
||||
else
|
||||
-- Validate Value
|
||||
DSM_Send(0x19, 0x04, int16_MSB(valId), int16_LSB(valId))
|
||||
Value_Change_Step = 0
|
||||
Phase = PH_VAL_WAIT
|
||||
LOG_write("ValidateValue(VId=0x%04X)\n", valId)
|
||||
end
|
||||
elseif Phase == PH_VAL_CHNG_END then
|
||||
DSM_Send(0x1B, 0x04, 0x00, int16_LSB(ctx.SelLine))
|
||||
Value_Change_Step = 0
|
||||
Phase = PH_WAIT_CMD
|
||||
LOG_write("ValueChangeEnd(L=%d)\n", ctx.SelLine)
|
||||
elseif Phase == PH_VAL_WAIT then
|
||||
-- Value Changing Wait
|
||||
DSM_Send(0x1A, 0x04, 0x00, int16_LSB(ctx.SelLine))
|
||||
LOG_write("ValueChangeWait(L=%d)\n", ctx.SelLine)
|
||||
elseif Phase == PH_EXIT_REQ then -- EXIT Request
|
||||
DSM_Send(0x1F, 0x02, 0xAA)
|
||||
end
|
||||
end
|
||||
|
||||
local function DSM_ProcessResponse()
|
||||
local cmd = multiBuffer(11)
|
||||
-- LOG_write("DSM_ProcessResponse BEGIN: Cmd=%x\n",cmd)
|
||||
if cmd == 0x01 then -- read version
|
||||
RX.Name = Get_RxName(multiBuffer(13))
|
||||
RX.Version = multiBuffer(14) .. "." .. multiBuffer(15) .. "." .. multiBuffer(16)
|
||||
--ctx.isReset = false -- no longer resetting
|
||||
Menu.MenuId = 0
|
||||
Phase = PH_TITLE
|
||||
LOG_write("Version: %s %s\n", RX.Name, RX.Version)
|
||||
elseif cmd == 0x02 then -- read menu title
|
||||
local menu = Menu
|
||||
|
||||
menu.MenuId = Dsm_to_Int16(multiBuffer(12), multiBuffer(13))
|
||||
menu.TextId = Dsm_to_Int16(multiBuffer(14), multiBuffer(15))
|
||||
menu.Text = Get_Text(menu.TextId)
|
||||
menu.PrevId = Dsm_to_Int16(multiBuffer(16), multiBuffer(17))
|
||||
menu.NextId = Dsm_to_Int16(multiBuffer(18), multiBuffer(19))
|
||||
menu.BackId = Dsm_to_Int16(multiBuffer(20), multiBuffer(21))
|
||||
|
||||
for i = 0, 6 do -- clear menu
|
||||
MenuLines[i] = { MenuId = 0, Type = 0, TextId = 0, ValId = 0, Min = 0, Max = 0, Def = 0, Val = nil, Unit, Step }
|
||||
end
|
||||
ctx.CurLine = -1
|
||||
ctx.SelLine = -1 -- highlight Back
|
||||
|
||||
LOG_write("Menu: Mid=0x%04X \"%s\"\n", menu.MenuId, menu.Text)
|
||||
|
||||
if (menu.MenuId == 0x0001) then -- Still in RESETTING MENU???
|
||||
--menu.MenuId = 0
|
||||
Phase = PH_RX_VER
|
||||
else
|
||||
Phase = PH_LINES
|
||||
end
|
||||
elseif cmd == 0x03 then -- read menu lines
|
||||
local i = multiBuffer(14)
|
||||
local type = multiBuffer(15)
|
||||
local line = MenuLines[i]
|
||||
|
||||
ctx.CurLine = i
|
||||
|
||||
line.lineNum = i
|
||||
line.MenuId = Dsm_to_Int16(multiBuffer(12), multiBuffer(13))
|
||||
line.Type = type
|
||||
line.TextId = Dsm_to_Int16(multiBuffer(16), multiBuffer(17))
|
||||
line.Text = Get_Text(line.TextId)
|
||||
line.ValId = Dsm_to_Int16(multiBuffer(18), multiBuffer(19))
|
||||
|
||||
-- Singed int values
|
||||
line.Min = Dsm_to_SInt16(multiBuffer(20), multiBuffer(21))
|
||||
line.Max = Dsm_to_SInt16(multiBuffer(22), multiBuffer(23))
|
||||
line.Def = Dsm_to_SInt16(multiBuffer(24), multiBuffer(25))
|
||||
|
||||
if line.Type == LT_MENU then
|
||||
-- nothing to do on menu entries
|
||||
elseif isListLine(line) then
|
||||
line.Val = nil --line.Def - line.Min -- use default value not sure if needed
|
||||
line.Def = line.Min -- pointer to the start of the list in Text
|
||||
line.Max = line.Max - line.Min -- max index
|
||||
line.Min = 0 -- min index
|
||||
else -- default to numerical value
|
||||
line.Val = nil --line.Def -- use default value not sure if needed
|
||||
if (line.Min == 0 and line.Max == 100) or (line.Min == -100 and line.Max == 100) or
|
||||
(line.Min == 0 and line.Max == 150) or (line.Min == -150 and line.Max == 150) then
|
||||
line.Type = LT_VALUE_PERCENT -- Override to Value Percent
|
||||
end
|
||||
end
|
||||
|
||||
if ctx.SelLine == -1 and isSelectable(line) then -- Auto select first selectable line of the menu
|
||||
ctx.SelLine = ctx.CurLine
|
||||
end
|
||||
|
||||
LOG_write("Line: #%d Vid=0x%04X T=0x%02X \"%s\"\n", i, line.ValId, type, line.Text)
|
||||
Phase = PH_LINES
|
||||
elseif cmd == 0x04 then -- read menu values
|
||||
-- Identify the line and update the value
|
||||
local valId = Dsm_to_Int16(multiBuffer(14), multiBuffer(15))
|
||||
local value = Dsm_to_SInt16(multiBuffer(16), multiBuffer(17)) --Signed int
|
||||
|
||||
local updatedLine = nil
|
||||
for i = 0, 6 do -- Find the menu line for this value
|
||||
local line = MenuLines[i]
|
||||
if line.Type ~= 0 then
|
||||
if line.Type ~= LT_MENU and line.ValId == valId then -- identifier of ValueId stored in the line
|
||||
line.Val = value
|
||||
ctx.CurLine = i
|
||||
updatedLine = line
|
||||
|
||||
local valueTxt = value
|
||||
if isListLine(line) then
|
||||
valueTxt = Get_Text_Value(line.Def + value) .. " [" .. value .. "]"
|
||||
end
|
||||
|
||||
LOG_write("Update Value: #%d VId=0x%04X Value=%s\n", i, valId, valueTxt)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (updatedLine == nil) then
|
||||
LOG_write("Cannot Find Line for ValueId=%x\n", valId)
|
||||
end
|
||||
Phase = PH_VALUES
|
||||
elseif cmd == 0x05 then -- Request TX info
|
||||
ctx.CurLine = multiBuffer(12)
|
||||
TX_Info_Type = multiBuffer(13)
|
||||
TX_Info_Step = 0
|
||||
Phase = PH_TX_INFO
|
||||
LOG_write("TXInfoReq: Port=%d T=0x%02X\n", ctx.CurLine, TX_Info_Type)
|
||||
elseif cmd == 0xA7 then -- answer to EXIT command
|
||||
DSM_Release()
|
||||
elseif cmd == 0x00 and Phase == PH_VAL_CHANGING then
|
||||
Phase = PH_VAL_WAIT
|
||||
end
|
||||
|
||||
--LOG_write("DSM_ProcessResponse END: Cmd=%x\n",cmd)
|
||||
return cmd
|
||||
end
|
||||
|
||||
|
||||
local function DSM_Send_Receive()
|
||||
if Waiting_RX == 0 then
|
||||
Waiting_RX = 1
|
||||
DSM_SendRequest()
|
||||
multiBuffer(10, 0x00);
|
||||
InactivityTime = getTime() + 200 -- Reset Inactivity timeout
|
||||
-- -- -- -- -- -- -- -- -- -- -- -- receive part -- -- -- -- -- -- -- -- -- -- -- -- --
|
||||
elseif multiBuffer(10) == 0x09 then
|
||||
local cmd = DSM_ProcessResponse()
|
||||
-- Data processed
|
||||
multiBuffer(10, 0x00)
|
||||
if (cmd > 0x00) then -- Any non NULL response
|
||||
-- Only change to SEND mode if we received a valid response (Ignore NULL Responses, that are really heartbeat i most cases)
|
||||
Waiting_RX = 0
|
||||
InactivityTime = getTime() + 200 -- Reset Inactivity timeout
|
||||
end
|
||||
else -- No Send or Receive,
|
||||
-- Check if enouth time has passed from last transmit/receive activity
|
||||
if getTime() > InactivityTime then
|
||||
InactivityTime = getTime() + 200
|
||||
Waiting_RX = 0 -- Switch to Send mode to send heartbeat
|
||||
|
||||
if Phase == PH_EXIT_REQ then
|
||||
DSM_Release()
|
||||
end
|
||||
|
||||
if Phase ~= PH_RX_VER and Phase ~= PH_VAL_WAIT then
|
||||
Phase = PH_WAIT_CMD
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
|
||||
local function showBitmap(x, y, imgDesc)
|
||||
local f = string.gmatch(imgDesc, '([^%|]+)') -- Iterator over values split by '|'
|
||||
local imgName, imgMsg = f(), f()
|
||||
|
||||
f = string.gmatch(imgMsg or "", '([^%:]+)') -- Iterator over values split by ':'
|
||||
local p1, p2 = f(), f()
|
||||
|
||||
lcd.drawText(x, y, p1 or "", TEXT_ATTR) -- Alternate Image MSG
|
||||
lcd.drawText(x, y + LCD_Y_LINE_HEIGHT, p2 or "", TEXT_ATTR) -- Alternate Image MSG
|
||||
end
|
||||
|
||||
|
||||
local function drawButton(x, y, text, active)
|
||||
local attr = TEXT_ATTR
|
||||
if (active) then attr = attr + INVERS end
|
||||
lcd.drawText(x, y, text, attr)
|
||||
end
|
||||
|
||||
local ver_rx_count = 0
|
||||
|
||||
local function DSM_Display()
|
||||
lcd.clear()
|
||||
--Draw RX Menu
|
||||
if Phase == PH_RX_VER then
|
||||
lcd.drawText(1, 0, "DSM Frwd Prog "..VERSION, INVERS)
|
||||
|
||||
local msgId = 0x300 -- Waiting for RX
|
||||
if (ctx.isReset) then msgId=0x301 end -- Waiting for Reset
|
||||
lcd.drawText(0, 3 * LCD_Y_LINE_HEIGHT, Get_Text(msgId), BLINK)
|
||||
return
|
||||
end
|
||||
|
||||
-- display Program version or RX version
|
||||
local msg = RX.Name .. " v" .. RX.Version
|
||||
if (ver_rx_count < 100) then
|
||||
msg = RX.Name .. " v" .. RX.Version
|
||||
ver_rx_count = ver_rx_count + 1
|
||||
else
|
||||
msg = "Frwd Prog "..VERSION
|
||||
ver_rx_count = ver_rx_count + 1
|
||||
if (ver_rx_count > 200) then ver_rx_count=0 end
|
||||
end
|
||||
lcd.drawText(30, LCD_Y_LOWER_BUTTONS, msg, TEXT_ATTR)
|
||||
|
||||
if Menu.MenuId == 0 then return end; -- No Title yet
|
||||
|
||||
-- Got a Menu
|
||||
lcd.drawText(1, 0, Menu.Text, TEXT_ATTR + INVERS)
|
||||
|
||||
local y = LCD_Y_LINE_HEIGHT + 2
|
||||
for i = 0, 6 do
|
||||
local attrib = TEXT_ATTR
|
||||
if (i == ctx.SelLine) then attrib = attrib + INVERS end -- Selected Line
|
||||
|
||||
local line = MenuLines[i]
|
||||
|
||||
if line ~= nil and line.Type ~= 0 then
|
||||
local heading = Get_Text(line.TextId)
|
||||
|
||||
if (line.TextId >= 0x8000) then -- Flight mode
|
||||
heading = " " .. Flight_Mode[0] .. " "
|
||||
if (line.Val==nil) then heading = heading .. "--" else heading = heading .. ((line.Val or 0) + 1) end
|
||||
else
|
||||
local text = "-"
|
||||
if line.Type ~= LT_MENU then -- list/value
|
||||
if line.Val ~= nil then
|
||||
if isListLine(line) then
|
||||
local textId = line.Val + line.Def
|
||||
text = Get_Text_Value(textId)
|
||||
|
||||
local imgDesc = List_Text_Img[textId]
|
||||
|
||||
if (imgDesc and i == ctx.SelLine) then -- Optional Image and Msg for selected value
|
||||
showBitmap(0, 20, imgDesc)
|
||||
end
|
||||
elseif (line.Type == LT_VALUE_PERCENT) then
|
||||
text = line.Val .. " %"
|
||||
elseif (line.Type == LT_VALUE_DEGREES) then
|
||||
text = line.Val .. " @"
|
||||
else
|
||||
text = line.Val
|
||||
end
|
||||
end -- if is Value
|
||||
|
||||
if (ctx.EditLine == i) then -- Editing a Line
|
||||
attrib = BLINK + INVERS + TEXT_ATTR
|
||||
end
|
||||
lcd.drawText(LCD_X_MAX, y, text, attrib + RIGHT) -- display value
|
||||
attrib = TEXT_ATTR
|
||||
end
|
||||
end -- Flight mode
|
||||
lcd.drawText(0, y, heading, attrib) -- display text
|
||||
end
|
||||
y = y + LCD_Y_LINE_HEIGHT
|
||||
end -- for
|
||||
|
||||
if Menu.BackId ~= 0 then
|
||||
drawButton(LCD_X_RIGHT_BUTTONS, 0, "Back", ctx.SelLine == -1)
|
||||
end
|
||||
|
||||
if Menu.NextId ~= 0 then
|
||||
drawButton(LCD_X_RIGHT_BUTTONS, LCD_Y_LOWER_BUTTONS, "Next", ctx.SelLine == 7)
|
||||
end
|
||||
|
||||
if Menu.PrevId ~= 0 then
|
||||
drawButton(0, LCD_Y_LOWER_BUTTONS, "Prev", ctx.SelLine == 8)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
local function load_msg_from_file(fileName, mem, Text, List_Text, List_Text_Img, RxName, Flight_Mode)
|
||||
local function rtrim(s)
|
||||
local n = string.len(s)
|
||||
while n > 0 and string.find(s, "^%s", n) do n = n - 1 end
|
||||
return string.sub(s, 1, n)
|
||||
end
|
||||
|
||||
--print(string.format("Loading messages from [%s]",fileName))
|
||||
local dataFile = io.open(fileName, "r") -- read File
|
||||
-- cannot read file???
|
||||
assert(dataFile, "Cannot load Message file:" .. fileName)
|
||||
|
||||
local data = io.read(dataFile, mem * 1024) -- read up to 10k characters (newline char also counts!)
|
||||
io.close(dataFile)
|
||||
|
||||
collectgarbage("collect")
|
||||
|
||||
local lineNo = 0
|
||||
for line in string.gmatch(data, "[^\r\n]+") do
|
||||
lineNo = lineNo + 1
|
||||
--print(string.format("Line [%d]: %s",lineNo,line))
|
||||
|
||||
-- Remove Comments
|
||||
local s = string.find(line, "--", 1, true)
|
||||
if (s ~= nil) then
|
||||
line = string.sub(line, 1, s - 1)
|
||||
end
|
||||
|
||||
line = rtrim(line)
|
||||
|
||||
if (string.len(line) > 0) then
|
||||
local a, b, c = string.match(line, "%s*(%a*)%s*|%s*(%w*)%s*|(.*)%s*")
|
||||
--print(string.format("[%s] [%s] [%s]",a,b,c))
|
||||
if (a ~= nil) then
|
||||
local index = tonumber(b)
|
||||
|
||||
if (index == nil) then
|
||||
assert(false, string.format("%s:%d: Invalid Hex num [%s]", fileName, lineNo, b))
|
||||
elseif (a == "T") then
|
||||
Text[index] = c
|
||||
elseif (a == "LT") then
|
||||
List_Text[index] = c
|
||||
elseif (a == "LI") then
|
||||
List_Text_Img[index] = c
|
||||
elseif (a == "FM") then
|
||||
Flight_Mode[0] = c
|
||||
elseif (a == "RX") then
|
||||
RxName[index] = c
|
||||
else
|
||||
assert(false, string.format("%s:%d: Invalid Line Type [%s]", fileName, lineNo, a))
|
||||
end
|
||||
end
|
||||
end
|
||||
if (lineNo % 50 == 0) then
|
||||
collectgarbage("collect")
|
||||
end
|
||||
end -- For
|
||||
|
||||
--print(string.format("Loaded [%d] messages",lineNo))
|
||||
data = nil
|
||||
end
|
||||
|
||||
|
||||
local function clean_msg(Text, Flight_Mode)
|
||||
local function clean_line(c)
|
||||
if (c==nil) then return c end
|
||||
local pos
|
||||
c, pos = string.gsub(c, "/b$", "")
|
||||
c, pos = string.gsub(c, "/c$", "")
|
||||
c, pos = string.gsub(c, "/r$", "")
|
||||
c, pos = string.gsub(c, "/p$", "")
|
||||
c, pos = string.gsub(c, "/m$", "")
|
||||
return c
|
||||
end
|
||||
|
||||
-- Clean the line of special markers that are only used in color vesion
|
||||
for i = 0, 0x0300 do
|
||||
Text[i] = clean_line(Text[i])
|
||||
collectgarbage("collect")
|
||||
end
|
||||
|
||||
for i = 0, #Flight_Mode do
|
||||
-- Clean the line of special markers that are only used in color vesion
|
||||
Flight_Mode[i] = clean_line(Flight_Mode[i])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function DSM_Init_Model()
|
||||
MODEL.DSM_ChannelInfo= {[0]= -- Start array at position 0
|
||||
{[0]= 0x00, 0x40}, -- Ch1 Thr (0x40)
|
||||
{[0]= 0x00, 0x01}, -- Ch2 Ail (0x01)
|
||||
{[0]= 0x00, 0x02}, -- Ch2 ElE (0x02)
|
||||
{[0]= 0x00, 0x04}, -- Ch4 Rud (0x04)
|
||||
{[0]= 0x00, 0x00}, -- Ch5 Gear (0x00)
|
||||
{[0]= 0x00, 0x00}, -- Ch6 Aux1 (0x00)
|
||||
{[0]= 0x00, 0x00}, -- Ch7 Aux2 (0x00)
|
||||
{[0]= 0x00, 0x00}, -- Ch8 Aux3 (0x00)
|
||||
{[0]= 0x00, 0x00}, -- Ch9 Aux4 (0x00)
|
||||
{[0]= 0x00, 0x00} -- Ch10 Aux5 (0x00)
|
||||
}
|
||||
|
||||
MODEL.modelOutputChannel = {[0]=
|
||||
{min=1000, max=1000}, -- Ch1
|
||||
{min=1000, max=1000}, -- Ch2
|
||||
{min=1000, max=1000}, -- Ch3
|
||||
{min=1000, max=1000}, -- Ch4
|
||||
{min=1000, max=1000}, -- Ch5
|
||||
{min=1000, max=1000}, -- Ch6
|
||||
{min=1000, max=1000}, -- Ch7
|
||||
{min=1000, max=1000}, -- Ch8
|
||||
{min=1000, max=1000}, -- Ch9
|
||||
{min=1000, max=1000} -- Ch10
|
||||
}
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
-- Init
|
||||
local function DSM_Init()
|
||||
LOG_open()
|
||||
LOG_write("-------- NEW SESSION --------------------\n")
|
||||
|
||||
DSM_Init_Model()
|
||||
|
||||
--[[
|
||||
if (ModelParam~=nil) then
|
||||
LOG_write("Got MODEL PARAMETER... copying\n")
|
||||
MODEL.DSM_ChannelInfo = ModelParam.DSM_ChannelInfo
|
||||
else
|
||||
LOG_write("NO-PARMETER --- Create DEFAULT")
|
||||
end
|
||||
--]]
|
||||
|
||||
collectgarbage("collect")
|
||||
LOG_write("Mem before msg =%d\n",collectgarbage("count"))
|
||||
load_msg_from_file(MSG_FILE, 10, Text, List_Text, List_Text_Img, RxName, Flight_Mode)
|
||||
collectgarbage("collect")
|
||||
LOG_write("Mem after msg =%d\n",collectgarbage("count"))
|
||||
load_msg_from_file(MSG_FILE_MIN, 4, Text, List_Text, List_Text_Img, RxName, Flight_Mode)
|
||||
collectgarbage("collect")
|
||||
LOG_write("Mem after msg2 =%d\n",collectgarbage("count"))
|
||||
clean_msg(Text,Flight_Mode)
|
||||
collectgarbage("collect")
|
||||
|
||||
--Set protocol to talk to
|
||||
multiBuffer(0, string.byte('D'))
|
||||
--test if value has been written
|
||||
if multiBuffer(0) ~= string.byte('D') then
|
||||
error("Not enough memory!")
|
||||
return 2
|
||||
end
|
||||
|
||||
--Init TX buffer
|
||||
multiBuffer(3, 0x00)
|
||||
--Init RX buffer
|
||||
multiBuffer(10, 0x00)
|
||||
--Init telemetry
|
||||
multiBuffer(0, string.byte('D'))
|
||||
multiBuffer(1, string.byte('S'))
|
||||
multiBuffer(2, string.byte('M'))
|
||||
|
||||
|
||||
if (LCD_W > 128) then
|
||||
TEXT_ATTR = 0
|
||||
LCD_Y_LINE_HEIGHT = 25
|
||||
LCD_X_MAX = 300
|
||||
LCD_X_RIGHT_BUTTONS = LCD_X_MAX - 30
|
||||
|
||||
LCD_Y_LOWER_BUTTONS = (8 * LCD_Y_LINE_HEIGHT) + 2
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
-- Main
|
||||
local function DSM_Run(event)
|
||||
if event == nil then
|
||||
error("Cannot be run as a model script!")
|
||||
return 2
|
||||
else
|
||||
DSM_Display()
|
||||
DSM_Menu(event)
|
||||
DSM_Send_Receive()
|
||||
end
|
||||
if Phase == PH_EXIT_DONE then
|
||||
LOG_close()
|
||||
return 2
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
return { init = DSM_Init, run = DSM_Run }
|
@ -40,7 +40,13 @@
|
||||
|
||||
|
||||
local DEBUG_ON = ... -- Get Debug_ON from parameters. -- 0=NO DEBUG, 1=HIGH LEVEL 2=MORE DETAILS
|
||||
local LIB_VERSION = "0.53"
|
||||
|
||||
local LIB_VERSION = "0.54"
|
||||
local LANGUAGE = "en"
|
||||
|
||||
local LOG_FILE = "/LOGS/dsm_log.txt"
|
||||
local MSG_FILE = "/SCRIPTS/TOOLS/DSMLIB/msg_fwdp_"..LANGUAGE..".txt"
|
||||
|
||||
|
||||
local Lib = { Init_Text = function (rxId) end }
|
||||
|
||||
@ -152,15 +158,14 @@ local TxInfo_Step = 0
|
||||
-- Text Arrays for Display Text and Debuging
|
||||
local PhaseText = {}
|
||||
local LineTypeText = {}
|
||||
local RxName = {}
|
||||
|
||||
|
||||
local Text = {} -- Text for Menu and Menu Lines (Headers only)
|
||||
local List_Text = {} -- Messages for List Options (values only)
|
||||
local List_Text_Img = {} -- If the Text has Attached Images
|
||||
local List_Values = {} -- Additiona restrictions on List Values when non contiguos (L_M1 lines has this problem)
|
||||
local RxName = {}
|
||||
local Flight_Mode = {[0]="Flight Mode"}
|
||||
|
||||
local LOG_FILE = "/LOGS/dsm_log.txt"
|
||||
local logFile = nil
|
||||
|
||||
|
||||
@ -288,6 +293,9 @@ end
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
local function Get_Text(index)
|
||||
local out = Text[index] -- Find in regular header first
|
||||
if (index >= 0x8000) then
|
||||
out = Flight_Mode[0]
|
||||
end
|
||||
if out== nil then
|
||||
out = List_Text[index] -- Try list values, don't think is necesary, but just playing Safe
|
||||
end
|
||||
@ -1331,6 +1339,69 @@ local function DSM_Send_Receive()
|
||||
end
|
||||
end
|
||||
|
||||
local function load_msg_from_file(fileName, mem, Text, List_Text, List_Text_Img, RxName, Flight_Mode)
|
||||
local function rtrim(s)
|
||||
local n = string.len(s)
|
||||
while n > 0 and string.find(s, "^%s", n) do n = n - 1 end
|
||||
return string.sub(s, 1, n)
|
||||
end
|
||||
|
||||
--print(string.format("Loading messages from [%s]",fileName))
|
||||
local dataFile = io.open(fileName, "r") -- read File
|
||||
-- cannot read file???
|
||||
assert(dataFile, "Cannot load Message file:" .. fileName)
|
||||
|
||||
local data = io.read(dataFile, mem * 1024) -- read up to 10k characters (newline char also counts!)
|
||||
io.close(dataFile)
|
||||
|
||||
collectgarbage("collect")
|
||||
|
||||
local lineNo = 0
|
||||
for line in string.gmatch(data, "[^\r\n]+") do
|
||||
lineNo = lineNo + 1
|
||||
--print(string.format("Line [%d]: %s",lineNo,line))
|
||||
|
||||
-- Remove Comments
|
||||
local s = string.find(line, "--", 1, true)
|
||||
if (s ~= nil) then
|
||||
line = string.sub(line, 1, s - 1)
|
||||
end
|
||||
|
||||
line = rtrim(line)
|
||||
|
||||
if (string.len(line) > 0) then
|
||||
local a, b, c = string.match(line, "%s*(%a*)%s*|%s*(%w*)%s*|(.*)%s*")
|
||||
--print(string.format("[%s] [%s] [%s]",a,b,c))
|
||||
if (a ~= nil) then
|
||||
local index = tonumber(b)
|
||||
|
||||
if (index == nil) then
|
||||
assert(false, string.format("%s:%d: Invalid Hex num [%s]", fileName, lineNo, b))
|
||||
elseif (a == "T") then
|
||||
Text[index] = c
|
||||
elseif (a == "LT") then
|
||||
List_Text[index] = c
|
||||
elseif (a == "LI") then
|
||||
List_Text_Img[index] = c
|
||||
elseif (a == "FM") then
|
||||
Flight_Mode[0] = c
|
||||
elseif (a == "RX") then
|
||||
RxName[index] = c
|
||||
else
|
||||
assert(false, string.format("%s:%d: Invalid Line Type [%s]", fileName, lineNo, a))
|
||||
end
|
||||
end
|
||||
end
|
||||
if (lineNo % 50 == 0) then
|
||||
collectgarbage("collect")
|
||||
end
|
||||
end -- For
|
||||
|
||||
--print(string.format("Loaded [%d] messages",lineNo))
|
||||
data = nil
|
||||
end
|
||||
|
||||
|
||||
-- Init
|
||||
local function DSM_Init(toolName)
|
||||
local dateTime = getDateTime()
|
||||
@ -1374,20 +1445,13 @@ local function DSM_Init(toolName)
|
||||
LineTypeText[LINE_TYPE.VALUE_NUM_SI16] = "V_s16"
|
||||
LineTypeText[LINE_TYPE.LT_EMPTY] = "Z"
|
||||
|
||||
--RX names--
|
||||
RxName[RX.AR636B] = "AR636B"
|
||||
RxName[RX.SPM4651T] = "SPM4651T"
|
||||
RxName[RX.AR637T] = "AR637T"
|
||||
RxName[RX.AR637TA] = "AR637TA"
|
||||
RxName[RX.FC6250HX] = "FC6250HX"
|
||||
RxName[RX.AR630] = "AR630"
|
||||
RxName[RX.AR8360T] = "AR8360T"
|
||||
RxName[RX.AR10360T] = "AR10360T"
|
||||
RxName[RX.AR631] = "AR631"
|
||||
|
||||
DSM_ReadTxModelData()
|
||||
|
||||
-- Load messages from external file (/DSMLIB/msg_en.txt)
|
||||
load_msg_from_file(MSG_FILE,10,Text,List_Text,List_Text_Img,RxName,Flight_Mode)
|
||||
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)
|
||||
@ -1411,36 +1475,30 @@ local function DSM_Init_Text(rxId)
|
||||
return " ("..(MODEL.TX_CH_TEXT[ch] or "--")..")"
|
||||
end
|
||||
|
||||
|
||||
List_Text[0x0001] = "Off"
|
||||
List_Text[0x0002] = "On"
|
||||
|
||||
-- Ihn/Act List Options
|
||||
List_Text[0x0003] = "Inh"
|
||||
List_Text[0x0004] = "Act"
|
||||
-- OVERRIDES for list of valid VALUES and channel names
|
||||
|
||||
-- Channel selection for SAFE MODE and GAINS on FC6250HX
|
||||
List_Text[0x000C] = "Inhibit?" --?
|
||||
-- List_Text[0x000C] = "Inhibit?" --?
|
||||
for i = 0, 7 do List_Text[0x000D + i] = "Ch"..(i+5) ..getTxChText(i+4) end -- Aux channels (Ch5 and Greater)
|
||||
|
||||
-- Servo Output values..
|
||||
local servoOutputValues = {0x0003,0x002D,0x002E,0x002F} --Inh (GAP), 5.5ms, 11ms, 22ms. Fixing L_m1 with 0..244 range!
|
||||
List_Text[0x002D] = "5.5ms"
|
||||
List_Text[0x002E] = "11ms"
|
||||
List_Text[0x002F] = "22ms"
|
||||
--List_Text[0x002D] = "5.5ms"
|
||||
--List_Text[0x002E] = "11ms"
|
||||
--List_Text[0x002F] = "22ms"
|
||||
|
||||
-- Gain Values
|
||||
local gainValues = {0x0032,0x0033,0x0034} -- 1X, 2X, 4X -- Fixing L_m1 with 0..244 range!
|
||||
List_Text[0x0032] = "1 X"
|
||||
List_Text[0x0033] = "2 X"
|
||||
List_Text[0x0034] = "4 X"
|
||||
--List_Text[0x0032] = "1 X"
|
||||
--List_Text[0x0033] = "2 X"
|
||||
--List_Text[0x0034] = "4 X"
|
||||
|
||||
-- List of Channels for Safe, Gains, Panic, except FC6250HX that uses other range (0x00C..0x015)
|
||||
-- the valid range Starts with GEAR if enabled (Thr,Ail,Ele,Rud are not valid, the RX reject them )
|
||||
-- Valid Values: Inhibit? (GAP), Gear,Aux1..Aux7,X-Plus-1..XPlus-8
|
||||
local channelValues = {0x0035,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049}
|
||||
|
||||
List_Text[0x0035] = "Inhibit?"
|
||||
--List_Text[0x0035] = "Inhibit?"
|
||||
for i = 0, 11 do List_Text[0x0036 + i] = "Ch"..(i+1) .. getTxChText(i) end -- Channels on AR637T
|
||||
|
||||
for i = 1, 8 do -- 41..49
|
||||
@ -1450,38 +1508,6 @@ local function DSM_Init_Text(rxId)
|
||||
-- ****No longer overrides of previous XPlus values, since using different array
|
||||
-- for List_Text values
|
||||
|
||||
Text[0x0040] = "Roll"
|
||||
Text[0x0041] = "Pitch"
|
||||
Text[0x0042] = "Yaw"
|
||||
Text[0x0043] = "Gain/c/b" -- FC6250HX, AR631
|
||||
Text[0x0045] = "Differential"
|
||||
Text[0x0046] = "Priority"
|
||||
Text[0x0049] = "Output Setup" -- FC6250HX, AR631
|
||||
--******
|
||||
|
||||
Text[0x004A] = "Failsafe"
|
||||
Text[0x004B] = "Main Menu"
|
||||
Text[0x004E] = "Position"
|
||||
|
||||
Text[0x0050] = "Outputs";
|
||||
|
||||
Text[0x0051] = "Output Channel 1"
|
||||
Text[0x0052] = "Output Channel 2"
|
||||
Text[0x0053] = "Output Channel 3"
|
||||
Text[0x0054] = "Output Channel 4"
|
||||
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
|
||||
@ -1491,278 +1517,30 @@ local function DSM_Init_Text(rxId)
|
||||
List_Values[0x0056]=servoOutputValues
|
||||
end
|
||||
|
||||
-- FailSafe Options
|
||||
--Text[0x005E]="Inhibit"
|
||||
List_Text[0x005F] = "Hold Last"
|
||||
List_Text[0x0060] = "Preset"
|
||||
--Text[0x0061]="Custom"
|
||||
|
||||
--FC6250HX
|
||||
Text[0x0071] = "Proportional"
|
||||
Text[0x0072] = "Integral"
|
||||
Text[0x0073] = "Derivate"
|
||||
|
||||
-- Flight mode channel selection
|
||||
Text[0x0078] = "FM Channel"
|
||||
--Text[0x0078] = "FM Channel"
|
||||
if (rxId ~= RX.FC6250HX) then List_Values[0x0078]=channelValues end --FC6250HX uses other range
|
||||
|
||||
Text[0x007F] = "Attitude Gain" -- AR636B
|
||||
Text[0x0080] = "Orientation"
|
||||
Text[0x0082] = "Heading"
|
||||
Text[0x0085] = "Frame Rate"
|
||||
Text[0x0086] = "System Setup"
|
||||
Text[0x0087] = "F-Mode Setup"
|
||||
Text[0x0088] = "Enabled F-Modes"
|
||||
|
||||
-- Gain channel selection
|
||||
Text[0x0089] = "Gain Channel"
|
||||
--Text[0x0089] = "Gain Channel"
|
||||
if (rxId ~= RX.FC6250HX) then List_Values[0x0089]=channelValues end --FC6250HX uses other range
|
||||
|
||||
-- Gain Sensitivity selection
|
||||
Text[0x008A] = "Gain Sensitivity/r"; List_Values[0x008A]=gainValues -- Right Alight, (L_M1 was wide open range 0->244)
|
||||
|
||||
Text[0x008B] = "Panic"
|
||||
Text[0x008E] = "Panic Delay"
|
||||
Text[0x0090] = "Apply"
|
||||
|
||||
Text[0x0091] = "Begin" -- FC6250HX: Callibration Menu -> Begin..Start, Complete, Done
|
||||
Text[0x0092] = "Start"
|
||||
Text[0x0093] = "Complete"
|
||||
Text[0x0094] = "Done"
|
||||
|
||||
Text[0x0097] = "Factory Reset"
|
||||
Text[0x0098] = "Factory Reset" -- FC6250HX: Title
|
||||
Text[0x0099] = "Advanced Setup"
|
||||
Text[0x009A] = "Capture Failsafe Positions"
|
||||
Text[0x009C] = "Custom Failsafe"
|
||||
|
||||
Text[0x009F] = "Save Settings" -- Save & Reboot RX
|
||||
|
||||
Text[0x00A5] = "First Time Setup"
|
||||
Text[0x00AA] = "Capture Gyro Gains"
|
||||
Text[0x00AD] = "Gain Channel Select"
|
||||
--Text[0x008A] = "Gain Sensitivity/r";
|
||||
List_Values[0x008A]=gainValues -- Right Alight, (L_M1 was wide open range 0->244)
|
||||
|
||||
-- Safe mode options, Ihnibit + this values
|
||||
local safeModeOptions = {0x0003,0x00B0,0x00B1} -- inh (gap), "Self-Level/Angle Dem, Envelope
|
||||
List_Text[0x00B0] = "Self-Level/Angle Dem"
|
||||
List_Text[0x00B1] = "Envelope"
|
||||
--List_Text[0x00B0] = "Self-Level/Angle Dem"
|
||||
--List_Text[0x00B1] = "Envelope"
|
||||
|
||||
-- Flight Modes List Options
|
||||
List_Text[0x00B5] = "Inhibit"
|
||||
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
|
||||
|
||||
Text[0x00C7] = "Calibrate Sensor"
|
||||
Text[0x00C8] = "Complete" -- FC6250HX calibration complete
|
||||
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] = "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
|
||||
Text[0x00D2] = "Panic Channel"
|
||||
--Text[0x00D2] = "Panic Channel"
|
||||
if (rxId ~= RX.FC6250HX) then List_Values[0x00D2]=channelValues end --FC6250HX uses other range
|
||||
|
||||
Text[0x00D3] = "Swashplate"
|
||||
Text[0x00D5] = "Agility"
|
||||
Text[0x00D8] = "Stop"
|
||||
Text[0x00DA] = "SAFE/c/b" --SubTitle
|
||||
Text[0x00DB] = "Stability"
|
||||
Text[0x00DC] = "Deg. per sec"
|
||||
Text[0x00DD] = "Tail rotor"
|
||||
Text[0x00DE] = "Setup"
|
||||
Text[0x00DF] = "AFR"
|
||||
Text[0x00E0] = "Collective"
|
||||
Text[0x00E1] = "Subtrim"
|
||||
Text[0x00E2] = "Phasing"
|
||||
Text[0x00E4] = "E-Ring"
|
||||
|
||||
Text[0x00E7] = "Left"
|
||||
Text[0x00E8] = "Right"
|
||||
|
||||
-- Gain Capture options
|
||||
List_Text[0x00F2] = "Fixed"
|
||||
List_Text[0x00F3] = "Adjustable"
|
||||
|
||||
Text[0x00F9] = "Gyro settings"
|
||||
Text[0x00FE] = "Stick Priority/c/b" --SubTitle
|
||||
|
||||
Text[0x0100] = "Make sure the model has been"
|
||||
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,"
|
||||
Text[0x0107] = "subtrim, or servo reversing changes"
|
||||
Text[0x0108] = "require running through initial"
|
||||
Text[0x0109] = "setup again."
|
||||
Text[0x010A] = "" -- empty??
|
||||
Text[0x010B] = "" -- empty??
|
||||
|
||||
Text[0x0190] = "Relearn Model/Servo Settings (TX->RX)"
|
||||
Text[0x019C] = "Enter Receiver Bind Mode"
|
||||
Text[0x01D7] = "SAFE Select Channel"
|
||||
Text[0x01DC] = "AS3X/c/b" -- Subtitle, Center+bold
|
||||
Text[0x01DD] = "AS3X Settings"
|
||||
Text[0x01DE] = "AS3X Gains"
|
||||
Text[0x01E0] = "Rate Gains/c/b" -- SubTitle, Center+bold
|
||||
Text[0x01E2] = "SAFE Settings"
|
||||
Text[0x01E3] = "SAFE Gains"
|
||||
Text[0x01E6] = "Attitude Trim/c/b" -- SubTitle, Center+bold
|
||||
Text[0x01E7] = "Envelope"
|
||||
Text[0x01E9] = "Roll Right"
|
||||
Text[0x01EA] = "Roll Left"
|
||||
Text[0x01EB] = "Pitch Down"
|
||||
Text[0x01EC] = "Pitch Up"
|
||||
Text[0x01EE] = "Throttle to Pitch"
|
||||
Text[0x01EF] = "Low Thr to Pitch/c/b" -- SubTitle, Center+bold
|
||||
Text[0x01F0] = "High Thr to Pitch/c/b" -- SubTitle, Center+bold
|
||||
Text[0x01F3] = "Threshold"
|
||||
Text[0x01F4] = "Angle"
|
||||
Text[0x01F6] = "Failsafe Angles/c/b" -- SubTitle, Center+bold
|
||||
|
||||
--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[0x01FC] = "Panic Flight Mode"
|
||||
Text[0x01FD] = "SAFE Failsafe FMode"
|
||||
Text[0x0208] = "Decay"
|
||||
Text[0x0209] = "Save to Backup"
|
||||
Text[0x020A] = "Restore from Backup"
|
||||
Text[0x020D] = "First Time SAFE Setup"
|
||||
|
||||
-- First time safe setup Page 3 :
|
||||
Text[0x020E] = "AS3X gains must be tuned"
|
||||
Text[0x020F] = "and active in SAFE Flight Modes"
|
||||
Text[0x0210] = "to help reduce wobble."
|
||||
Text[0x0211] = "" -- empty
|
||||
Text[0x0212] = "" -- empty
|
||||
Text[0x0213] = "" -- empty
|
||||
|
||||
-- AS3X orientation Setting menu (Level)
|
||||
Text[0x021A] = "Set the model level,"
|
||||
Text[0x021B] = "and press Continue."
|
||||
Text[0x021C] = "" -- empty??
|
||||
Text[0x021D] = "" -- empty??
|
||||
|
||||
-- AS3X orientation Setting menu (Nose down)
|
||||
Text[0x021F] = "Set the model on its nose,"
|
||||
Text[0x0220] = "and press Continue. If the"
|
||||
Text[0x0221] = "orientation on the next"
|
||||
Text[0x0222] = "screen is wrong go back"
|
||||
Text[0x0223] = "and try again."
|
||||
|
||||
Text[0x0224] = "Continue"
|
||||
Text[0x0226] = "Angle Limits/c/b"
|
||||
Text[0x0227] = "Other settings"
|
||||
Text[0x0229] = "Set Orientation Manually"
|
||||
|
||||
-- Factory Default Warning
|
||||
Text[0x022B] = "WARNING!"
|
||||
Text[0x022C] = "This will reset the"
|
||||
Text[0x022D] = "configuration to factory"
|
||||
Text[0x022E] = "defaults. This does not"
|
||||
Text[0x022F] = "affect the backup config."
|
||||
Text[0x0230] = "" -- empty??
|
||||
|
||||
-- Backup Warning
|
||||
Text[0x0231] = "This will overwrite the"
|
||||
Text[0x0232] = "backup memory with your"
|
||||
Text[0x0233] = "current configuartion."
|
||||
Text[0x0234] = "" -- blank line
|
||||
Text[0x0235] = "" -- blank line
|
||||
|
||||
-- Restore from Backup Warning
|
||||
Text[0x0236] = "This will overwrite the"
|
||||
Text[0x0237] = "current config with"
|
||||
Text[0x0238] = "that which is in"
|
||||
Text[0x0239] = "the backup memory."
|
||||
Text[0x023A] = "" -- blank line
|
||||
|
||||
-- Utilities Copy flight modes
|
||||
Text[0x023D] = "Copy Flight Mode Settings"
|
||||
Text[0x023E] = "Source Flight Mode"
|
||||
Text[0x023F] = "Target Flight Mode"
|
||||
|
||||
Text[0x0240] = "Utilities"
|
||||
|
||||
-- Gain Capture Page
|
||||
Text[0x024C] = "Gains will be captured on"
|
||||
Text[0x024D] = "Captured gains will be"
|
||||
Text[0x024E] = "Gains on"
|
||||
Text[0x024F] = "were captured and changed"
|
||||
Text[0x0250] = "from Adjustable to Fixed"
|
||||
|
||||
Text[0x0254] = "Postive = Up, Negative = Down"
|
||||
|
||||
--Utilities, Copy flight mode (Copy Confirmation, oveerriding FM)
|
||||
Text[0x0251] = "Are you sure you want to ovewrite the \"Target\""
|
||||
Text[0x0252] = "with the \"Source\" ? "
|
||||
Text[0x0253] = "" -- Blank
|
||||
|
||||
-- First time safe setup Page 1 (maybe ask to select Flight Mode cannel)
|
||||
Text[0x0255] = "Before setting up SAFE"
|
||||
Text[0x0256] = "a Flight Mode channel"
|
||||
Text[0x0257] = "most be configured."
|
||||
|
||||
--First time safe setup Page 2 (something related for flight mode)
|
||||
Text[0x025A] = "Select the desired flight mode"
|
||||
Text[0x025B] = "switch position to adjust settings"
|
||||
Text[0x025C] = "for each flight mode"
|
||||
Text[0x025D] = "" -- Blank
|
||||
Text[0x025E] = "" -- Blank
|
||||
|
||||
--Utilities, Copy flight mode (Confirm)
|
||||
Text[0x0259] = "YES"
|
||||
Text[0x0260] = "WARNING: \"Target\""
|
||||
Text[0x0261] = "flight mode will be overwritten"
|
||||
Text[0x0262] = "by \"Source\""
|
||||
|
||||
Text[0x0263] = "Fixed/Adjustable Gains /c/b"
|
||||
Text[0x0266] = "Heading Gain/c/b"
|
||||
Text[0x0267] = "Positive = Nose Up/Roll Right"
|
||||
Text[0x0268] = "Negative = Nose Down/Roll Left"
|
||||
Text[0x0269] = "SAFE - Throttle to Pitch"
|
||||
Text[0x026A] = "Use CAUTION for Yaw gain!/b" -- SubTitle
|
||||
|
||||
Text[0x8000] = "Flight Mode/c/b" --FC6250HX: 1=NORMAL 2= Stunt-1, 3=Stunt-2, 4=Hold
|
||||
Text[0x8001] = "Flight Mode/c/b" --AR63X family: WAS "Flight Mode 1".. This usually is a Flight Mode w value relative to 0 (AR631/AR637)
|
||||
Text[0x8002] = "Flight Mode/c/b" -- what RX does this show up??
|
||||
Text[0x8003] = "Flight Mode/c/b"
|
||||
--Text[0x01F8] = "Safe Mode";
|
||||
List_Values[0x01F8]=safeModeOptions
|
||||
end
|
||||
|
||||
-- Adjust the displayed value for Flight mode line as needed
|
||||
@ -1855,5 +1633,6 @@ Lib.Init = DSM_Init
|
||||
Lib.Init_Text = DSM_Init_Text
|
||||
|
||||
Lib.SetDSMChannelInfo = DSM_SetDSMChannelInfo
|
||||
Lib.Get_RxName = Get_RxName
|
||||
|
||||
return Lib
|
||||
|
@ -1337,8 +1337,8 @@ local function loadMenu(menuId)
|
||||
--L[#1 T=M VId=0x105E val=nil [0->0,2] Text="Other settings" MId=0x1000 ]
|
||||
|
||||
ctx.Menu = { MenuId = 0x1000, Text = "RX SIMULATION", PrevId = 0, NextId = 0, BackId = 0, TextId=0 }
|
||||
ctx.MenuLines[0] = { MenuId = 0x1000, Type = LINE_TYPE.MENU, Text = "AR630/631/637 (NEW)", ValId = 0x1001,TextId=0 }
|
||||
ctx.MenuLines[1] = { MenuId = 0x1000, Type = LINE_TYPE.MENU, Text = "AR630/631/637 (INITIALIZED)", ValId = 0x1002, TextId=0 }
|
||||
ctx.MenuLines[0] = { MenuId = 0x1000, Type = LINE_TYPE.MENU, Text = "AR631 (NEW)", ValId = 0x1001,TextId=0 }
|
||||
ctx.MenuLines[1] = { MenuId = 0x1000, Type = LINE_TYPE.MENU, Text = "AR631 (INITIALIZED)", ValId = 0x1002, TextId=0 }
|
||||
ctx.MenuLines[4] = { MenuId = 0x1000, Type = LINE_TYPE.MENU, Text = "FC6250HX", ValId = 0x1005, TextId=0 }
|
||||
|
||||
ctx.SelLine = 0
|
||||
@ -1346,25 +1346,25 @@ local function loadMenu(menuId)
|
||||
elseif (menuId==0x1001) then
|
||||
RX_Initialized = false
|
||||
ctx.RX.Id = dsmLib.RX.AR631
|
||||
ctx.RX.Name = "AR630/631/637-SIM"
|
||||
ctx.RX.Version = "2.38.5"
|
||||
dsmLib.Init_Text(ctx.RX.Id)
|
||||
ctx.RX.Name = dsmLib.Get_RxName(ctx.RX.Id)..' SIM'
|
||||
ctx.RX.Version = "2.38.5"
|
||||
|
||||
RX_loadMenu = AR631_loadMenu
|
||||
RX_loadMenu(0x01000)
|
||||
elseif (menuId==0x1002) then
|
||||
ctx.RX.Id = dsmLib.RX.AR631
|
||||
ctx.RX.Name = "AR630/631/637-SIM"
|
||||
ctx.RX.Version = "2.38.5"
|
||||
dsmLib.Init_Text(ctx.RX.Id)
|
||||
ctx.RX.Name = dsmLib.Get_RxName(ctx.RX.Id)..' SIM'
|
||||
ctx.RX.Version = "2.38.5"
|
||||
|
||||
RX_loadMenu = AR631_loadMenu
|
||||
RX_loadMenu(0x01000)
|
||||
elseif (menuId==0x1005) then
|
||||
ctx.RX.Id = dsmLib.RX.FC6250HX
|
||||
ctx.RX.Name = "FC6250HX-SIM"
|
||||
ctx.RX.Version = "5.6.255"
|
||||
dsmLib.Init_Text(ctx.RX.Id)
|
||||
ctx.RX.Name = dsmLib.Get_RxName(ctx.RX.Id)..' SIM'
|
||||
ctx.RX.Version = "5.6.255"
|
||||
|
||||
RX_loadMenu = FC6250HX_loadMenu
|
||||
RX_loadMenu(0x01000)
|
||||
@ -1380,7 +1380,7 @@ local function SIM_Send_Receive()
|
||||
|
||||
if ctx.Phase == PHASE.RX_VERSION then -- request RX version
|
||||
ctx.RX.Name = "SIMULATOR"
|
||||
ctx.RX.Version = "1.0.0"
|
||||
ctx.RX.Version = "0.54"
|
||||
ctx.Phase = PHASE.MENU_TITLE
|
||||
|
||||
ctx.Refresh_Display = true
|
||||
|
@ -24,7 +24,7 @@
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
local DEBUG_ON, SIMULATION_ON = ... -- Get DebugON from parameters
|
||||
local SETUP_LIB_VERSION = "0.53"
|
||||
local SETUP_LIB_VERSION = "0.54"
|
||||
|
||||
local DATA_PATH = "/MODELS/DSMDATA" -- Path to store model settings files
|
||||
local dsmLib = assert(loadScript("/SCRIPTS/TOOLS/DSMLIB/DsmFwPrgLib.lua"))(DEBUG_ON)
|
||||
@ -193,7 +193,7 @@ local function ST_PlaneWingInit(wingType)
|
||||
elseif (wingType==WING_TYPE.AIL_2_FLP_2) then
|
||||
MENU_DATA[MEMU_VAR.CH_L_AIL] = PORT.PORT6
|
||||
MENU_DATA[MEMU_VAR.CH_R_AIL] = PORT.PORT2
|
||||
MENU_DATA[MEMU_VAR.CH_L_FLP] = PORT.PORT5
|
||||
MENU_DATA[MEMU_VAR.CH_R_FLP] = PORT.PORT5
|
||||
MENU_DATA[MEMU_VAR.CH_L_FLP] = PORT.PORT7
|
||||
elseif (wingType==WING_TYPE.ELEVON_A) then
|
||||
MENU_DATA[MEMU_VAR.CH_L_AIL] = PORT.PORT2
|
||||
@ -787,7 +787,7 @@ local function ST_LoadMenu(menuId)
|
||||
ctx.MenuLines[4] = { Type = LINE_TYPE.LIST_MENU_NC, Text=leftFlapText, TextId = 0, ValId = MEMU_VAR.CH_L_FLP, Min=0, Max=9, Def=0, Val= leftFlap }
|
||||
end
|
||||
if (rightFlap~=nil) then
|
||||
ctx.MenuLines[5] = { Type = LINE_TYPE.LIST_MENU_NC, Text=rightFlapText, TextId = 0, ValId = MEMU_VAR.CH_L_FLP, Min=0, Max=9, Def=0, Val= leftFlap }
|
||||
ctx.MenuLines[5] = { Type = LINE_TYPE.LIST_MENU_NC, Text=rightFlapText, TextId = 0, ValId = MEMU_VAR.CH_R_FLP, Min=0, Max=9, Def=0, Val= rightFlap }
|
||||
end
|
||||
|
||||
ctx.SelLine = 1
|
||||
|
15
Lua_scripts/DSMLIB/MIN_msg_fwdp_en.txt
Normal file
15
Lua_scripts/DSMLIB/MIN_msg_fwdp_en.txt
Normal file
@ -0,0 +1,15 @@
|
||||
-- OVERRIDES Messges for MIN 128x64 screns
|
||||
-- FORMAT <LineType>|<Msg#>|<Text>
|
||||
-- Line Type: Text for Menus (T), List_Text Options (LT), List_Text_Image (LI), Flight Mode (FM), RX Name (RX)
|
||||
-- IMPORTANT: NO EMPTY LINES
|
||||
--
|
||||
T |0x0097|DONT USE: Factory Reset
|
||||
T |0x0098|DONT USE: Factory Reset
|
||||
T |0x00A5|DONT USE: First Time Setup
|
||||
T |0x00B0|Self-Lev/Ang Dem
|
||||
T |0x00CD|Level model & capt attitude
|
||||
T |0x0190|DONT USE: Relearn Servo Settings
|
||||
T |0x020D|DONT USE: First Time SAFE Setup
|
||||
T |0x0254|Pos = Up, Neg = Down
|
||||
T |0x0267|Pos = Nose Up/Roll Right
|
||||
T |0x0268|Neg = Nose Down/Roll Left
|
375
Lua_scripts/DSMLIB/msg_fwdp_en.txt
Normal file
375
Lua_scripts/DSMLIB/msg_fwdp_en.txt
Normal file
@ -0,0 +1,375 @@
|
||||
-- FORMAT <LineType>|<Msg#>|<Text>
|
||||
-- Line Type: Text for Menus (T), List_Text Options (LT), List_Text_Image (LI), Flight Mode (FM), RX Name (RX)
|
||||
-- NO EMPTY LINES
|
||||
-- Formmatting at end of line: /c=Center, /r=Right, /b=Bold, /m=menu
|
||||
LT|0x0001|Off
|
||||
LT|0x0002|On
|
||||
-- Ihn/Act List Options
|
||||
LT|0x0003|Inh
|
||||
LT|0x0004|Act
|
||||
--
|
||||
-- Channel selection for SAFE MODE and GAINS on FC6250HX
|
||||
LT|0x000C|Inhibit?
|
||||
LT|0x000D|Ch5
|
||||
LT|0x000E|Ch6
|
||||
LT|0x000F|Ch7
|
||||
LT|0x0010|Ch8
|
||||
LT|0x0011|Ch9
|
||||
LT|0x0012|Ch10
|
||||
LT|0x0013|Ch11
|
||||
LT|0x0014|Ch12
|
||||
--
|
||||
-- Servo Output values
|
||||
LT|0x002D|5.5ms
|
||||
LT|0x002E|11ms
|
||||
LT|0x002F|22ms
|
||||
--
|
||||
-- Gain Multiplier Values
|
||||
LT|0x0032|1 X
|
||||
LT|0x0033|2 X
|
||||
LT|0x0034|4 X
|
||||
--
|
||||
LT|0x0035|Inh?
|
||||
LT|0x0036|Thr
|
||||
LT|0x0037|Ail
|
||||
LT|0x0038|Ele
|
||||
LT|0x0039|Rud
|
||||
LT|0x003A|Ch5
|
||||
LT|0x003B|Ch6
|
||||
LT|0x003C|Ch7
|
||||
LT|0x003D|Ch8
|
||||
LT|0x003E|Ch9
|
||||
LT|0x003F|Ch10
|
||||
LT|0x0040|Ch11
|
||||
LT|0x0041|Ch12
|
||||
LT|0x0042|Ch13
|
||||
LT|0x0043|Ch14
|
||||
LT|0x0044|Ch15
|
||||
LT|0x0045|Ch16
|
||||
LT|0x0046|Ch17
|
||||
LT|0x0047|Ch18
|
||||
LT|0x0048|Ch19
|
||||
LT|0x0049|Ch20
|
||||
--
|
||||
T |0x0040|Roll
|
||||
T |0x0041|Pitch
|
||||
T |0x0042|Yaw
|
||||
T |0x0043|Gain/c/b
|
||||
T |0x0045|Differential
|
||||
T |0x0046|Priority
|
||||
T |0x0049|Output Setup
|
||||
T |0x004A|Failsafe
|
||||
T |0x004B|Main Menu
|
||||
T |0x004E|Position
|
||||
--
|
||||
T |0x0050|Outputs
|
||||
T |0x0051|Output Channel 1
|
||||
T |0x0052|Output Channel 2
|
||||
T |0x0053|Output Channel 3
|
||||
T |0x0054|Output Channel 4
|
||||
T |0x0055|Output Channel 5
|
||||
T |0x0056|Output Channel 6
|
||||
--
|
||||
-- FailSafe Options
|
||||
--LT|0x005E|Inhibit
|
||||
LT|0x005F|Hold Last
|
||||
LT|0x0060|Preset
|
||||
--LT|0x0061|Custom
|
||||
--
|
||||
T |0x0071|Proportional
|
||||
T |0x0072|Integral
|
||||
T |0x0073|Derivate
|
||||
--
|
||||
T |0x0078|FM Channel
|
||||
--
|
||||
T |0x0080|Orientation
|
||||
T |0x0082|Heading
|
||||
T |0x0085|Frame Rate
|
||||
T |0x0086|System Setup
|
||||
T |0x0087|F-Mode Setup
|
||||
T |0x0088|Enabled F-Modes
|
||||
T |0x0089|Gain Channel
|
||||
T |0x008A|Gain Sensitivity/r -- Right Align
|
||||
T |0x008B|Panic
|
||||
T |0x008E|Panic Delay
|
||||
--
|
||||
LT|0x008D|560hz
|
||||
--
|
||||
-- FC6250HX: Callibration Menu -> Begin..Start, Complete, Done
|
||||
T |0x0091|Begin
|
||||
T |0x0090|Apply
|
||||
T |0x0092|Start
|
||||
T |0x0093|Complete
|
||||
T |0x0094|Done
|
||||
--
|
||||
T |0x0097|Factory Reset
|
||||
T |0x0098|Factory Reset
|
||||
--
|
||||
T |0x0099|Advanced Setup
|
||||
T |0x009A|Capture Failsafe Positions
|
||||
T |0x009C|Custom Failsafe
|
||||
--
|
||||
T |0x009F|Save Settings -- Save & Reboot RX
|
||||
--
|
||||
T |0x00A5|First Time Setup
|
||||
T |0x00AA|Capture Gyro Gains
|
||||
T |0x00AD|Gain Channel Select
|
||||
T |0x00AF|Dynamic
|
||||
T |0x00B0|Self-Level/Angle Dem
|
||||
T |0x00B1|Envelope
|
||||
--
|
||||
-- Flight Modes List Options
|
||||
LT|0x00B5|Inhibit
|
||||
LT|0x00B6|FM1
|
||||
LT|0x00B7|FM2
|
||||
LT|0x00B8|FM3
|
||||
LT|0x00B9|FM4
|
||||
LT|0x00BA|FM5
|
||||
LT|0x00BB|FM6
|
||||
LT|0x00BC|FM7
|
||||
LT|0x00BD|FM8
|
||||
LT|0x00BE|FM9
|
||||
LT|0x00BF|FM10
|
||||
--
|
||||
T |0x00BE|Unknown_BE -- Used in Reset menu (0x0001) while the RX is rebooting
|
||||
--
|
||||
T |0x00C7|Calibrate Sensor
|
||||
T |0x00CA|SAFE/Panic Mode Setup
|
||||
--
|
||||
T |0x00CD|Level model and capture attitude/m -- SPECIAL MENU to itself who is not a comment
|
||||
--
|
||||
-- RX Orientations for AR631/AR637, Optionally attach an Image + Alt Text to display
|
||||
LT|0x00CB|Pos 1
|
||||
LI|0x00CB|rx_pos_1.png|Pilot View: RX Label Up, Pins Back
|
||||
LT|0x00CC|Pos 2
|
||||
LI|0x00CC|rx_pos_2.png|Pilot View: RX Label Left, Pins Back
|
||||
LT|0x00CD|Pos 3
|
||||
LI|0x00CD|rx_pos_3.png|Pilot View: RX Label Down, Pins Back
|
||||
LT|0x00CE|Pos 4
|
||||
LI|0x00CE|rx_pos_4.png|Pilot View: RX Label Right, Pins Back
|
||||
LT|0x00CF|Pos 5
|
||||
LI|0x00CF|rx_pos_5.png|Pilot View: RX Label UP, Pins to Front
|
||||
LT|0x00D0|Pos 6
|
||||
LI|0x00D0|rx_pos_6.png|Pilot View: RX Label Left, Pins Front
|
||||
LT|0x00D1|Pos 7
|
||||
LI|0x00D1|rx_pos_7.png|Pilot View: RX Label Down, Pins Front
|
||||
LT|0x00D2|Pos 8
|
||||
LI|0x00D2|rx_pos_8.png|Pilot View: RX Label Right, Pins Front
|
||||
LT|0x00D3|Pos 9
|
||||
LI|0x00D3|rx_pos_9.png|Pilot View: RX Label Up, Pins Left
|
||||
LT|0x00D4|Pos 10
|
||||
LI|0x00D4|rx_pos_10.png|Pilot View: RX Label Back, Pins Left
|
||||
LT|0x00D5|Pos 11
|
||||
LI|0x00D5|rx_pos_11.png|Pilot View: RX Label Down, Pins Left
|
||||
LT|0x00D6|Pos 12
|
||||
LI|0x00D6|rx_pos_12.png|Pilot View: RX Label Front, Pins Left
|
||||
LT|0x00D7|Pos 13
|
||||
LI|0x00D7|rx_pos_13.png|Pilot View: RX Label Up, Pins Right
|
||||
LT|0x00D8|Pos 14
|
||||
LI|0x00D8|rx_pos_14.png|Pilot View: RX Label Back, Pins Right
|
||||
LT|0x00D9|Pos 15
|
||||
LI|0x00D9|rx_pos_15.png|Pilot View: RX Label Down, Pins Right
|
||||
LT|0x00DA|Pos 16
|
||||
LI|0x00DA|rx_pos_16.png|Pilot View: RX Label Front, Pins Right
|
||||
LT|0x00DB|Pos 17
|
||||
LI|0x00DB|rx_pos_17.png|Pilot View: RX Label Back, Pins Down
|
||||
LT|0x00DC|Pos 18
|
||||
LI|0x00DC|rx_pos_18.png|Pilot View: RX Label Left, Pins Down
|
||||
LT|0x00DD|Pos 19
|
||||
LI|0x00DD|rx_pos_19.png|Pilot View: RX Label Front, Pins Down
|
||||
LT|0x00DE|Pos 20
|
||||
LI|0x00DE|rx_pos_20.png|Pilot View: RX Label Right, Pins Down
|
||||
LT|0x00DF|Pos 21
|
||||
LI|0x00DF|rx_pos_21.png|Pilot View: RX Label Back, Pins Up
|
||||
LT|0x00E0|Pos 22
|
||||
LI|0x00E0|rx_pos_22.png|Pilot View: RX Label Left, Pins Up
|
||||
LT|0x00E1|Pos 23
|
||||
LI|0x00E1|rx_pos_23.png|Pilot View: RX Label Front, Pins Up
|
||||
LT|0x00E2|Pos 24
|
||||
LI|0x00E2|rx_pos_24.png|Pilot View: RX Label Right, Pins Up
|
||||
LT|0x00E3|Pos Invalid
|
||||
LI|0x00E3|rx_pos_25.png|Cannot detect orientation of RX
|
||||
--
|
||||
T |0x00D1|Receiver will Reboot/b
|
||||
T |0x00D2|Panic Channel
|
||||
T |0x00D3|Swashplate
|
||||
T |0x00D5|Agility
|
||||
T |0x00D8|Stop
|
||||
T |0x00DA|SAFE/c/b -- Center + Bold
|
||||
T |0x00DB|Stability
|
||||
T |0x00DC|@ per sec
|
||||
T |0x00DD|Tail rotor
|
||||
T |0x00DE|Setup
|
||||
T |0x00DF|AFR
|
||||
T |0x00E0|Collective
|
||||
T |0x00E1|Subtrim
|
||||
T |0x00E2|Phasing
|
||||
T |0x00E4|E-Ring
|
||||
T |0x00E5|Swash Type
|
||||
T |0x00E6|Travel
|
||||
T |0x00E7|Left
|
||||
T |0x00E8|Right
|
||||
--
|
||||
LT|0x00F2|Fixed
|
||||
LT|0x00F3|Adjustable
|
||||
--
|
||||
T |0x00F6|Direction
|
||||
T |0x00F8|Settings -- ?? validate on a Spektrum radio
|
||||
T |0x00F9|Gyro settings
|
||||
T |0x00FE|Stick Priority/c/b
|
||||
--
|
||||
T |0x0100|Make sure the model has been
|
||||
T |0x0101|configured, including wing type,
|
||||
T |0x0102|reversing, travel, trimmed, etc.
|
||||
T |0x0103|before continuing setup.
|
||||
T |0x0104| -- Blank
|
||||
--
|
||||
T |0x0106|Any wing type, channel assignment,
|
||||
T |0x0107|subtrim, or servo reversing changes
|
||||
T |0x0108|require running through initial
|
||||
T |0x0109|setup again.
|
||||
T |0x010A| -- Blank
|
||||
--
|
||||
T |0x0190|Relearn Servo Settings
|
||||
T |0x019C|Enter Receiver Bind Mode
|
||||
T |0x01AA|Offset
|
||||
T |0x01D7|SAFE Select Channel
|
||||
T |0x01DC|AS3X/c/b -- Center + Bold
|
||||
T |0x01DD|AS3X Settings
|
||||
T |0x01DE|AS3X Gains
|
||||
T |0x01E0|Rate Gains/c/b
|
||||
T |0x01E2|SAFE Settings
|
||||
T |0x01E3|SAFE Gains
|
||||
T |0x01E6|Attitude Trim/c/b
|
||||
T |0x01E7|Envelope
|
||||
T |0x01E9|Roll Right
|
||||
T |0x01EA|Roll Left
|
||||
T |0x01EB|Pitch Down
|
||||
T |0x01EC|Pitch Up
|
||||
T |0x01EE|Thr to Pitch
|
||||
T |0x01EF|Low Thr to Pitch/c/b
|
||||
T |0x01F0|High Thr to Pitch/c/b
|
||||
T |0x01F3|Threshold
|
||||
T |0x01F4|Angle
|
||||
T |0x01F6|Failsafe Angles/c/b
|
||||
T |0x01F8|Safe Mode
|
||||
T |0x01F9|SAFE Select
|
||||
T |0x01FC|Panic F-Mode
|
||||
T |0x01FD|FailSafe Flight Mode -- Safe Flight Mode
|
||||
T |0x0201|Throttle
|
||||
T |0x0204|Hover
|
||||
T |0x0208|Decay
|
||||
T |0x0209|Save to Backup
|
||||
T |0x020A|Restore from Backup
|
||||
T |0x020D|First Time SAFE Setup
|
||||
--
|
||||
-- First time safe setup Page 3 :
|
||||
T |0x020E|AS3X gains must be tuned
|
||||
T |0x020F|and active in SAFE Flight Modes
|
||||
T |0x0210|to help reduce wobble.
|
||||
T |0x0211| -- Blank
|
||||
T |0x0212| -- Blank
|
||||
T |0x0213| -- Blank
|
||||
--
|
||||
-- AS3X orientation Setting menu (Level)
|
||||
T |0x021A|Set the model level,
|
||||
T |0x021B|and press Continue.
|
||||
T |0x021C| -- Blank
|
||||
T |0x021D| -- Blank
|
||||
--
|
||||
-- AS3X orientation Setting menu (Nose down)
|
||||
T |0x021F|Set the model on its nose,
|
||||
T |0x0220|and press Continue. If the
|
||||
T |0x0221|orientation on the next
|
||||
T |0x0222|screen is wrong go back
|
||||
T |0x0223|and try again.
|
||||
--
|
||||
T |0x0224|Continue
|
||||
T |0x0226|Angle Limits/c/b
|
||||
T |0x0227|Other settings
|
||||
T |0x0229|Set Orientation Manually
|
||||
--
|
||||
-- Factory Default Warning
|
||||
T |0x022B|WARNING!
|
||||
T |0x022C|This will reset the
|
||||
T |0x022D|configuration to factory
|
||||
T |0x022E|defaults. This does not
|
||||
T |0x022F|affect the backup config.
|
||||
T |0x0230| -- Blank
|
||||
--
|
||||
-- Backup Warning
|
||||
T |0x0231|This will overwrite the
|
||||
T |0x0232|backup memory with your
|
||||
T |0x0233|current configuartion.
|
||||
T |0x0234| -- Blank
|
||||
T |0x0235| -- Blank
|
||||
--
|
||||
-- Restore from Backup Warning
|
||||
T |0x0236|This will overwrite the
|
||||
T |0x0237|current config with
|
||||
T |0x0238|that which is in
|
||||
T |0x0239|the backup memory.
|
||||
T |0x023A| -- blank line
|
||||
--
|
||||
-- Utilities Copy flight modes
|
||||
T |0x023D|Copy F-Mode Settings
|
||||
T |0x023E|Source F-Mode
|
||||
T |0x023F|Target F-Mode
|
||||
--
|
||||
T |0x0240|Utilities
|
||||
--
|
||||
-- Gain Capture Page
|
||||
T |0x024C|Gains will be captured on
|
||||
T |0x024D|Captured gains will be
|
||||
T |0x024E|Gains on
|
||||
T |0x024F|were captured and changed
|
||||
T |0x0250|from Adjustable to Fixed
|
||||
--
|
||||
-- Utilities, Copy flight mode (Copy Confirmation, oveerriding FM)
|
||||
T |0x0251|Are you sure you want to ovewrite the "Target"
|
||||
T |0x0252|with the "Source" ?
|
||||
T |0x0253| -- Blank
|
||||
--
|
||||
T |0x0254|Postive = Up, Negative = Down
|
||||
--
|
||||
-- First time safe setup Page 1 (maybe ask to select Flight Mode cannel)
|
||||
T |0x0255|Before setting up SAFE
|
||||
T |0x0256|a Flight Mode channel
|
||||
T |0x0257|most be configured.
|
||||
--
|
||||
-- First time safe setup Page 2 (something related for flight mode)
|
||||
T |0x025A|Select the desired flight mode
|
||||
T |0x025B|switch position to adjust settings
|
||||
T |0x025C|for each flight mode
|
||||
T |0x025D| -- Blank
|
||||
T |0x025E| -- Blank
|
||||
--
|
||||
-- Utilities, Copy flight mode (Confirm)
|
||||
T |0x0259|YES
|
||||
T |0x0260|WARNING: "Target"
|
||||
T |0x0261|F-Mode will be overwritten
|
||||
T |0x0262|by "Source"
|
||||
--
|
||||
T |0x0263|Fixed/Adjustable Gains/c/b
|
||||
T |0x0266|Heading Gain/c/b
|
||||
T |0x0267|Positive = Nose Up/Roll Right
|
||||
T |0x0268|Negative = Nose Down/Roll Left
|
||||
T |0x0269|SAFE - Thr to Pitch
|
||||
T |0x026A|Use CAUTION for Yaw gain!/b
|
||||
--
|
||||
T |0x0300|No compatible DSM RX...
|
||||
T |0x0301|Waiting for RX to Restart
|
||||
--
|
||||
FM|0x8000|Flight Mode/c/b
|
||||
--
|
||||
RX|0x0001|AR636
|
||||
RX|0x0014|SPM4651T
|
||||
RX|0x0015|AR637T
|
||||
RX|0x0016|AR637TA
|
||||
RX|0x0018|FC6250HX
|
||||
RX|0x0019|AR630
|
||||
RX|0x001A|AR8360T
|
||||
RX|0x001B|AR8020T
|
||||
RX|0x001C|AR10360T
|
||||
RX|0x001E|AR631
|
||||
|
@ -4,7 +4,7 @@ Rewrite/Enhancements by: Francisco Arzu
|
||||
|
||||
Thanks to all the people volunteered to test it.
|
||||
|
||||
# Introduction (v0.53)
|
||||
# Introduction (v0.54)
|
||||
|
||||
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.
|
||||
|
||||
@ -13,15 +13,31 @@ Since EdgeTx/OpenTx doesn’t have an equivalent setup that is stored in the rad
|
||||
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.
|
||||
Make sure to manually create `/MODELS/DSMDATA` . The script will complain at startup if it does not exist. Here the script saves the Spektrun settings for each of your models.
|
||||
|
||||
/SCRIPTS/TOOLS/DsmFwdPrg_05_BW.lua -- black/white text only 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/DsmFwPrgSIMLib.lua -- Simulation of AR631, FC6250HX
|
||||
/SCRIPTS/TOOLS/DSMLIB/SetupLib.lua -- Model Setup Screens
|
||||
/SCRIPTS/TOOLS/DSMLIB/img --Images for RX orientations
|
||||
Uncompress the Zip file (ZIP version) into your local computer.
|
||||
In another window, open your TX SDCard and go to /SCRIPTS/TOOLS.
|
||||
|
||||
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)
|
||||
|
||||
Copy the entire DSMLIB folder.
|
||||
Copy the main script you want to use (Color or B&W).
|
||||
|
||||
|
||||
Your TX SDCard should looks like this:
|
||||
|
||||
/SCRIPTS/TOOLS
|
||||
DSM FwdPrg_05_BW.lua -- black/white text only
|
||||
DSM FwdPrg_05_Color.lua -- Color and touch radios
|
||||
DSM FwdPrg_05_MIN.lua -- `NEW!` Minimalistic version for radios with LOW memory (cannot setup new planes)
|
||||
|
||||
/SCRIPTS/TOOLS/DSMLIB/ -- (ALL CAPITALS) Libraries ane extra files
|
||||
DsmFwPrgLib.lua -- DSM Protocol Message and Menu engine
|
||||
DsmFwPrgSIMLib.lua -- Simulation of AR631, FC6250HX (For GUI development)
|
||||
SetupLib.lua -- Model Setup Screens
|
||||
msg_fwdp_en.txt -- `NEW!` Messages for forward programing externalized. To support other langs
|
||||
|
||||
/SCRIPTS/TOOLS/DSMLIB/img -- Images for RX orientations
|
||||
|
||||
Other Directories
|
||||
|
||||
@ -32,35 +48,37 @@ When upgrading from a previous version of this tool, delete your /SCRIPTS/TOOLS/
|
||||
|
||||
# Common Questions
|
||||
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>
|
||||
V0.53 and newer: The RX is listening to channel changes for this options. Configure the Switch to the channel, togling once the switch will select the channel on the menu field.
|
||||
|
||||
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 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. `Reversing a channel in my TX do not reverse the AS3X/SAFE reaction.` Correct, the channel 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.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 RX). This will load your current 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.54:
|
||||
1. Fix a problem in the Attitude Trim page (`Gyro Settings->System Setup->SAFE/Panic Setup->Attitude Trim`). It was not saving the values after exiting the menu. This is to change what SAFE considers "Level" flying.
|
||||
2. Wings 2-Ail 2-Flaps had a bug on the 2nd flap.
|
||||
3. New Minimalistic script (`DsmFwdPrg_05_MIN.lua`): For radios with very low memory (FrSky QX7, RM Zorro, others). It can only change existing settings, but does not have the Plane Setup menus to setup a completly new plane. In some radios, the very first time it runs (compile + run), it might give you a `not enouth memory` error.. try to run it again.
|
||||
4. External menu message file (DSMLIB/msg_en.txt and msg_MIN_es.txt). Intial work to do localization and different languages.
|
||||
|
||||
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.
|
||||
@ -73,17 +91,15 @@ V0.52:
|
||||
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
|
||||
# Tested Hardware
|
||||
- AR631/AR637xx
|
||||
- FC6250HX (Blade 230S V2 Helicopter)
|
||||
- AR636 (Blade 230S V1 Heli firmware 4.40)
|
||||
|
||||
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)
|
||||
- Radiomaster TX16S (All versions)
|
||||
- FrSky QX7, Radimaster Boxter (Minimalistic version)
|
||||
|
||||
# Flight mode/Gain channels
|
||||
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>
|
||||
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)
|
||||
|
||||
|
||||
# Messages Displayed in the GUI
|
||||
@ -91,6 +107,8 @@ This is because the RX doesn’t know that we are using more than 6 channels. T
|
||||
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.
|
||||
|
||||
|
||||
### Version 0.53 and older:
|
||||
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:
|
||||
@ -121,6 +139,12 @@ For example, if you get `Unknown_9D` in the GUI and your now that it should say
|
||||
|
||||
Text[0x009F] = "Save & Reset RX" -- TODO: Find the proper Spektrum text
|
||||
|
||||
### Version 0.54 and newer:
|
||||
The menu messages are stored in DSMLIB/msg_fwdp_en.txt (For english). Just add the message there. MIN_msg_fwdp_en.txt has shorter messages overrides for screens who are smaller (for minimalistic 128x64 version). The reference to the message file is at the file `/DSMLIB/DsmFwPrgLib.lua` if you want to change to use another language.
|
||||
|
||||
T |0x0097|Factory Reset
|
||||
LT|0x00B0|Self-Level/Angle Dem
|
||||
LT|0x00B1|Envelope
|
||||
|
||||
# LOG File
|
||||
|
||||
@ -143,30 +167,9 @@ 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
|
||||
|
||||
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]]
|
||||
0.280 MENU_LINES: SEND DSM_getFirstMenuLine(MenuId=0x1000)
|
||||
0.400 MENU_LINES: RESPONSE MenuUknownLine_0x05: LineNum=0 DATA=RX: 09 05 00 01 00 00 00 07 00 00 00 00 00 00 00 00
|
||||
0.460 MENU_UNKNOWN_LINES: CALL DSM_getNextUknownLine_0x05(LastLine=0)
|
||||
0.550 MENU_UNKNOWN_LINES: RESPONSE MenuUknownLine_0x05: LineNum=1 DATA=RX: 09 05 01 01 00 00 00 07 00 00 00 00 00 00 00 00
|
||||
0.600 MENU_UNKNOWN_LINES: CALL DSM_getNextUknownLine_0x05(LastLine=1)
|
||||
0.700 MENU_UNKNOWN_LINES: RESPONSE MenuUknownLine_0x05: LineNum=2 DATA=RX: 09 05 02 01 00 00 00 07 00 00 00 00 00 00 00 00
|
||||
0.760 MENU_UNKNOWN_LINES: CALL DSM_getNextUknownLine_0x05(LastLine=2)
|
||||
|
||||
|
||||
# Validation of data by the RX
|
||||
|
||||
<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:
|
||||
|
||||
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>
|
||||
The RX validates the data. if you change to an invalid channel or do a invalid number range, the RX will change it at the end of editing the field.
|
||||
|
||||
---
|
||||
# Version 0.53
|
||||
@ -202,15 +205,17 @@ If you go to the logs, you can see that the RX was correcting the value:
|
||||
|
||||
|
||||
### Some settings that can change (top of Lua file):
|
||||
SIMULATION_ON = false -- FALSE: use real communication to DSM RX (DEFAULT), TRUE: use a simulated version of RX
|
||||
SIMULATION_ON = false -- FALSE: hide similation menu (DEFAULT), TRUE: show RX simulation menu
|
||||
DEBUG_ON = 1 -- 0=NO DEBUG, 1=HIGH LEVEL 2=LOW LEVEL (Debug logged into the /LOGS/dsm_log.txt)
|
||||
DEBUG_ON_LCD = false -- Interactive Information on LCD of Menu data from RX
|
||||
USE_SPECKTRUM_COLORS = true -- true: Use spectrum colors, false: use theme colors (default on OpenTX, OpenTX handle colors different)
|
||||
|
||||
|
||||
### Known Problems:
|
||||
1. **Incorrect List Value Options:** Some Menu List line (`LINE_TYPE.LIST_MENU1` or `L_m1` in logs), the range (min/max) of valid values seems to be incorrect, but cannot see in the data how to fix it.
|
||||
Some of the valid values are not even sequential, very spread apart. There has to be a list of valid options somewhere. Currently fixed some by overriding the valid values in the script code (config for each field).
|
||||
1. **Incorrect List Value Options:** Some Menu List line (`LINE_TYPE.LIST_MENU1` or `L_m1` in logs), the range (min/max) of valid values seems to be incorrect, but the RX corrects the values.
|
||||
in the MINimalistic version, the RX is doing all the range validation, and will show invalid options temporarilly. In an Spektrum radio, it happens so fast, that you don't notice it, but in LUA scripts who are slower, you can see it in the screen.
|
||||
In the COLOR version, The code has hardcoded the valid ranges to avoid this problem.
|
||||
|
||||
|
||||
|
||||
2. Glider/Heli/Drone wing types not ready.
|
||||
|
||||
|
@ -579,13 +579,13 @@ local function drawTextGen(event)
|
||||
if multiBuffer( 4 ) == I2C_TEXT_GEN then -- Specktrum Telemetry ID of data received
|
||||
local instanceNo = multiBuffer( 5 )
|
||||
local lineNo = multiBuffer( 6 )
|
||||
local ch_array = {}
|
||||
local line = ""
|
||||
for i=0,13 do
|
||||
ch_array[i] = string.char(multiBuffer( 7 + i ))
|
||||
line = line .. string.char(multiBuffer( 7 + i ))
|
||||
end
|
||||
|
||||
multiBuffer( 4, 0 ) -- Clear Semaphore, to notify that we fully process the current message
|
||||
lineText[lineNo]=table.concat(ch_array,nil,0) -- Concatenate all characters to create message
|
||||
lineText[lineNo]=line
|
||||
end
|
||||
|
||||
lcd.clear()
|
||||
|
@ -355,8 +355,8 @@ local function drawESCStatus(event)
|
||||
ESC_Status[1] = getValue("Erpm") -- RPM
|
||||
ESC_Status[2] = doFloat(getValue("EVIN")) -- Volts
|
||||
ESC_Status[3] = doFloat(getValue("ECUR")) -- Current
|
||||
ESC_Status[4] = doFloat(getValue("EOUT"))*10 -- % Output
|
||||
ESC_Status[5] = doFloat(getValue("ETHR"))*10 -- Throttle % (EOUT)
|
||||
ESC_Status[4] = doFloat(getValue("EOUT")) -- % Output
|
||||
ESC_Status[5] = doFloat(getValue("ETHR")) -- Throttle % (EOUT)
|
||||
ESC_Status[6] = getValue("TFET") -- Temp FET
|
||||
|
||||
ESC_Status[7] = doFloat(getValue("VBEC")) -- Volts BEC
|
||||
@ -497,13 +497,14 @@ local function drawTextGen(event)
|
||||
if multiBuffer( 4 ) == I2C_TEXT_GEN then -- Specktrum Telemetry ID of data received
|
||||
local instanceNo = multiBuffer( 5 )
|
||||
local lineNo = multiBuffer( 6 )
|
||||
local ch_array = {}
|
||||
|
||||
local line = ""
|
||||
for i=0,13 do
|
||||
ch_array[i] = string.char(multiBuffer( 7 + i ))
|
||||
line = line .. string.char(multiBuffer( 7 + i ))
|
||||
end
|
||||
|
||||
multiBuffer( 4, 0 ) -- Clear Semaphore, to notify that we fully process the current message
|
||||
lineText[lineNo]=table.concat(ch_array,nil,0) -- Concatenate all characters to create message
|
||||
lineText[lineNo]=line
|
||||
end
|
||||
|
||||
lcd.clear()
|
||||
|
Loading…
x
Reference in New Issue
Block a user