Skip to content

Commit f49f03d

Browse files
Frankie dsm fwrd prg enhancements (#806)
* #751 DSM Enhancements #751 DSM Forward Programming Enhancements (New GUI, etc) * Make both work on EdgeTx and OpenTX * #751 Turn OFF simulation by default Distribution code with RX simulation OFF Simulation should be only for Development * #751 Update Readme Documentation Updated the Readme.txt documentation and removed compiled luac file that was check in by mistake * #751 Fix problems With Reset RX 1. Fix problem when trying to Factory Reset. Enter Bind Mode. Save backup, Restore Backup 2. Found a way to advance on the Gyro initial Setup menus.. a bit of a hack, but works. 3. Handle RX resets properly. It needed after initial setup * #751 Cosmetic and Show Orientation Images #751 1. Fix problems when text contradictions between Menu/Line Headers and List Values 2. Show Images of RX orientations 3. Able to Hack getting into Initial Setup and other menus who was failing before 4. Custumize the way Flight Mode reports the Value on Screen * #751 add check for required libraries Add check that the required files in DSMLIB exist * #751 Write documentation about the protocol so that we don't forget later what we know, and enable others to understand the logs and maybe help solve problems. * #766 Change the way to detect that the files exist. now works on both ETX and OTX * #766 Strange Flickering in OTX Strange Flickering happening on OTX. Refreshing the screen on every cycle fixed the problem * #766 Change way of dectecting EdgeTX Change way of detecting OTX in multiple versions: OTX 2.3.14 and 2.3.15 * #766 make editable Gain Values Gains and other settings should be editable even when they are VALUE_NOCHANGING. Flight Mode is an exception that is handled properly. Right align numbers. * #766 More enhacements Added AR630 Make numbers right justified Cleanup some log messages and line types. Updated DSM FWD prog documentation * #751 more cosmetic things 1. Added AR10360T, 2. Simplify way to configured the hack for more receivers. 3. Change some texts on menus to march spektrum 4. Background color in Spektrum theme to match * #751 A few final changes 1. Update channel names to include channel number. i.e: Ch5 (Gear) 2, Fix flight mode display for Heli Receiver 3. i think the unknown lines are to request info about the TX settings * #751 1. Added Warning Screen 2. Correct handling of Unknown lines in Gyro Settings->Initial Setup * #751 New v0.51 version. - Added new menus to configure Model/Wing type. Without it, the initial setup will not work properly. * #751 More fixes on mixers and servo reverse -- Fix problem reversing servos when using vtail/delta mix -- Properly detect ch order of multimodule * #751 Updated channel naming and docs Updated readme documentation Consistent naming of Ch across the code. * #751 Fix message displaying data path * #751 More improvements 1. Much easier to select channels > Ch6 for FMode, Gain and Panic channels 2. B&W version for smaller screens (128x64).. Memory footprint still a problem. 3. Fix a lot typos/misspell/grammar in the documentation Co-authored-by: pascallanger <pascal_langer@yahoo.fr>
1 parent 90bb5f8 commit f49f03d

File tree

6 files changed

+259
-169
lines changed

6 files changed

+259
-169
lines changed

Lua_scripts/DSM FwdPrg_05_BW.lua

Lines changed: 66 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
local toolName = "TNS|DSM Forward Prog v0.52 (Text B&W) |TNE"
2-
local VERSION = "v0.52"
1+
local toolName = "TNS|DSM Forward Prog v0.53 (Text B&W) |TNE"
2+
local VERSION = "v0.53"
33

44

55
---- #########################################################################
@@ -109,8 +109,12 @@ end
109109

110110
local function GUI_Diplay_Button(x,y,w,h,text,selected)
111111
local attr = (selected) and INVERS or 0 -- INVERS if line Selected
112-
lcd.drawText(x+5,y+2, text, attr + TEXT_SIZE)
113-
lcd.drawRectangle(x, y, w, h, LINE_COLOR)
112+
if (TEXT_SIZE~=SMLSIZE) then
113+
lcd.drawText(x+5,y+2, text, attr + TEXT_SIZE)
114+
lcd.drawRectangle(x, y, w, h, LINE_COLOR)
115+
else -- SMALL Screen
116+
lcd.drawText(x,y, text, attr + TEXT_SIZE)
117+
end
114118
end
115119

116120
local function GUI_Display_Menu(menu)
@@ -120,11 +124,9 @@ local function GUI_Display_Menu(menu)
120124
-- Center Header
121125
local tw = openTx_lcd_sizeText(menu.Text)
122126
local x = w/2 - tw/2 -- Center of Screen - Center of Text
127+
if (x < 0) then x=0 end -- in case text is too wide
123128

124-
local bold = 0
125-
if (TEXT_SIZE~=SMLSIZE) then -- Ignore Bold on small size screens
126-
bold = BOLD
127-
end
129+
local bold = BOLD
128130
lcd.drawText(x,LCD_Y_MENU_TITLE,menu.Text,bold + TEXT_SIZE)
129131

130132
-- Back
@@ -154,17 +156,16 @@ local function GUI_Display_Line_Menu(x,y,w,h,line,selected)
154156
-- Menu Line
155157
text = text .. " >"
156158
else -- SubHeaders and plain text lines
157-
if (TEXT_SIZE~=SMLSIZE) then -- ignore bold on small size screens
158-
bold = (dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR.BOLD) and BOLD) or 0
159-
end
159+
bold = (dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR._BOLD) and BOLD) or 0
160160

