@@ -27,6 +27,7 @@ local telemetryScreenActive = false
27
27
local menuActive = false
28
28
local lastRunTS = 0
29
29
local killEnterBreak = 0
30
+ local scrollPixelsY = 0
30
31
31
32
Page = nil
32
33
@@ -174,12 +175,24 @@ function drawScreenTitle(screen_title)
174
175
end
175
176
176
177
local function drawScreen ()
178
+ local yMinLim = Page .yMinLimit or 0
179
+ local yMaxLim = Page .yMaxLimit or LCD_H
180
+ local currentLineY = Page .fields [currentLine ].y
177
181
local screen_title = Page .title
178
182
drawScreenTitle (" Betaflight / " .. screen_title )
183
+ if currentLine == 1 then
184
+ scrollPixelsY = 0
185
+ elseif currentLineY - scrollPixelsY <= yMinLim then
186
+ scrollPixelsY = currentLineY - yMinLim
187
+ elseif currentLineY - scrollPixelsY >= yMaxLim then
188
+ scrollPixelsY = currentLineY - yMaxLim
189
+ end
179
190
for i = 1 ,# (Page .text ) do
180
191
local f = Page .text [i ]
181
192
local textOptions = (f .to or 0 ) + globalTextOptions
182
- lcd .drawText (f .x , f .y , f .t , textOptions )
193
+ if (f .y - scrollPixelsY ) >= yMinLim and (f .y - scrollPixelsY ) <= yMaxLim then
194
+ lcd .drawText (f .x , f .y - scrollPixelsY , f .t , textOptions )
195
+ end
183
196
end
184
197
local val = " ---"
185
198
for i = 1 ,# (Page .fields ) do
@@ -195,7 +208,9 @@ local function drawScreen()
195
208
end
196
209
local spacing = 20
197
210
if f .t ~= nil then
198
- lcd .drawText (f .x , f .y , f .t , heading_options )
211
+ if (f .y - scrollPixelsY ) >= yMinLim and (f .y - scrollPixelsY ) <= yMaxLim then
212
+ lcd .drawText (f .x , f .y - scrollPixelsY , f .t , heading_options )
213
+ end
199
214
if f .sp ~= nil then
200
215
spacing = f .sp
201
216
end
@@ -211,7 +226,9 @@ local function drawScreen()
211
226
val = f .table [f .value ]
212
227
end
213
228
end
214
- lcd .drawText (f .x + spacing , f .y , val , value_options )
229
+ if (f .y - scrollPixelsY ) >= yMinLim and (f .y - scrollPixelsY ) <= yMaxLim then
230
+ lcd .drawText (f .x + spacing , f .y - scrollPixelsY , val , value_options )
231
+ end
215
232
end
216
233
end
217
234
0 commit comments