@@ -29,7 +29,8 @@ local popupMenuActive = false
2929local lastRunTS = 0
3030local killEnterBreak = 0
3131local stopDisplay = true
32- local scrollPixelsY = 0
32+ local pageScrollY = 0
33+ local mainMenuScrollY = 0
3334
3435local Page = nil
3536
@@ -197,17 +198,17 @@ local function drawScreen()
197198 local screen_title = Page .title
198199 drawScreenTitle (" Betaflight / " .. screen_title )
199200 if currentLineY <= Page .fieldLayout [1 ].y then
200- scrollPixelsY = 0
201- elseif currentLineY - scrollPixelsY <= yMinLim then
202- scrollPixelsY = currentLineY - yMinLim
203- elseif currentLineY - scrollPixelsY >= yMaxLim then
204- scrollPixelsY = currentLineY - yMaxLim
201+ pageScrollY = 0
202+ elseif currentLineY - pageScrollY <= yMinLim then
203+ pageScrollY = currentLineY - yMinLim
204+ elseif currentLineY - pageScrollY >= yMaxLim then
205+ pageScrollY = currentLineY - yMaxLim
205206 end
206207 for i = 1 ,# (Page .labels ) do
207208 local f = Page .labels [i ]
208209 local textOptions = radio .textSize + globalTextOptions
209- if (f .y - scrollPixelsY ) >= yMinLim and (f .y - scrollPixelsY ) <= yMaxLim then
210- lcd .drawText (f .x , f .y - scrollPixelsY , f .t , textOptions )
210+ if (f .y - pageScrollY ) >= yMinLim and (f .y - pageScrollY ) <= yMaxLim then
211+ lcd .drawText (f .x , f .y - pageScrollY , f .t , textOptions )
211212 end
212213 end
213214 local val = " ---"
@@ -232,8 +233,8 @@ local function drawScreen()
232233 val = f .table [f .value ]
233234 end
234235 end
235- if (pos .y - scrollPixelsY ) >= yMinLim and (pos .y - scrollPixelsY ) <= yMaxLim then
236- lcd .drawText (pos .x , pos .y - scrollPixelsY , val , value_options )
236+ if (pos .y - pageScrollY ) >= yMinLim and (pos .y - pageScrollY ) <= yMaxLim then
237+ lcd .drawText (pos .x , pos .y - pageScrollY , val , value_options )
237238 end
238239 end
239240end
@@ -427,20 +428,20 @@ function run_ui(event)
427428 if (not PageFiles [i ].requiredVersion ) or (apiVersion == 0 ) or (apiVersion > 0 and PageFiles [i ].requiredVersion < apiVersion ) then
428429 local currentLineY = (menuLine - 1 )* lineSpacing + yMinLim
429430 if currentLineY <= yMinLim then
430- scrollPixelsY = 0
431- elseif currentLineY - scrollPixelsY <= yMinLim then
432- scrollPixelsY = currentLineY - yMinLim
433- elseif currentLineY - scrollPixelsY >= yMaxLim then
434- scrollPixelsY = currentLineY - yMaxLim
431+ mainMenuScrollY = 0
432+ elseif currentLineY - mainMenuScrollY <= yMinLim then
433+ mainMenuScrollY = currentLineY - yMinLim
434+ elseif currentLineY - mainMenuScrollY >= yMaxLim then
435+ mainMenuScrollY = currentLineY - yMaxLim
435436 end
436437 local attr = (menuLine == i and INVERS or 0 )
437438 if event == EVT_VIRTUAL_ENTER and attr == INVERS then
438439 invalidatePages ()
439440 currentPage = i
440441 currentState = pageStatus .display
441442 end
442- if ((i - 1 )* lineSpacing + yMinLim - scrollPixelsY ) >= yMinLim and ((i - 1 )* lineSpacing + yMinLim - scrollPixelsY ) <= yMaxLim then
443- lcd .drawText (6 , (i - 1 )* lineSpacing + yMinLim - scrollPixelsY , PageFiles [i ].title , attr )
443+ if ((i - 1 )* lineSpacing + yMinLim - mainMenuScrollY ) >= yMinLim and ((i - 1 )* lineSpacing + yMinLim - mainMenuScrollY ) <= yMaxLim then
444+ lcd .drawText (6 , (i - 1 )* lineSpacing + yMinLim - mainMenuScrollY , PageFiles [i ].title , attr )
444445 end
445446 end
446447 end
0 commit comments