161-
if dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR.RIGHT) then -- Right Align???
161+
if dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR._RIGHT) then -- Right Align???
162162
local tw = openTx_lcd_sizeText(line.Text)+4
163163
x = LCD_X_LINE_VALUE - tw -- Right
164-
elseif dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR.CENTER) then -- Center??
164+
elseif dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR._CENTER) then -- Center??
165165
local tw = openTx_lcd_sizeText(line.Text)
166166
x = x + (LCD_X_LINE_VALUE - LCD_X_LINE_MENU)/2 - tw/2 -- Center - 1/2 Text
167167
end
168+
if (x < 0) then x=0 end -- in case text is too wide
168169
end
169170

170171
lcd.drawText(x,y, text, attr + bold + TEXT_SIZE)
@@ -185,17 +186,16 @@ local function GUI_Display_Line_Value(lineNum, line, value, selected, editing)
185186
header = dsmLib.GetFlightModeValue(line)
186187

187188
-- Flight mode display attributes
188-
if (TEXT_SIZE~=SMLSIZE) then -- ignore bold on small size screens
189-
bold = (dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR.BOLD) and BOLD) or 0
190-
end
189+
bold = (dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR._BOLD) and BOLD) or 0
191190

192-
if dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR.RIGHT) then -- Right Align
191+
if dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR._RIGHT) then -- Right Align
193192
local tw = openTx_lcd_sizeText(header)+4
194193
x = LCD_X_LINE_VALUE - tw -- Right
195-
elseif dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR.CENTER) then -- Centered
194+
elseif dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR._CENTER) then -- Centered
196195
local tw = openTx_lcd_sizeText(header)
197196
x = x + (LCD_X_LINE_VALUE - LCD_X_LINE_TITLE)/2 - tw/2 -- Center - 1/2 Text
198197
end
198+
if (x < 0) then x=0 end -- in case text is too wide
199199
else
200200
-- No Flight Mode, no effects here
201201
header = header .. ":"
@@ -211,7 +211,7 @@ local function GUI_Display_Line_Value(lineNum, line, value, selected, editing)
211211
attrib = INVERS
212212
if editing then -- blink editing entry
213213
attrib = attrib + BLINK
214-
value = "[ " .. value .. " ]"
214+
value = "[" .. value .. "]"
215215
end
216216
end
217217

