Allow zero and limit range of enterd values (#896)

This commit is contained in:
Paul 2023-10-23 16:32:38 -07:00 committed by GitHub
parent 1294ad21cf
commit cd721e31d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -135,11 +135,15 @@ local function Config_Draw_Edit( event )
Edit = 0
elseif event == EVT_VIRTUAL_PREV then
-- Change value
if Menu_value[Edit_pos] > 0 then
Menu_value[Edit_pos] = Menu_value[Edit_pos] - 1
end
elseif event == EVT_VIRTUAL_NEXT then
-- Change value
if Menu_value[Edit_pos] < 255 then
Menu_value[Edit_pos] = Menu_value[Edit_pos] + 1
end
end
--Blink
Blink = Blink + 1
if Blink > 30 then
@ -319,9 +323,6 @@ local function Config_Draw_Menu()
--Read line from buffer
for i = 0, 20-1, 1 do
value=multiBuffer( line*20+13+i )
if value == 0 then
break -- end of line
end
if value > 0x80 and Menu[line].field_type == 0 then
-- Read field type
Menu[line].field_type = bitand(value, 0xF0)
@ -334,6 +335,9 @@ local function Config_Draw_Menu()
else
if Menu[line].field_type == 0 then
-- Text
if value == 0 then
break -- end of line
end
Menu[line].text = Menu[line].text .. string.char(value)
else
-- Menu specific fields