diff --git a/Lua_scripts/DSM FwdPrg_05_BW.lua b/Lua_scripts/DSM FwdPrg_05_BW.lua index a7fed61..2075eb2 100644 --- a/Lua_scripts/DSM FwdPrg_05_BW.lua +++ b/Lua_scripts/DSM FwdPrg_05_BW.lua @@ -156,7 +156,7 @@ local function GUI_Display_Line_Value(lineNum, line, value, selected, editing) ---------- NAME Part local header = line.Text -- ONLY do this for Flight Mode (Right Align or Centered) - if (dsmLib.isFlightModeText(line.TextId)) then + if (dsmLib.isFlightModeLine(line)) then -- Display Header + Value together header = dsmLib.GetFlightModeValue(line.TextId,header,value) @@ -180,9 +180,8 @@ local function GUI_Display_Line_Value(lineNum, line, value, selected, editing) lcd.drawText(x, y, header, bold + TEXT_SIZE) -- display Line Header --------- VALUE PART, Skip for Flight Mode since already show the value - if not dsmLib.isFlightModeText(line.TextId) then + if not dsmLib.isFlightModeLine(line) then local attrib = 0 - value = value .. (line.Format or "") -- Append % if needed if selected then attrib = INVERS @@ -192,6 +191,7 @@ local function GUI_Display_Line_Value(lineNum, line, value, selected, editing) end end + value = value .. " " .. (line.Format or "") -- Append % if needed lcd.drawText(LCD_X_LINE_VALUE,y, value, attrib + TEXT_SIZE) -- display value end @@ -307,10 +307,9 @@ local function GUI_HandleEvent(event, touchState) else if ctx.isEditing() then -- Editing a Line, need to restore original value ctx.MenuLines[ctx.EditLine].Val = originalValue - dsmLib.ChangePhase(PHASE.VALUE_CHANGE_END) -- Update+Validate value in RX - ctx.EditLine = nil -- Exit Edit Mode (By clearing the line editing) + dsmLib.Value_Write_Validate(menuLines[ctx.EditLine]) else - dsmLib.ChangePhase(PHASE.EXIT) + dsmLib.ChangePhase(PHASE.EXIT) -- Exit end end return @@ -372,8 +371,7 @@ local function GUI_HandleEvent(event, touchState) -- Editing a Line???? if ctx.isEditing() then -- Change the Value and exit edit - ctx.EditLine = nil - dsmLib.ChangePhase(PHASE.VALUE_CHANGE_END) + dsmLib.Value_Write_Validate(menuLines[ctx.SelLine]) else -- enter Edit the current line ctx.EditLine = ctx.SelLine diff --git a/Lua_scripts/DSM FwdPrg_05_Color.lua b/Lua_scripts/DSM FwdPrg_05_Color.lua index b20db2e..d3f6ce1 100644 --- a/Lua_scripts/DSM FwdPrg_05_Color.lua +++ b/Lua_scripts/DSM FwdPrg_05_Color.lua @@ -146,7 +146,7 @@ end -------------------------------------------------------------------------------------------------------- -- Display Text inside a Rectangle. Inv: true means solid rectangle, false=only perimeter -local function GUI_Display_Boxed_Text(lineNum,x,y,w,h,text,inv) +local function GUI_Display_Boxed_Text(lineNum,x,y,w,h,text,inv, isNumber) local ctx = DSM_Context local txtColor = GUI_GetTextColor(lineNum) local frameColor = GUI_GetFrameColor(lineNum) @@ -159,13 +159,17 @@ local function GUI_Display_Boxed_Text(lineNum,x,y,w,h,text,inv) else lcd.drawRectangle(x-5, y-2, w, h, frameColor) end - lcd.drawText(x , y, text, txtColor) - + if (isNumber) then + print("DRAW NUMBER") + lcd.drawNumber(x+w-10 , y, text, txtColor + RIGHT) + else + lcd.drawText(x , y, text, txtColor) + end end ------ Display Pre/Next/Back buttons local function GUI_Diplay_Button(x,y,w,h,text,selected) - GUI_Display_Boxed_Text(-1,x,y,w,h,text,selected) + GUI_Display_Boxed_Text(-1,x,y,w,h,text,selected, false) end ------ Display MENU type of lines (Navigation, SubHeaders, and plain text comments) @@ -178,7 +182,7 @@ local function GUI_Display_Line_Menu(lineNum,line,selected) local x = LCD_X_LINE_MENU if dsmLib.isSelectableLine(line) then -- Draw Selectable Menus in Boxes - GUI_Display_Boxed_Text(lineNum,x, y, LCD_W_LINE_MENU, LCD_Y_LINE_HEIGHT, line.Text,selected) + GUI_Display_Boxed_Text(lineNum,x, y, LCD_W_LINE_MENU, LCD_Y_LINE_HEIGHT, line.Text,selected, false) GUI_addTouchButton(x, y, LCD_W_LINE_MENU, LCD_Y_LINE_HEIGHT,lineNum) else -- Non Selectable Menu Lines, plain text @@ -206,14 +210,10 @@ local function GUI_Display_Line_Value(lineNum, line, value, selected, editing) local y = LCD_Y_LINE_START+(LCD_Y_LINE_HEIGHT*lineNum) local x = LCD_X_LINE_TITLE - --if (editing) then -- Any Special color/effect when editing?? - -- value = "["..value .. "]" - --end - ---------- NAME Part local header = line.Text -- ONLY do this for Flight Mode (Right Align or Centered) - if (dsmLib.isFlightModeText(line.TextId)) then + if (dsmLib.isFlightModeLine(line)) then -- Display Header + Value together header = dsmLib.GetFlightModeValue(line.TextId,header,value) @@ -235,14 +235,17 @@ local function GUI_Display_Line_Value(lineNum, line, value, selected, editing) lcd.drawText(x, y, header, txtColor + bold) -- display Line Header --------- VALUE PART, Skip for Flight Mode since already show the value - if not dsmLib.isFlightModeText(line.TextId) then - value = value .. (line.Format or "") -- Append % if needed - + if not dsmLib.isFlightModeLine(line) then if dsmLib.isSelectableLine(line) then + --if (editing) then -- Any Special color/effect when editing?? + -- value = "["..value .. "]" + --end -- Can select/edit value, Box it - local tw = my_lcd_sizeText(value)+10 -- Width of the Text in the lcd - GUI_Display_Boxed_Text(lineNum,LCD_X_LINE_VALUE,y,tw,LCD_Y_LINE_HEIGHT,value,selected) + local tw = math.max(my_lcd_sizeText(value)+10,45) -- Width of the Text in the lcd + GUI_Display_Boxed_Text(lineNum,LCD_X_LINE_VALUE,y,tw,LCD_Y_LINE_HEIGHT,value,selected, not dsmLib.isListLine(line)) GUI_addTouchButton(LCD_X_LINE_VALUE,y,tw,LCD_Y_LINE_HEIGHT,lineNum) + + lcd.drawText(LCD_X_LINE_VALUE+tw+5, y, (line.Format or ""), txtColor + bold) else -- Not Editable, Plain Text lcd.drawText(LCD_X_LINE_VALUE, y, value, txtColor) end @@ -494,9 +497,9 @@ local function GUI_HandleEvent(event, touchState) dsmLib.ReleaseConnection() -- Just Exit the Script else if ctx.isEditing() then -- Editing a Line, need to restore original value - ctx.MenuLines[ctx.EditLine].Val = originalValue - dsmLib.ChangePhase(PHASE.VALUE_CHANGE_END) -- Update + Validate value in RX - ctx.EditLine = nil -- Exit Edit Mode (By clearing the line editing) + local line = ctx.MenuLines[ctx.EditLine] + line.Val = originalValue + dsmLib.Value_Write_Validate(line) else dsmLib.ChangePhase(PHASE.EXIT) end @@ -558,8 +561,7 @@ local function GUI_HandleEvent(event, touchState) end else -- Enter on a Value if ctx.isEditing() then -- already editing a Line???? - ctx.EditLine = nil -- Exit Edit Mode (By clearing the line editing) - dsmLib.ChangePhase(PHASE.VALUE_CHANGE_END) -- Request change the value on RX + dsmLib.Value_Write_Validate(menuLines[ctx.SelLine]) else -- Edit the current value ctx.EditLine = ctx.SelLine originalValue = menuLines[ctx.SelLine].Val diff --git a/Lua_scripts/DSMLIB/DsmFwPrgLib.lua b/Lua_scripts/DSMLIB/DsmFwPrgLib.lua index eb2f53b..a5bcac9 100644 --- a/Lua_scripts/DSMLIB/DsmFwPrgLib.lua +++ b/Lua_scripts/DSMLIB/DsmFwPrgLib.lua @@ -81,7 +81,7 @@ local LINE_TYPE = { } local DISP_ATTR = { - BOLD = 0x01, RIGHT=0x02, CENTER=0x04, PERCENT = 0x10 + BOLD = 0x01, RIGHT=0x02, CENTER=0x04, PERCENT = 0x10, DEGREES=0x20, FORCED_MENU = 0x40 } local DSM_Context = { @@ -160,18 +160,25 @@ end ------------- Line Type helper functions ------------------------------------------------------------------ +-- Check if the text are Flight modes, who will be treated different for Display +local function isFlightModeLine(line) + return (line.TextId >= 0x8000 and line.TextId <= 0x8003) +end + local function isSelectableLine(line) -- is the display line Selectable?? -- values who are not selectable - if (line.Type == 0 or line.Type == LINE_TYPE.VALUE_NOCHANGING) then return false end -- No Changing Value - if (line.Type == LINE_TYPE.MENU and line.ValId == line.MenuId) then return false end -- Menu that navigates to Itself? + if (line.Type == 0) then return false end -- Empty Line + if (line.Type == LINE_TYPE.MENU and line.ValId == line.MenuId and bit32.band(line.TextAttr, DISP_ATTR.FORCED_MENU)==0) then return false end -- Menu that navigates to Itself? if (line.Min==0 and line.Max==0 and line.Def==0) then return false end -- Values with no Range are only for display + if (line.Type == LINE_TYPE.VALUE_NOCHANGING and isFlightModeLine(line)) then return false end -- Flight mode is not Selectable return true end local function isEditableLine(line) -- is the display line editable?? -- values who are not editable - if (line.Type == 0 or line.Type == LINE_TYPE.VALUE_NOCHANGING or line.Type == LINE_TYPE.MENU) then return false end + if (line.Type == 0 or line.Type == LINE_TYPE.MENU) then return false end -- Menus are not editable if (line.Min==0 and line.Max==0 and line.Def==0) then return false end -- Values with no Range are only for display + if (line.Type == LINE_TYPE.VALUE_NOCHANGING and isFlightModeLine(line)) then return false end -- Flight mode is not Editable -- any other is Editable return true end @@ -194,7 +201,12 @@ end local function isNumberValueLine(line) -- is it a number ?? if (isListLine(line) or line.Type == LINE_TYPE.MENU or line.Type == 0) then return false - else return false end + else return true end +end + +local function isIncrementalValueUpdate(line) + if (line.Type == LINE_TYPE.LIST_MENU0 or line.Type == LINE_TYPE.VALUE_NOCHANGING) then return false end + return true end ------------------------------------------------------------------------------------------------------------ @@ -245,7 +257,7 @@ end local function lineType2String(index) local out = LineTypeText[index] - return out or ("LT_" .. string.format("%X", index)) + return out or ("LT_" .. string.format("%X", index or 0xFF)) end local function lineValue2String(l) @@ -369,6 +381,11 @@ local function ExtractDisplayAttr(text1, attr) attr = bit32.bor(attr, DISP_ATTR.BOLD) end + text, pos = string.gsub(text, "/M", "") + if (pos>0) then -- FORCED MENU Button + attr = bit32.bor(attr, DISP_ATTR.FORCED_MENU) + end + return text, attr end @@ -397,10 +414,13 @@ local function DSM_MenuLinePostProcessing(line) line.Max = line.Max - line.Min -- normalize max index line.Min = 0 -- min index else -- default to numerical value - if isPercentValueLine(line) then + if isPercentValueLine(line) or isPercentValueLineByMinMax(line) then -- either explicit Percent or NO-Change value, but range is %Percent - line.Format =" %" + line.Format ="%" line.TextAttr = bit32.bor(line.TextAttr,DISP_ATTR.PERCENT) + elseif (line.Type == LINE_TYPE.VALUE_DEGREES) then + line.Format ="o" + line.TextAttr = bit32.bor(line.TextAttr,DISP_ATTR.DEGREES) end end @@ -502,11 +522,9 @@ local function DSM_Value_Add(line, inc) end end - if (origVal~=line.Val) then - if line.Type ~= LINE_TYPE.LIST_MENU0 then -- Listof channels only change on the Screen until is Done - -- Update RX value on every change - DSM_ChangePhase(PHASE.VALUE_CHANGING) - end + if (origVal~=line.Val and isIncrementalValueUpdate(line)) then + -- Update RX value on every change + DSM_ChangePhase(PHASE.VALUE_CHANGING) end end @@ -515,14 +533,18 @@ local function DSM_Value_Default(line) if (DEBUG_ON) then LOG_write("%3.3f %s: DSM_Value_Default(%s)\n", getElapsedTime(), phase2String(DSM_Context.Phase), menuLine2String(line)) end line.Val = line.Def - if (origVal~=line.Val) then - if line.Type ~= LINE_TYPE.LIST_MENU0 then -- Listof channels only change on the Screen until is Done - -- Update RX value on every change - DSM_ChangePhase(PHASE.VALUE_CHANGING) - end + if (origVal~=line.Val and isIncrementalValueUpdate(line)) then + -- Update RX value on every change + DSM_ChangePhase(PHASE.VALUE_CHANGING) end end +local function DSM_Value_Write_Validate(line) + if (DEBUG_ON) then LOG_write("%3.3f %s: DSM_Value_Write_Validate(%s)\n", getElapsedTime(), phase2String(DSM_Context.Phase), menuLine2String(line)) end + DSM_ChangePhase(PHASE.VALUE_CHANGE_END) -- Update + Validate value in RX + DSM_Context.EditLine = nil -- Exit Edit Mode (By clearing the line editing) +end + local function DSM_GotoMenu(menuId, lastSelectedLine) if (DEBUG_ON) then LOG_write("%3.3f %s: DSM_GotoMenu(0x%X,LastSelectedLine=%d)\n", getElapsedTime(), phase2String(DSM_Context.Phase), menuId, lastSelectedLine) end DSM_Context.Menu.MenuId = menuId @@ -1063,6 +1085,8 @@ local function DSM_Init_Text(rxId) -- Text allightment: /c = CENTER, /r = RIGHT -- Text effects: /b = BOLD -- Text formatting: /p = PERCENT numbers (forced if not in Line Type=PERCENT) + -- Navigaton: /M = Force to be a Menu button, when a menu navigates to itself, + -- is usually a message line.. but sometimes, we want to navigate to the same page to refresh values -- array List_Values: -- For some Menu LIST VALUES, special Lines of type:LIST_MENU1, the valod options seems not @@ -1072,9 +1096,14 @@ local function DSM_Init_Text(rxId) -- usually is Ihnibit + range of contiguos values, but cant seems to find in the RX data receive the values -- to do it automatically - -- Om/Off List Options - List_Text[0x0001] = "On" - List_Text[0x0002] = "Off" + -- On/Off List Options (TODO: i think they are reversed?? 0x0001 is OFF ) + List_Text[0x0001] = "On (might be reversed, check)" + List_Text[0x0002] = "Off (might be reversed, check)" + + if (rxId == RX.FC6250HX) then -- For sure in the Blade FC6250HX they are reversed, override + List_Text[0x0001] = "Off" + List_Text[0x0002] = "On" + end -- Ihn/Act List Options List_Text[0x0003] = "Inh" @@ -1219,7 +1248,7 @@ local function DSM_Init_Text(rxId) Text[0x00C7] = "Calibrate Sensor" Text[0x00C8] = "Complete" -- FC6250HX calibration complete Text[0x00CA] = "SAFE/Panic Mode Setup" - Text[0x00CD] = "Level model and capture attiude/c"; -- Different from List_Text + Text[0x00CD] = "Level model and capture attiude/M"; -- Different from List_Text , and force it to be a menu button -- RX Orientations for AR631/AR637 (on the Heli Receiver is different, see below) -- Optionally attach an Image to display @@ -1249,7 +1278,7 @@ local function DSM_Init_Text(rxId) List_Text[0x00E2] = "RX Pos 24"; List_Text_Img[0x00E2] = "rx_pos_24.png|Pilot View: RX Label Right, Pins Up" List_Text[0x00E3] = "RX Pos Invalid"; List_Text_Img[0x00E3] = "rx_pos_25.png|Cannot detect orientation of RX" - Text[0x00D1] = "?? Unknown_D1" -- TODO: Find the Spektrum Value (Orientation Save&Reset final page AR631) + Text[0x00D1] = "Unknown_D1" -- TODO: Find the Spektrum Value (Orientation Save&Reset final page AR631) --FC6250HX Text[0x00D2] = "Panic Channel" if (rxId ~= RX.FC6250HX) then List_Values[0x00D2]=channelValues end --FC6250HX uses other range @@ -1259,7 +1288,7 @@ local function DSM_Init_Text(rxId) Text[0x00D8] = "Stop" Text[0x00DA] = "SAFE" Text[0x00DB] = "Stability" - Text[0x00DC] = "@ per sec" + Text[0x00DC] = "Deg. per sec" Text[0x00DD] = "Tail rotor" Text[0x00DE] = "Setup" Text[0x00DF] = "AFR" @@ -1291,7 +1320,7 @@ local function DSM_Init_Text(rxId) Text[0x010A] = "" -- empty?? Text[0x010B] = "" -- empty?? - Text[0x0190] = "Relearn Servo Settings" + Text[0x0190] = "DONT USE! Relearn Servo Settings" Text[0x019C] = "Enter Receiver Bind Mode" Text[0x01D7] = "SAFE Select Channel" Text[0x01DC] = "AS3X/c/b" -- Subtitle, Center+bold @@ -1384,10 +1413,10 @@ local function DSM_Init_Text(rxId) Text[0x0254] = "Postive = Up, Negative = Down" - --Utilities, Copy flight mode (Copy Confirmation, oveerriding FM) TODO:Check with real Spektrum radio. - Text[0x0251] = "WARNING: \"Target\" IN USE" - Text[0x0252] = "flight mode will be overwritten" - Text[0x0253] = "by \"Source\"" + --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" @@ -1401,8 +1430,8 @@ local function DSM_Init_Text(rxId) Text[0x025D] = "" -- Blank Text[0x025E] = "" -- Blank - --Utilities, Copy flight mode - Text[0x0259] = "Copy" --- TODO: Check Specktrum..Just guessing here.. + --Utilities, Copy flight mode (Confirm) + Text[0x0259] = "YES" Text[0x0260] = "WARNING: \"Target\"" Text[0x0261] = "flight mode will be overwritten" Text[0x0262] = "by \"Source\"" @@ -1420,25 +1449,25 @@ local function DSM_Init_Text(rxId) Text[0x8003] = "Flight Mode 3/c/b" end --- Check if the text are Flight modes, who will be treated different for Display -local function isFlightModeText(textId) - return (textId >= 0x8000 and textId <= 0x8003) -end - -- Adjust the displayed value for Flight mode as needed local function GetFlightModeValue(textId, header, value) local out = value - if (DSM_Context.RX.Id == RX.FC6250HX) then - -- Helicopter Flights modes - if (value==1) then out = header .. " Normal" - elseif (value==2) then out = header .. " Stunt 1" - elseif (value==3) then out = header .. " Stunt 2" - elseif (value==4) then out = header .. " Hold" + if (textId == 0x8000) then + if (DSM_Context.RX.Id == RX.FC6250HX) then + -- Helicopter Flights modes + if (value==1) then out = header .. " 1 / Normal" + elseif (value==2) then out = header .. " 2 / Stunt 1" + elseif (value==3) then out = header .. " 3 / Stunt 2" + elseif (value==4) then out = header .. " 4 / Hold" + else + out = header .. " " .. value + end else + -- No adjustment needed out = header .. " " .. value end - elseif (DSM_Context.RX.Id == RX.AR631 or DSM_Context.RX.Id == RX.AR637T or DSM_Context.RX.Id == RX.AR637TA) then + elseif (textId == 0x8001) then -- AR632/637 -- Seems that we really have to add +1 to the value, so Flight Mode 0 is Really Flight Mode 1 out = header .. " " .. (value + 1) else @@ -1485,7 +1514,7 @@ Lib.isPercentValueLine = isPercentValueLine Lib.isPercentValueLineByMinMax = isPercentValueLineByMinMax Lib.isNumberValueLine = isNumberValueLine Lib.isDisplayAttr = isDisplayAttr -Lib.isFlightModeText = isFlightModeText +Lib.isFlightModeLine = isFlightModeLine Lib.GetFlightModeValue = GetFlightModeValue Lib.StartConnection = DSM_StartConnection @@ -1495,6 +1524,7 @@ Lib.MenuPostProcessing = DSM_MenuPostProcessing Lib.MenuLinePostProcessing = DSM_MenuLinePostProcessing Lib.Value_Add = DSM_Value_Add Lib.Value_Default = DSM_Value_Default +Lib.Value_Write_Validate = DSM_Value_Write_Validate Lib.GotoMenu = DSM_GotoMenu Lib.MoveSelectionLine = DSM_MoveSelectionLine Lib.Send_Receive = DSM_Send_Receive diff --git a/Lua_scripts/DSMLIB/DsmFwPrgSIMLib.lua b/Lua_scripts/DSMLIB/DsmFwPrgSIMLib.lua index 8a30c21..8141939 100644 --- a/Lua_scripts/DSMLIB/DsmFwPrgSIMLib.lua +++ b/Lua_scripts/DSMLIB/DsmFwPrgSIMLib.lua @@ -148,8 +148,8 @@ local function AR631_loadMenu(menuId) ctx.MenuLines[0] = { Type = LINE_TYPE.VALUE_NOCHANGING, TextId = 0x8001, ValId = 0x1000, Min=0, Max=10, Def=0, Val=1 } ctx.MenuLines[2] = { Type = LINE_TYPE.MENU, TextId = 0x1E0, ValId = 0x1012 } ctx.MenuLines[3] = { Type = LINE_TYPE.VALUE_NOCHANGING, TextId = 0x40, ValId = 0x1004, Min=0, Max=100, Def=40, Val=40 } - ctx.MenuLines[4] = { Type = LINE_TYPE.VALUE_PERCENT, TextId = 0x41, ValId = 0x1005, Min=0, Max=100, Def=50, Val=50 } - ctx.MenuLines[5] = { Type = LINE_TYPE.VALUE_PERCENT, TextId = 0x42, ValId = 0x1006, Min=0, Max=100, Def=60, Val=60 } + ctx.MenuLines[4] = { Type = LINE_TYPE.VALUE_NOCHANGING, TextId = 0x41, ValId = 0x1005, Min=0, Max=100, Def=50, Val=50 } + ctx.MenuLines[5] = { Type = LINE_TYPE.VALUE_NOCHANGING, TextId = 0x42, ValId = 0x1006, Min=0, Max=100, Def=60, Val=60 } ctx.SelLine = 3 lastGoodMenu = menuId @@ -165,8 +165,8 @@ local function AR631_loadMenu(menuId) ctx.MenuLines[0] = { Type = LINE_TYPE.VALUE_NOCHANGING, TextId = 0x8001, ValId = 0x1000, Min=0, Max=10, Def=0, Val=1 } ctx.MenuLines[2] = { Type = LINE_TYPE.MENU, TextId = 0xFE, ValId = 0x1013 } ctx.MenuLines[3] = { Type = LINE_TYPE.VALUE_NOCHANGING, TextId = 0x40, ValId = 0x1004, Min=0, Max=160, Def=100, Val=160 } - ctx.MenuLines[4] = { Type = LINE_TYPE.VALUE_NUM_I8, TextId = 0x41, ValId = 0x1005, Min=0, Max=160, Def=100, Val=160 } - ctx.MenuLines[5] = { Type = LINE_TYPE.VALUE_NUM_I8, TextId = 0x42, ValId = 0x1006, Min=0, Max=160, Def=100, Val=160 } + ctx.MenuLines[4] = { Type = LINE_TYPE.VALUE_NOCHANGING, TextId = 0x41, ValId = 0x1005, Min=0, Max=160, Def=100, Val=160 } + ctx.MenuLines[5] = { Type = LINE_TYPE.VALUE_NOCHANGING, TextId = 0x42, ValId = 0x1006, Min=0, Max=160, Def=100, Val=160 } ctx.SelLine = 3 lastGoodMenu = menuId @@ -480,7 +480,7 @@ local function AR631_loadMenu(menuId) ctx.MenuLines[1] = { Type = LINE_TYPE.LIST_MENU1, TextId = 0x40, ValId = 0x1000, Min=53, Max=85, Def=53, Val=0 } ctx.MenuLines[2] = { Type = LINE_TYPE.LIST_MENU1, TextId = 0x41, ValId = 0x1001, Min=53, Max=85, Def=53, Val=0 } ctx.MenuLines[3] = { Type = LINE_TYPE.LIST_MENU1, TextId = 0x42, ValId = 0x1002, Min=53, Max=85, Def=53, Val=0 } - ctx.MenuLines[4] = { Type = LINE_TYPE.MENU, TextId = 0x267, ValId = 0x1029 } + ctx.MenuLines[4] = { Type = LINE_TYPE.MENU, TextId = 0xDA, ValId = 0x1029 } ctx.MenuLines[5] = { Type = LINE_TYPE.LIST_MENU1, TextId = 0x40, ValId = 0x1004, Min=53, Max=85, Def=53, Val=0 } ctx.MenuLines[6] = { Type = LINE_TYPE.LIST_MENU1, TextId = 0x41, ValId = 0x1005, Min=53, Max=85, Def=53, Val=0 } @@ -488,7 +488,7 @@ local function AR631_loadMenu(menuId) lastGoodMenu = menuId elseif (menuId==0x1030) then --M[Id=0x1030 P=0x0 N=0x0 B=0x102A Text="Attitude Trim"[0x1E6]] - --L[#0 T=M VId=0x1030 Text="Level model and capture attiude"[0xCD] MId=0x1030 ] + --L[#0 T=M VId=0x1030 Text="Level model and capture attiude/M"[0xCD] MId=0x1030 ] FORCED MENU --L[#1 T=M VId=0x1030 Text="Attitude Trim"[0x1E6] MId=0x1030 ] --L[#2 T=V_de VId=0x1002 Text="Roll"[0x40] Val=-1 [-45->45,0] MId=0x1030 ] --L[#3 T=V_de VId=0x1003 Text="Pitch"[0x41] Val=7 [-45->45,0] MId=0x1030 ] @@ -496,14 +496,14 @@ local function AR631_loadMenu(menuId) --L[#6 T=M VId=0x1030 Text="Negative = Nose Down/Roll Left"[0x268] MId=0x1030 ] ctx.Menu = { MenuId = 0x1030, TextId = 0x1E6, PrevId = 0, NextId = 0, BackId = 0x102A } - ctx.MenuLines[0] = { Type = LINE_TYPE.MENU, TextId = 0xCD, ValId = 0x1030 } + ctx.MenuLines[0] = { Type = LINE_TYPE.MENU, TextId = 0xCD, ValId = 0x1030 } -- FORCED MENU (/M) ctx.MenuLines[1] = { Type = LINE_TYPE.MENU, TextId = 0x1E6, ValId = 0x1030 } - ctx.MenuLines[2] = { Type = LINE_TYPE.VALUE_DEGRES, TextId = 0x40, ValId = 0x1002, Min=-45, Max=45, Def=0, Val=-1 } - ctx.MenuLines[3] = { Type = LINE_TYPE.VALUE_DEGRES, TextId = 0x41, ValId = 0x1003, Min=-45, Max=45, Def=0, Val=7 } + ctx.MenuLines[2] = { Type = LINE_TYPE.VALUE_DEGREES, TextId = 0x40, ValId = 0x1002, Min=-45, Max=45, Def=0, Val=-1 } + ctx.MenuLines[3] = { Type = LINE_TYPE.VALUE_DEGREES, TextId = 0x41, ValId = 0x1003, Min=-45, Max=45, Def=0, Val=7 } ctx.MenuLines[5] = { Type = LINE_TYPE.MENU, TextId = 0x267, ValId = 0x1030 } ctx.MenuLines[6] = { Type = LINE_TYPE.MENU, TextId = 0x268, ValId = 0x1030 } - ctx.SelLine = 2 + ctx.SelLine = 0 lastGoodMenu = menuId elseif (menuId==0x1031) then --M[Id=0x1031 P=0x0 N=0x0 B=0x102A Text="Failsafe Angles"[0x1F6]] @@ -515,8 +515,8 @@ local function AR631_loadMenu(menuId) ctx.Menu = { MenuId = 0x1031, TextId = 0x1F6, PrevId = 0, NextId = 0, BackId = 0x102A } ctx.MenuLines[0] = { Type = LINE_TYPE.MENU, TextId = 0x1F6, ValId = 0x1031 } - ctx.MenuLines[1] = { Type = LINE_TYPE.VALUE_DEGRES, TextId = 0x40, ValId = 0x1001, Min=-90, Max=90, Def=0, Val=0 } - ctx.MenuLines[2] = { Type = LINE_TYPE.VALUE_DEGRES, TextId = 0x41, ValId = 0x1002, Min=-90, Max=90, Def=0, Val=0 } + ctx.MenuLines[1] = { Type = LINE_TYPE.VALUE_DEGREES, TextId = 0x40, ValId = 0x1001, Min=-90, Max=90, Def=0, Val=0 } + ctx.MenuLines[2] = { Type = LINE_TYPE.VALUE_DEGREES, TextId = 0x41, ValId = 0x1002, Min=-90, Max=90, Def=0, Val=0 } ctx.MenuLines[5] = { Type = LINE_TYPE.MENU, TextId = 0x267, ValId = 0x1031 } ctx.MenuLines[6] = { Type = LINE_TYPE.MENU, TextId = 0x268, ValId = 0x1031 } @@ -542,7 +542,7 @@ local function AR631_loadMenu(menuId) --L[#3 T=M VId=0x1033 Text="by "Source""[0x262] MId=0x1033 ] --L[#4 T=L_m0 VId=0x1004 Text="Source Flight Mode"[0x23E] Val=0|"FM1" NL=(0->9,0,S=182) [182->191,182] MId=0x1033 ] --L[#5 T=L_m0 VId=0x1005 Text="Target Flight Mode"[0x23F] Val=0|"FM1" NL=(0->9,0,S=182) [182->191,182] MId=0x1033 ] - --L[#6 T=M VId=0x1035 Text="Copy"[0x259] MId=0x1034 ] + --L[#6 T=M VId=0x1035 Text="Apply"[0x90] MId=0x1034 ] ctx.Menu = { MenuId = 0x1033, TextId = 0x23D, PrevId = 0, NextId = 0, BackId = 0x1032 } @@ -552,19 +552,19 @@ local function AR631_loadMenu(menuId) ctx.MenuLines[3] = { Type = LINE_TYPE.MENU, TextId = 0x262, ValId = 0x1033 } ctx.MenuLines[4] = { Type = LINE_TYPE.LIST_MENU0, TextId = 0x23E, ValId = 0x1004, Min=182, Max=191, Def=182, Val=0 } ctx.MenuLines[5] = { Type = LINE_TYPE.LIST_MENU0, TextId = 0x23F, ValId = 0x1005, Min=182, Max=191, Def=182, Val=0 } - ctx.MenuLines[6] = { Type = LINE_TYPE.MENU, TextId = 0x259, ValId = 0x1034 } + ctx.MenuLines[6] = { Type = LINE_TYPE.MENU, TextId = 0x90, ValId = 0x1034 } ctx.SelLine = 4 lastGoodMenu = menuId elseif (menuId==0x1034) then --M[Id=0x1033 P=0x0 N=0x0 B=0x1032 Text="Copy Flight Mode Settings"[0x23D]] - --L[#1 T=M VId=0x1033 Text="WARNING: "Target" IN USE"[0x251] MId=0x1033 ] - --L[#2 T=M VId=0x1033 Text="flight mode will be overwritten"[0x252] MId=0x1033 ] - --L[#3 T=M VId=0x1033 Text="by "Source""[0x253] MId=0x1033 ] + --L[#1 T=M VId=0x1033 Text="Are you sure you want to ovewrite the \"Target\""[0x251] MId=0x1033 ] + --L[#2 T=M VId=0x1033 Text="with the \"Source\" ? "[0x252] MId=0x1033 ] + --L[#3 T=M VId=0x1033 Text=""[0x253] MId=0x1033 ] --L[#4 T=L_m0 VId=0x1004 Text="Source Flight Mode"[0x23E] Val=0|"FM1" NL=(0->0,0,S=182) [182->182,182] MId=0x1033 ] --L[#5 T=L_m0 VId=0x1005 Text="Target Flight Mode"[0x23F] Val=1|"FM2" NL=(0->0,0,S=182) [182->182,182] MId=0x1033 ] - --L[#6 T=M VId=0x1035 Text="Copy"[0x259] MId=0x1034 ] + --L[#6 T=M VId=0x1035 Text="YES"[0x259] MId=0x1034 ] ctx.Menu = { MenuId = 0x1034, TextId = 0x23D, PrevId = 0x1033, NextId = 0, BackId = 0x1033 } @@ -639,10 +639,10 @@ local function AR631_loadMenu(menuId) ctx.MenuLines[0] = { Type = LINE_TYPE.MENU, TextId = 0x254, ValId = 0x102D } ctx.MenuLines[1] = { Type = LINE_TYPE.MENU, TextId = 0x1EF, ValId = 0x102D } ctx.MenuLines[2] = { Type = LINE_TYPE.VALUE_NOCHANGING, TextId = 0x1F3, ValId = 0x1001, Min=0, Max=50, Def=30, Val=30 } - ctx.MenuLines[3] = { Type = LINE_TYPE.VALUE_DEGRES, TextId = 0x1F4, ValId = 0x1002, Min=-45, Max=45, Def=0, Val=0 } + ctx.MenuLines[3] = { Type = LINE_TYPE.VALUE_DEGREES, TextId = 0x1F4, ValId = 0x1002, Min=-45, Max=45, Def=0, Val=0 } ctx.MenuLines[4] = { Type = LINE_TYPE.MENU, TextId = 0x1F0, ValId = 0x102D } ctx.MenuLines[5] = { Type = LINE_TYPE.VALUE_NOCHANGING, TextId = 0x1F3, ValId = 0x1005, Min=51, Max=100, Def=70, Val=70 } - ctx.MenuLines[6] = { Type = LINE_TYPE.VALUE_DEGRES, TextId = 0x1F4, ValId = 0x1006, Min=-45, Max=45, Def=0, Val=0 } + ctx.MenuLines[6] = { Type = LINE_TYPE.VALUE_DEGREES, TextId = 0x1F4, ValId = 0x1006, Min=-45, Max=45, Def=0, Val=0 } ctx.SelLine = 2 lastGoodMenu = menuId @@ -816,8 +816,8 @@ local function AR631_loadMenu(menuId) ctx.Menu = { MenuId = 0x1059, TextId = 0x20D, PrevId = 0x1057, NextId = 0x105A, BackId = 0x1010 } ctx.MenuLines[0] = { Type = LINE_TYPE.MENU, TextId = 0xCD, ValId = 0x1059 } ctx.MenuLines[1] = { Type = LINE_TYPE.MENU, TextId = 0x1E6, ValId = 0x1059 } - ctx.MenuLines[2] = { Type = LINE_TYPE.VALUE_DEGRES, TextId = 0x40, ValId = 0x1002, Min=-45, Max=45, Def=0, Val=13 } - ctx.MenuLines[3] = { Type = LINE_TYPE.VALUE_DEGRES, TextId = 0x41, ValId = 0x1003, Min=-45, Max=45, Def=0, Val=5 } + ctx.MenuLines[2] = { Type = LINE_TYPE.VALUE_DEGREES, TextId = 0x40, ValId = 0x1002, Min=-45, Max=45, Def=0, Val=13 } + ctx.MenuLines[3] = { Type = LINE_TYPE.VALUE_DEGREES, TextId = 0x41, ValId = 0x1003, Min=-45, Max=45, Def=0, Val=5 } ctx.MenuLines[5] = { Type = LINE_TYPE.MENU, TextId = 0x267, ValId = 0x1059 } ctx.MenuLines[6] = { Type = LINE_TYPE.MENU, TextId = 0x268, ValId = 0x1059 } @@ -1271,7 +1271,7 @@ local function FC6250HX_loadMenu(menuId) ctx.Menu = { MenuId = 0x140, TextId = 0x8B, PrevId = 0, NextId = 0, BackId = 0x1400 } ctx.MenuLines[0] = { Type = LINE_TYPE.VALUE_NUM_I8, TextId = 0x1E7, ValId = 0x141, Min=5, Max=90, Def=45, Val=30 } - ctx.MenuLines[1] = { Type = LINE_TYPE.VALUE_NUM_I8, TextId = 0x1E7, ValId = 0x42, Min=25, Max=100, Def=50, Val=30 } + ctx.MenuLines[1] = { Type = LINE_TYPE.VALUE_NUM_I8, TextId = 0x42, ValId = 0x142, Min=25, Max=100, Def=50, Val=30 } ctx.SelLine = 0 lastGoodMenu = menuId @@ -1281,8 +1281,8 @@ local function FC6250HX_loadMenu(menuId) --L[#1 T=V_s16 VId=0x1422 Text="Pitch"[0x41] val=58 [-850->850,0] MId=0x1420 ] ctx.Menu = { MenuId = 0x1420, TextId = 0x1E6, PrevId = 0, NextId = 0, BackId = 0x1400 } - ctx.MenuLines[0] = { Type = LINE_TYPE.VALUE_NUM_SI16, TextId = 0x1E7, ValId = 0x40, Min=-850, Max=850, Def=450, Val=274 } - ctx.MenuLines[1] = { Type = LINE_TYPE.VALUE_NUM_SI16, TextId = 0x1E7, ValId = 0x41, Min=-850, Max=850, Def=0, Val=58 } + ctx.MenuLines[0] = { Type = LINE_TYPE.VALUE_NUM_SI16, TextId = 0x40, ValId = 0x1421, Min=-850, Max=850, Def=450, Val=274 } + ctx.MenuLines[1] = { Type = LINE_TYPE.VALUE_NUM_SI16, TextId = 0x41, ValId = 0x1422, Min=-850, Max=850, Def=0, Val=58 } ctx.SelLine = 0 lastGoodMenu = menuId @@ -1358,7 +1358,7 @@ local function loadMenu(menuId) elseif (menuId==0x1001) then RX_Initialized = false ctx.RX.Id = dsmLib.RX.AR631 - ctx.RX.Name = "AR631/AR637 -NEW-SIM" + ctx.RX.Name = "AR631/AR637-SIM" ctx.RX.Version = "2.38.5" dsmLib.Init_Text(ctx.RX.Id) @@ -1366,7 +1366,7 @@ local function loadMenu(menuId) RX_loadMenu(0x01000) elseif (menuId==0x1002) then ctx.RX.Id = dsmLib.RX.AR631 - ctx.RX.Name = "AR631/AR637 -SIM" + ctx.RX.Name = "AR631/637-SIM" ctx.RX.Version = "2.38.5" dsmLib.Init_Text(ctx.RX.Id) @@ -1467,7 +1467,7 @@ SimLib.isListLine = dsmLib.isListLine SimLib.isPercentValueLine = dsmLib.isPercentValueLine SimLib.isNumberValueLine = dsmLib.isNumberValueLine SimLib.isDisplayAttr = dsmLib.isDisplayAttr -SimLib.isFlightModeText = dsmLib.isFlightModeText +SimLib.isFlightModeLine = dsmLib.isFlightModeLine SimLib.GetFlightModeValue = dsmLib.GetFlightModeValue SimLib.StartConnection = SIM_StartConnection -- Override Function @@ -1475,6 +1475,7 @@ SimLib.ReleaseConnection = SIM_ReleaseConnection -- Override Function SimLib.ChangePhase = dsmLib.ChangePhase SimLib.Value_Add = dsmLib.Value_Add SimLib.Value_Default = dsmLib.Value_Default +SimLib.Value_Write_Validate = dsmLib.Value_Write_Validate SimLib.GotoMenu = dsmLib.GotoMenu SimLib.MoveSelectionLine = dsmLib.MoveSelectionLine SimLib.Send_Receive = SIM_Send_Receive -- Override Function