@@ -228,7 +228,14 @@ local function GUI_ShowBitmap(x,y,imgData)
228228
local f = string.gmatch(imgData, '([^%|]+)') -- Iterator over values split by '|'
229229
local imgName, imgMsg = f(), f()
230230

231-
lcd.drawText(x, y, imgMsg or "") -- Alternate Image MSG
231+
if (LCD_W > 128) then
232+
lcd.drawText(x, y, imgMsg or "", TEXT_SIZE) -- Alternate Image MSG
233+
else
234+
local f = string.gmatch(imgMsg, '([^%:]+)') -- Iterator over values split by ':'
235+
local msg1,msg2 = f(), f()
236+
lcd.drawText(x, y, (msg1 or "")..":", TEXT_SIZE) -- Alternate Image MSG
237+
lcd.drawText(x, y+10, msg2 or "", TEXT_SIZE) -- Alternate Image MSG
238+
end
232239

233240
-- NO IMAGES in Text B&W
234241
--local imgPath = IMAGE_PATH .. (imgName or "")
@@ -242,16 +249,22 @@ end
242249
local function GUI_Display()
243250
local ctx = DSM_Context
244251
lcd.clear()
252+
local header = "DSM Fwrd Programming "
253+
254+
if (TEXT_SIZE==SMLSIZE) then -- Small Screen no title
255+
header = ""
256+
end
245257

246-
local header = "DSM Fwrd Programming "
247258
if ctx.Phase ~= PHASE.RX_VERSION then
248-
header = header .. "RX "..ctx.RX.Name.." v"..ctx.RX.Version
259+
header = header .. ctx.RX.Name.." v"..ctx.RX.Version
249260
end
250261

251262
--Draw title
252263
if (TEXT_SIZE~=SMLSIZE) then -- ignore tool title small size screens
253264
lcd.drawFilledRectangle(0, 0, LCD_W, 20, TITLE_BGCOLOR)
254265
lcd.drawText(5, 0, header, MENU_TITLE_COLOR + TEXT_SIZE)
266+
else -- Small Screen
267+
lcd.drawText(20, LCD_Y_LOWER_BUTTONS+1, header, TEXT_SIZE)
255268
end
256269
--Draw RX Menu
257270
if ctx.Phase == PHASE.RX_VERSION then
@@ -402,6 +415,7 @@ local function GUI_HandleEvent(event, touchState)
402415
-- enter Edit the current line
403416
ctx.EditLine = ctx.SelLine
404417
originalValue = menuLines[ctx.SelLine].Val
418+
dsmLib.ChangePhase(PHASE.VALUE_CHANGING_WAIT)
405419
end
406420
end
407421
end
@@ -422,41 +436,53 @@ local function init_screen_pos()
422436
TEXT_SIZE = SMLSIZE
423437
LCD_W_USABLE = 128
424438

425-
LCD_W_BUTTONS = 30
426-
LCD_H_BUTTONS = 17
427-
LCD_X_RIGHT_BUTTONS = 128 - LCD_W_BUTTONS - 5
439+
LCD_W_BUTTONS = 16
440+
LCD_H_BUTTONS = 10
441+
LCD_X_RIGHT_BUTTONS = 128 - LCD_W_BUTTONS - 3
428442

429443
LCD_X_LINE_MENU = 0
430444
-- X offsets for (Title: [Value] debugInfo) lines
431445
LCD_X_LINE_TITLE = 0
432-
LCD_X_LINE_VALUE = 90
446+
LCD_X_LINE_VALUE = 75
433447
LCD_X_LINE_DEBUG = 110
434448

435-
LCD_Y_LINE_HEIGHT = 17
449+
LCD_Y_LINE_HEIGHT = 7
436450
LCD_Y_MENU_TITLE = 0
437-
LCD_Y_LINE_FIRST = LCD_Y_MENU_TITLE + 17
438-
LCD_Y_LOWER_BUTTONS = LCD_Y_LINE_FIRST + 7 * LCD_Y_LINE_HEIGHT
451+
LCD_Y_LINE_FIRST = LCD_Y_MENU_TITLE + 8
452+
LCD_Y_LOWER_BUTTONS = LCD_Y_LINE_FIRST + (7 * LCD_Y_LINE_HEIGHT)
439453
end
440454
end
441455

442456
local function GUI_Warning(event)
443457
lcd.clear()
444458
local header = "DSM Forward Programming "..VERSION.." "
445459
--Draw title
446-
lcd.drawFilledRectangle(0, 0, LCD_W, 17, TITLE_BGCOLOR)
447-
lcd.drawText(5, 0, header, MENU_TITLE_COLOR + TEXT_SIZE)
460+
if (LCD_W > 128) then
461+
lcd.drawFilledRectangle(0, 0, LCD_W, 17, TITLE_BGCOLOR)
462+
lcd.drawText(5, 0, header, MENU_TITLE_COLOR + TEXT_SIZE)
463+
464+
lcd.drawText(100,20,"INFO", BOLD)
465+
lcd.drawText(5,40,"DSM Forward programing shares TX Servo/Output settings", TEXT_SIZE)
466+
lcd.drawText(5,60,"with the RX. Make sure you setup your plane first in ", TEXT_SIZE)
467+
lcd.drawText(5,80,"the TX before your start programming your RX.", TEXT_SIZE)
468+
lcd.drawText(5,100,"Wing & Tail type can be configured using this tool.", TEXT_SIZE)
448469

449-
lcd.drawText(100,20,"INFO", BOLD)
450-
lcd.drawText(5,40,"DSM Forward programing shares TX Servo/Output settings", 0)
451-
lcd.drawText(5,60,"with the RX. Make sure you setup your plane first in ", 0)
452-
lcd.drawText(5,80,"the TX before your start programming your RX.", 0)
453-
lcd.drawText(5,100,"Wing & Tail type can be configured using this tool.", 0)
470+
lcd.drawText(5,150,"TX Servo settings are sent to the RX during 'Initial Setup'", TEXT_SIZE)
471+
lcd.drawText(5,170,"as well as when using RX menu 'Relearn Servo Settings'", TEXT_SIZE)
472+
lcd.drawText(5,200,"ALWAYS TEST Gyro reactions after this conditions before flying.", BOLD+TEXT_SIZE)
454473

455-
lcd.drawText(5,150,"TX Servo settings are sent to the RX during 'Initial Setup'", 0)
456-
lcd.drawText(5,170,"as well as when using RX menu 'Relearn Servo Settings'", 0)
457-
lcd.drawText(5,200,"ALWAYS TEST Gyro reactions after this conditions before flying.", BOLD)
474+
lcd.drawText(100,250," OK ", INVERS + BOLD + TEXT_SIZE)
475+
else
476+
lcd.drawText(0,15,"Make sure you setup your plane", TEXT_SIZE)
477+
lcd.drawText(0,22,"first. Wing and Tail type.", TEXT_SIZE)
478+
479+
lcd.drawText(0,30,"TX Servo settings are sent to ", TEXT_SIZE)
480+
lcd.drawText(0,37,"the RX during 'Initial Setup' and ", TEXT_SIZE)
481+
lcd.drawText(0,45,"ALWAYS TEST Gyro reactions", TEXT_SIZE)
482+
lcd.drawText(0,52,"before flying!!!", TEXT_SIZE)
458483

459-
lcd.drawText(100,250," OK ", INVERS + BOLD)
484+
lcd.drawText(10,0," OK ", INVERS + BOLD + TEXT_SIZE)
485+
end
460486

461487
if event == EVT_VIRTUAL_EXIT or event == EVT_VIRTUAL_ENTER then
462488
warningScreenON = false

Lua_scripts/DSM FwdPrg_05_Color.lua

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
local toolName = "TNS|DSM Forward Prog v0.52 (Color+Touch) |TNE"
2-
local VERSION = "v0.52"
1+
local toolName = "TNS|DSM Forward Prog v0.53 (Color+Touch) |TNE"
2+
local VERSION = "v0.53"
33

44
---- #########################################################################
55
---- # #
@@ -210,12 +210,12 @@ local function GUI_Display_Line_Menu(lineNum,line,selected)
210210
-- Non Selectable Menu Lines, plain text
211211
-- Can be use for sub headers or just regular text lines (like warnings)
212212

213-
local bold = (dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR.BOLD) and BOLD) or 0
213+
local bold = (dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR._BOLD) and BOLD) or 0
214214

215-
if dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR.RIGHT) then -- Right Align???
215+
if dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR._RIGHT) then -- Right Align???
216216
local tw = my_lcd_sizeText(line.Text)+4
217217
x = LCD_X_LINE_VALUE - tw -- Right
218-
elseif dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR.CENTER) then -- Center??
218+
elseif dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR._CENTER) then -- Center??
219219
local tw = my_lcd_sizeText(line.Text)
220220
x = x + (LCD_X_LINE_VALUE - LCD_X_LINE_MENU)/2 - tw/2 -- Center - 1/2 Text
221221
end
@@ -240,12 +240,12 @@ local function GUI_Display_Line_Value(lineNum, line, value, selected, editing)
240240
header = dsmLib.GetFlightModeValue(line)
241241

242242
-- Bold Text???
243-
bold = (dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR.BOLD) and BOLD) or 0
243+
bold = (dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR._BOLD) and BOLD) or 0
244244

245-
if dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR.RIGHT) then -- Right Align
245+
if dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR._RIGHT) then -- Right Align
246246
local tw = my_lcd_sizeText(header)+4
247247
x = LCD_X_LINE_VALUE - tw -- Right
248-
elseif dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR.CENTER) then -- Centered
248+
elseif dsmLib.isDisplayAttr(line.TextAttr,DISP_ATTR._CENTER) then -- Centered
249249
local tw = my_lcd_sizeText(header)
250250
x = x + (LCD_X_LINE_VALUE - LCD_X_LINE_TITLE)/2 - tw/2 -- Center - 1/2 Text
251251
end
@@ -590,6 +590,7 @@ local function GUI_HandleEvent(event, touchState)
590590
else -- Edit the current value
591591
ctx.EditLine = ctx.SelLine
592592
originalValue = menuLines[ctx.SelLine].Val
593+
dsmLib.ChangePhase(PHASE.VALUE_CHANGING_WAIT)
593594
end
594595
end
595596
end
@@ -635,11 +636,11 @@ local function GUI_Warning(event,touchState)
635636
lcd.drawText(100,20,"INFO", BOLD)
636637
lcd.drawText(5,40,"DSM Forward programing shares TX Servo/Output settings", 0)
637638
lcd.drawText(5,60,"with the RX. Make sure you setup your plane first in ", 0)
638-
lcd.drawText(5,80,"the TX before your start programming your RX.", 0)
639+
lcd.drawText(5,80,"the TX before your start Fwrd programming your RX.", 0)
639640
lcd.drawText(5,100,"Wing & Tail type can be configured using this tool.", 0)
640641

641-
lcd.drawText(5,150,"TX Servo settings are sent to the RX during 'Initial Setup'", 0)
642-
lcd.drawText(5,170,"as well as when using RX menu 'Relearn Servo Settings'", 0)
642+
lcd.drawText(5,150,"TX Gyro Servo settings are sent to the RX during 'Initial Setup'", 0)
643+
lcd.drawText(5,170,"as well as when using RX 'Relearn Servo Settings'", 0)
643644
lcd.drawText(5,200,"ALWAYS TEST Gyro reactions after this conditions before flying.", BOLD)
644645

645646
lcd.drawText(100,250," OK ", INVERS + BOLD)

0 commit comments

Comments
 (0)