Merge with latest 2.3

This commit is contained in:
Bertrand Songis
2020-06-18 11:14:07 +02:00
121 changed files with 3269 additions and 1775 deletions
@@ -21,19 +21,41 @@
-- To start operation:
-- Write "HoTT" at address 0..3
-- Write 0xFF at address 4 will request the buffer to be cleared
-- Write 0xDF at address 5
-- Write 0x0F at address 5
-- Read buffer from address 6 access the RX text for 168 bytes, 21 caracters
-- by 8 lines
-- Write at address 5 sends an order to the RX: 0xDF=start, 0xD7=prev page,
-- 0xDE=next page, 0xD9=enter, 0xDD=next or 0xDB=prev
-- Write at address 5 sends an order to the RX: 0xXF=start, 0xX7=prev page,
-- 0xXE=next page, 0xX9=enter, 0xXD=next or 0xXB=prev with X being the sensor
-- to request data from 8=RX only, 9=Vario, A=GPS, B=Cust, C=ESC, D=GAM, E=EAM
-- Write at address 4 the value 0xFF will request the buffer to be cleared
-- !! Before exiting the script must write 0 at address 0 for normal operation !!
--###############################################################################
HoTT_Sensor = 0
Timer_128 = 100
local function HoTT_Release()
multiBuffer( 0, 0 )
end
local function HoTT_Send(button)
multiBuffer( 5, 0x80+(HoTT_Sensor*16) + button)
end
local function HoTT_Sensor_Inc()
local detected_sensors=multiBuffer( 4 )
local a
if detected_sensors ~= 0xFF then
repeat
HoTT_Sensor=(HoTT_Sensor+1)%7 -- Switch to next sensor
if HoTT_Sensor ~= 0 then
a = math.floor(detected_sensors/ (2^(HoTT_Sensor-1))) -- shift right
end
until HoTT_Sensor==0 or a % 2 == 1
HoTT_Send( 0x0F )
end
end
local function HoTT_Draw_LCD()
local i
local value
@@ -41,12 +63,14 @@ local function HoTT_Draw_LCD()
local result
local offset=0
local sensor_name = { "", "+Vario", "+GPS", "+Cust", "+ESC", "+GAM", "+EAM" }
lcd.clear()
if LCD_W == 480 then
--Draw title
lcd.drawFilledRectangle(0, 0, LCD_W, 30, TITLE_BGCOLOR)
lcd.drawText(1, 5, "Graupner HoTT RX configuration", MENU_TITLE_COLOR)
lcd.drawText(1, 5, "Graupner HoTT: config RX" .. sensor_name[HoTT_Sensor+1] .. " - Menu cycle Sensors", MENU_TITLE_COLOR)
--Draw RX Menu
if multiBuffer( 4 ) == 0xFF then
lcd.drawText(10,50,"No HoTT telemetry...", BLINK)
@@ -56,9 +80,9 @@ local function HoTT_Draw_LCD()
value=multiBuffer( line*21+6+i )
if value > 0x80 then
value = value - 0x80
lcd.drawText(10+i*16,32+16*line,string.char(value).." ",INVERS)
lcd.drawText(10+i*16,32+20*line,string.char(value).." ",INVERS)
else
lcd.drawText(10+i*16,32+16*line,string.char(value))
lcd.drawText(10+i*16,32+20*line,string.char(value))
end
end
end
@@ -68,14 +92,23 @@ local function HoTT_Draw_LCD()
if multiBuffer( 4 ) == 0xFF then
lcd.drawText(2,17,"No HoTT telemetry...",SMLSIZE)
else
for line = 0, 7, 1 do
for i = 0, 21-1, 1 do
value=multiBuffer( line*21+6+i )
if value > 0x80 then
value = value - 0x80
lcd.drawText(2+i*6,1+8*line,string.char(value).." ",SMLSIZE+INVERS)
else
lcd.drawText(2+i*6,1+8*line,string.char(value),SMLSIZE)
if Timer_128 ~= 0 then
--Intro page
Timer_128 = Timer_128 - 1
lcd.drawScreenTitle("Graupner Hott",0,0)
lcd.drawText(2,17,"Configuration of RX" .. sensor_name[HoTT_Sensor+1] ,SMLSIZE)
lcd.drawText(2,37,"Press menu to cycle Sensors" ,SMLSIZE)
else
--Menu page
for line = 0, 7, 1 do
for i = 0, 21-1, 1 do
value=multiBuffer( line*21+6+i )
if value > 0x80 then
value = value - 0x80
lcd.drawText(2+i*6,1+8*line,string.char(value).." ",SMLSIZE+INVERS)
else
lcd.drawText(2+i*6,1+8*line,string.char(value),SMLSIZE)
end
end
end
end
@@ -98,7 +131,10 @@ local function HoTT_Init()
--Request init of the RX buffer
multiBuffer( 4, 0xFF )
--Request RX to send the config menu
multiBuffer( 5, 0xDF )
HoTT_Send( 0x0F )
HoTT_Sensor = 0;
HoTT_Detected_Sensors=0;
Timer_128 = 100
end
-- Main
@@ -111,18 +147,21 @@ local function HoTT_Run(event)
return 2
else
if event == EVT_VIRTUAL_PREV_PAGE then
killEvents(event);
multiBuffer( 5, 0xD7 )
elseif event == EVT_VIRTUAL_NEXT_PAGE then
multiBuffer( 5, 0xDE )
killEvents(event)
HoTT_Send( 0x07 )
elseif event == EVT_VIRTUAL_ENTER then
multiBuffer( 5, 0xD9 )
elseif event == EVT_VIRTUAL_NEXT then
multiBuffer( 5, 0xDD )
HoTT_Send( 0x09 )
elseif event == EVT_VIRTUAL_PREV then
multiBuffer( 5, 0xDB )
HoTT_Send( 0x0B )
elseif event == EVT_VIRTUAL_NEXT then
HoTT_Send( 0x0D )
elseif event == EVT_VIRTUAL_NEXT_PAGE then
HoTT_Send( 0x0E )
elseif event == EVT_VIRTUAL_MENU then
Timer_128 = 100
HoTT_Sensor_Inc()
else
multiBuffer( 5, 0xDF )
HoTT_Send( 0x0F )
end
HoTT_Draw_LCD()
return 0
@@ -149,14 +149,13 @@ local function runMotorConfig(event)
lcd.drawBitmap(BackgroundImg, 0, 0)
lcd.drawBitmap(ImgPageDn, 455, 95)
lcd.drawBitmap(ImgEngine, 310, 50)
lcd.setColor(CUSTOM_COLOR, lcd.RGB(255, 255, 255))
fields = MotorFields
lcd.drawText(40, 20, "Does your model have a motor ?", DEFAULT_COLOR)
lcd.drawFilledRectangle(40, 45, 200, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 45, 200, 30, TEXT_BGCOLOR)
fields[2][4]=0
if fields[1][5] == 1 then
lcd.drawText(40, 100, "What channel is it on ?", DEFAULT_COLOR)
lcd.drawFilledRectangle(40, 122, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 122, 100, 30, TEXT_BGCOLOR)
fields[2][4]=1
end
local result = runFieldsPage(event)
@@ -190,7 +189,7 @@ local function runAilConfig(event)
lcd.drawBitmap(ImgAilL, 395, 235)
drawMark(308, 115, "A")
drawMark(422, 220, "A")
lcd.drawFilledRectangle(40, 122, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 122, 100, 30, TEXT_BGCOLOR)
drawMark(152, 124, "A")
setFieldsVisible(1, 0)
elseif fields[1][5] == 2 then
@@ -198,16 +197,16 @@ local function runAilConfig(event)
lcd.drawBitmap(ImgAilL, 395, 235)
drawMark(308, 115, "A")
drawMark(422, 220, "B")
lcd.drawFilledRectangle(40, 122, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 122, 100, 30, TEXT_BGCOLOR)
drawMark(152, 124, "A")
lcd.drawFilledRectangle(40, 162, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 162, 100, 30, TEXT_BGCOLOR)
drawMark(152, 164, "B")
setFieldsVisible(1, 1)
else
setFieldsVisible(0, 0)
end
lcd.drawText(40, 20, "Number of ailerons on your model ?", DEFAULT_COLOR)
lcd.drawFilledRectangle(40, 45, 400, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 45, 400, 30, TEXT_BGCOLOR)
local result = runFieldsPage(event)
return result
end
@@ -235,7 +234,7 @@ local function runFlapsConfig(event)
lcd.drawBitmap(ImgFlp, 358, 202)
drawMark(332, 132, "A")
drawMark(412, 215, "A")
lcd.drawFilledRectangle(40, 122, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 122, 100, 30, TEXT_BGCOLOR)
drawMark(152, 124, "A")
setFieldsVisible(1, 0)
elseif fields[1][5] == 2 then
@@ -243,16 +242,16 @@ local function runFlapsConfig(event)
lcd.drawBitmap(ImgFlp, 358, 202)
drawMark(332, 132, "A")
drawMark(412, 215, "B")
lcd.drawFilledRectangle(40, 122, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 122, 100, 30, TEXT_BGCOLOR)
drawMark(152, 124, "A")
lcd.drawFilledRectangle(40, 162, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 162, 100, 30, TEXT_BGCOLOR)
drawMark(152, 164, "B")
setFieldsVisible(1, 1)
else
setFieldsVisible(0, 0)
end
lcd.drawText(40, 20, "Does your model have flaps ?", DEFAULT_COLOR)
lcd.drawFilledRectangle(40, 45, 400, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 45, 400, 30, TEXT_BGCOLOR)
local result = runFieldsPage(event)
return result
end
@@ -283,7 +282,7 @@ local function runTailConfig(event)
lcd.drawBitmap(ImgTail, 252, 100)
drawMark(360, 125, "A")
drawMark(390, 155, "A")
lcd.drawFilledRectangle(40, 122, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 122, 100, 30, TEXT_BGCOLOR)
drawMark(152, 124, "A")
setFieldsVisible(1, 0, 0)
end
@@ -293,9 +292,9 @@ local function runTailConfig(event)
drawMark(415, 150, "A")
drawMark(380, 120, "A")
drawMark(390, 185, "B")
lcd.drawFilledRectangle(40, 122, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 122, 100, 30, TEXT_BGCOLOR)
drawMark(152, 124, "A")
lcd.drawFilledRectangle(40, 162, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 162, 100, 30, TEXT_BGCOLOR)
drawMark(152, 164, "B")
setFieldsVisible(1, 1, 0)
end
@@ -305,11 +304,11 @@ local function runTailConfig(event)
drawMark(415, 150, "C")
drawMark(380, 120, "A")
drawMark(390, 185, "B")
lcd.drawFilledRectangle(40, 122, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 122, 100, 30, TEXT_BGCOLOR)
drawMark(152, 124, "A")
lcd.drawFilledRectangle(40, 162, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 162, 100, 30, TEXT_BGCOLOR)
drawMark(152, 164, "B")
lcd.drawFilledRectangle(40, 202, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 202, 100, 30, TEXT_BGCOLOR)
drawMark(152, 204, "C")
setFieldsVisible(1, 1, 1)
end
@@ -317,14 +316,14 @@ local function runTailConfig(event)
lcd.drawBitmap(ImgVTail, 252, 100)
drawMark(315, 110, "A")
drawMark(382, 120, "B")
lcd.drawFilledRectangle(40, 122, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 122, 100, 30, TEXT_BGCOLOR)
drawMark(152, 124, "A")
lcd.drawFilledRectangle(40, 162, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 162, 100, 30, TEXT_BGCOLOR)
drawMark(152, 164, "B")
setFieldsVisible(1, 1, 0)
end
lcd.drawText(40, 20, "Pick the tail config of your model", DEFAULT_COLOR)
lcd.drawFilledRectangle(40, 45, 400, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 45, 400, 30, TEXT_BGCOLOR)
local result = runFieldsPage(event)
return result
end
@@ -144,19 +144,18 @@ local ImgEngine
local function runMotorConfig(event)
lcd.clear()
if ImgEngine == nil then
ImgEngine = Bitmap.open("img/prop.png")
ImgEngine = Bitmap.open("img/prop.png")
end
lcd.drawBitmap(BackgroundImg, 0, 0)
lcd.drawBitmap(ImgPageDn, 455, 95)
lcd.drawBitmap(ImgEngine, 310, 50)
lcd.setColor(CUSTOM_COLOR, lcd.RGB(255, 255, 255))
fields = MotorFields
lcd.drawText(40, 20, "Does your model have a motor ?", DEFAULT_COLOR)
lcd.drawFilledRectangle(40, 45, 200, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 45, 200, 30, TEXT_BGCOLOR)
fields[2][4]=0
if fields[1][5] == 1 then
lcd.drawText(40, 100, "What channel is it on ?", DEFAULT_COLOR)
lcd.drawFilledRectangle(40, 122, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 122, 100, 30, TEXT_BGCOLOR)
fields[2][4]=1
end
local result = runFieldsPage(event)
@@ -190,7 +189,7 @@ local function runAilConfig(event)
lcd.drawBitmap(ImgAilL, 275, 210)
drawMark(362, 132, "A")
drawMark(302, 227, "A")
lcd.drawFilledRectangle(40, 122, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 122, 100, 30, TEXT_BGCOLOR)
drawMark(152, 124, "A")
setFieldsVisible(1, 0)
elseif fields[1][5] == 2 then
@@ -198,16 +197,16 @@ local function runAilConfig(event)
lcd.drawBitmap(ImgAilL, 275, 210)
drawMark(362, 132, "A")
drawMark(302, 227, "B")
lcd.drawFilledRectangle(40, 122, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 122, 100, 30, TEXT_BGCOLOR)
drawMark(152, 124, "A")
lcd.drawFilledRectangle(40, 162, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 162, 100, 30, TEXT_BGCOLOR)
drawMark(152, 164, "B")
setFieldsVisible(1, 1)
else
setFieldsVisible(0, 0)
end
lcd.drawText(40, 20, "Number of ailerons on your model ?", DEFAULT_COLOR)
lcd.drawFilledRectangle(40, 45, 400, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 45, 400, 30, TEXT_BGCOLOR)
local result = runFieldsPage(event)
return result
end
@@ -235,7 +234,7 @@ local function runFlapsConfig(event)
lcd.drawBitmap(ImgFlp, 285, 191)
drawMark(362, 132, "A")
drawMark(302, 227, "A")
lcd.drawFilledRectangle(40, 122, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 122, 100, 30, TEXT_BGCOLOR)
drawMark(152, 124, "A")
setFieldsVisible(1, 0)
elseif fields[1][5] == 2 then
@@ -243,16 +242,16 @@ local function runFlapsConfig(event)
lcd.drawBitmap(ImgFlp, 285, 191)
drawMark(362, 132, "A")
drawMark(302, 227, "B")
lcd.drawFilledRectangle(40, 122, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 122, 100, 30, TEXT_BGCOLOR)
drawMark(152, 124, "A")
lcd.drawFilledRectangle(40, 162, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 162, 100, 30, TEXT_BGCOLOR)
drawMark(152, 164, "B")
setFieldsVisible(1, 1)
else
setFieldsVisible(0, 0)
end
lcd.drawText(40, 20, "Does your model have flaps ?", DEFAULT_COLOR)
lcd.drawFilledRectangle(40, 45, 400, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 45, 400, 30, TEXT_BGCOLOR)
local result = runFieldsPage(event)
return result
end
@@ -283,7 +282,7 @@ local function runTailConfig(event)
lcd.drawBitmap(ImgTail, 252, 100)
drawMark(275, 120, "A")
drawMark(390, 155, "A")
lcd.drawFilledRectangle(40, 122, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 122, 100, 30, TEXT_BGCOLOR)
drawMark(152, 124, "A")
setFieldsVisible(1, 0, 0)
end
@@ -293,9 +292,9 @@ local function runTailConfig(event)
drawMark(275, 120, "A")
drawMark(390, 155, "A")
drawMark(370, 112, "B")
lcd.drawFilledRectangle(40, 122, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 122, 100, 30, TEXT_BGCOLOR)
drawMark(152, 124, "A")
lcd.drawFilledRectangle(40, 162, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 162, 100, 30, TEXT_BGCOLOR)
drawMark(152, 164, "B")
setFieldsVisible(1, 1, 0)
end
@@ -305,11 +304,11 @@ local function runTailConfig(event)
drawMark(275, 120, "A")
drawMark(390, 155, "C")
drawMark(370, 112, "B")
lcd.drawFilledRectangle(40, 122, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 122, 100, 30, TEXT_BGCOLOR)
drawMark(152, 124, "A")
lcd.drawFilledRectangle(40, 162, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 162, 100, 30, TEXT_BGCOLOR)
drawMark(152, 164, "B")
lcd.drawFilledRectangle(40, 202, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 202, 100, 30, TEXT_BGCOLOR)
drawMark(152, 204, "C")
setFieldsVisible(1, 1, 1)
end
@@ -317,14 +316,14 @@ local function runTailConfig(event)
lcd.drawBitmap(ImgVTail, 252, 100)
drawMark(315, 110, "A")
drawMark(382, 120, "B")
lcd.drawFilledRectangle(40, 122, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 122, 100, 30, TEXT_BGCOLOR)
drawMark(152, 124, "A")
lcd.drawFilledRectangle(40, 162, 100, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 162, 100, 30, TEXT_BGCOLOR)
drawMark(152, 164, "B")
setFieldsVisible(1, 1, 0)
end
lcd.drawText(40, 20, "Pick the tail config of your model", DEFAULT_COLOR)
lcd.drawFilledRectangle(40, 45, 400, 30, CUSTOM_COLOR)
lcd.drawFilledRectangle(40, 45, 400, 30, TEXT_BGCOLOR)
local result = runFieldsPage(event)
return result
end
@@ -21,19 +21,41 @@
-- To start operation:
-- Write "HoTT" at address 0..3
-- Write 0xFF at address 4 will request the buffer to be cleared
-- Write 0xDF at address 5
-- Write 0x0F at address 5
-- Read buffer from address 6 access the RX text for 168 bytes, 21 caracters
-- by 8 lines
-- Write at address 5 sends an order to the RX: 0xDF=start, 0xD7=prev page,
-- 0xDE=next page, 0xD9=enter, 0xDD=next or 0xDB=prev
-- Write at address 5 sends an order to the RX: 0xXF=start, 0xX7=prev page,
-- 0xXE=next page, 0xX9=enter, 0xXD=next or 0xXB=prev with X being the sensor
-- to request data from 8=RX only, 9=Vario, A=GPS, B=Cust, C=ESC, D=GAM, E=EAM
-- Write at address 4 the value 0xFF will request the buffer to be cleared
-- !! Before exiting the script must write 0 at address 0 for normal operation !!
--###############################################################################
HoTT_Sensor = 0
Timer_128 = 100
local function HoTT_Release()
multiBuffer( 0, 0 )
end
local function HoTT_Send(button)
multiBuffer( 5, 0x80+(HoTT_Sensor*16) + button)
end
local function HoTT_Sensor_Inc()
local detected_sensors=multiBuffer( 4 )
local a
if detected_sensors ~= 0xFF then
repeat
HoTT_Sensor=(HoTT_Sensor+1)%7 -- Switch to next sensor
if HoTT_Sensor ~= 0 then
a = math.floor(detected_sensors/ (2^(HoTT_Sensor-1))) -- shift right
end
until HoTT_Sensor==0 or a % 2 == 1
HoTT_Send( 0x0F )
end
end
local function HoTT_Draw_LCD()
local i
local value
@@ -41,12 +63,14 @@ local function HoTT_Draw_LCD()
local result
local offset=0
local sensor_name = { "", "+Vario", "+GPS", "+Cust", "+ESC", "+GAM", "+EAM" }
lcd.clear()
if LCD_W == 480 then
--Draw title
lcd.drawFilledRectangle(0, 0, LCD_W, 30, TITLE_BGCOLOR)
lcd.drawText(1, 5, "Graupner HoTT RX configuration", MENU_TITLE_COLOR)
lcd.drawText(1, 5, "Graupner HoTT: config RX" .. sensor_name[HoTT_Sensor+1] .. " - Menu cycle Sensors", MENU_TITLE_COLOR)
--Draw RX Menu
if multiBuffer( 4 ) == 0xFF then
lcd.drawText(10,50,"No HoTT telemetry...", BLINK)
@@ -56,9 +80,9 @@ local function HoTT_Draw_LCD()
value=multiBuffer( line*21+6+i )
if value > 0x80 then
value = value - 0x80
lcd.drawText(10+i*16,32+16*line,string.char(value).." ",INVERS)
lcd.drawText(10+i*16,32+20*line,string.char(value).." ",INVERS)
else
lcd.drawText(10+i*16,32+16*line,string.char(value))
lcd.drawText(10+i*16,32+20*line,string.char(value))
end
end
end
@@ -68,14 +92,23 @@ local function HoTT_Draw_LCD()
if multiBuffer( 4 ) == 0xFF then
lcd.drawText(2,17,"No HoTT telemetry...",SMLSIZE)
else
for line = 0, 7, 1 do
for i = 0, 21-1, 1 do
value=multiBuffer( line*21+6+i )
if value > 0x80 then
value = value - 0x80
lcd.drawText(2+i*6,1+8*line,string.char(value).." ",SMLSIZE+INVERS)
else
lcd.drawText(2+i*6,1+8*line,string.char(value),SMLSIZE)
if Timer_128 ~= 0 then
--Intro page
Timer_128 = Timer_128 - 1
lcd.drawScreenTitle("Graupner Hott",0,0)
lcd.drawText(2,17,"Configuration of RX" .. sensor_name[HoTT_Sensor+1] ,SMLSIZE)
lcd.drawText(2,37,"Press menu to cycle Sensors" ,SMLSIZE)
else
--Menu page
for line = 0, 7, 1 do
for i = 0, 21-1, 1 do
value=multiBuffer( line*21+6+i )
if value > 0x80 then
value = value - 0x80
lcd.drawText(2+i*6,1+8*line,string.char(value).." ",SMLSIZE+INVERS)
else
lcd.drawText(2+i*6,1+8*line,string.char(value),SMLSIZE)
end
end
end
end
@@ -98,7 +131,10 @@ local function HoTT_Init()
--Request init of the RX buffer
multiBuffer( 4, 0xFF )
--Request RX to send the config menu
multiBuffer( 5, 0xDF )
HoTT_Send( 0x0F )
HoTT_Sensor = 0;
HoTT_Detected_Sensors=0;
Timer_128 = 100
end
-- Main
@@ -111,18 +147,21 @@ local function HoTT_Run(event)
return 2
else
if event == EVT_VIRTUAL_PREV_PAGE then
killEvents(event);
multiBuffer( 5, 0xD7 )
elseif event == EVT_VIRTUAL_NEXT_PAGE then
multiBuffer( 5, 0xDE )
killEvents(event)
HoTT_Send( 0x07 )
elseif event == EVT_VIRTUAL_ENTER then
multiBuffer( 5, 0xD9 )
elseif event == EVT_VIRTUAL_NEXT then
multiBuffer( 5, 0xDD )
HoTT_Send( 0x09 )
elseif event == EVT_VIRTUAL_PREV then
multiBuffer( 5, 0xDB )
HoTT_Send( 0x0B )
elseif event == EVT_VIRTUAL_NEXT then
HoTT_Send( 0x0D )
elseif event == EVT_VIRTUAL_NEXT_PAGE then
HoTT_Send( 0x0E )
elseif event == EVT_VIRTUAL_MENU then
Timer_128 = 100
HoTT_Sensor_Inc()
else
multiBuffer( 5, 0xDF )
HoTT_Send( 0x0F )
end
HoTT_Draw_LCD()
return 0
@@ -165,8 +165,8 @@ end
-- Init function
local function init()
thrCH1 = defaultChannel(2)
rollCH1 = defaultChannel(0)
yawCH1 = defaultChannel(3)
rollCH1 = defaultChannel(3)
yawCH1 = defaultChannel(0)
pitchCH1 = defaultChannel(1)
local ver, radio, maj, minor, rev = getVersion()
if string.match(radio, "x7") then
@@ -21,19 +21,41 @@
-- To start operation:
-- Write "HoTT" at address 0..3
-- Write 0xFF at address 4 will request the buffer to be cleared
-- Write 0xDF at address 5
-- Write 0x0F at address 5
-- Read buffer from address 6 access the RX text for 168 bytes, 21 caracters
-- by 8 lines
-- Write at address 5 sends an order to the RX: 0xDF=start, 0xD7=prev page,
-- 0xDE=next page, 0xD9=enter, 0xDD=next or 0xDB=prev
-- Write at address 5 sends an order to the RX: 0xXF=start, 0xX7=prev page,
-- 0xXE=next page, 0xX9=enter, 0xXD=next or 0xXB=prev with X being the sensor
-- to request data from 8=RX only, 9=Vario, A=GPS, B=Cust, C=ESC, D=GAM, E=EAM
-- Write at address 4 the value 0xFF will request the buffer to be cleared
-- !! Before exiting the script must write 0 at address 0 for normal operation !!
--###############################################################################
HoTT_Sensor = 0
Timer_128 = 100
local function HoTT_Release()
multiBuffer( 0, 0 )
end
local function HoTT_Send(button)
multiBuffer( 5, 0x80+(HoTT_Sensor*16) + button)
end
local function HoTT_Sensor_Inc()
local detected_sensors=multiBuffer( 4 )
local a
if detected_sensors ~= 0xFF then
repeat
HoTT_Sensor=(HoTT_Sensor+1)%7 -- Switch to next sensor
if HoTT_Sensor ~= 0 then
a = math.floor(detected_sensors/ (2^(HoTT_Sensor-1))) -- shift right
end
until HoTT_Sensor==0 or a % 2 == 1
HoTT_Send( 0x0F )
end
end
local function HoTT_Draw_LCD()
local i
local value
@@ -41,12 +63,14 @@ local function HoTT_Draw_LCD()
local result
local offset=0
local sensor_name = { "", "+Vario", "+GPS", "+Cust", "+ESC", "+GAM", "+EAM" }
lcd.clear()
if LCD_W == 480 then
--Draw title
lcd.drawFilledRectangle(0, 0, LCD_W, 30, TITLE_BGCOLOR)
lcd.drawText(1, 5, "Graupner HoTT RX configuration", MENU_TITLE_COLOR)
lcd.drawText(1, 5, "Graupner HoTT: config RX" .. sensor_name[HoTT_Sensor+1] .. " - Menu cycle Sensors", MENU_TITLE_COLOR)
--Draw RX Menu
if multiBuffer( 4 ) == 0xFF then
lcd.drawText(10,50,"No HoTT telemetry...", BLINK)
@@ -56,9 +80,9 @@ local function HoTT_Draw_LCD()
value=multiBuffer( line*21+6+i )
if value > 0x80 then
value = value - 0x80
lcd.drawText(10+i*16,32+16*line,string.char(value).." ",INVERS)
lcd.drawText(10+i*16,32+20*line,string.char(value).." ",INVERS)
else
lcd.drawText(10+i*16,32+16*line,string.char(value))
lcd.drawText(10+i*16,32+20*line,string.char(value))
end
end
end
@@ -68,14 +92,23 @@ local function HoTT_Draw_LCD()
if multiBuffer( 4 ) == 0xFF then
lcd.drawText(2,17,"No HoTT telemetry...",SMLSIZE)
else
for line = 0, 7, 1 do
for i = 0, 21-1, 1 do
value=multiBuffer( line*21+6+i )
if value > 0x80 then
value = value - 0x80
lcd.drawText(2+i*6,1+8*line,string.char(value).." ",SMLSIZE+INVERS)
else
lcd.drawText(2+i*6,1+8*line,string.char(value),SMLSIZE)
if Timer_128 ~= 0 then
--Intro page
Timer_128 = Timer_128 - 1
lcd.drawScreenTitle("Graupner Hott",0,0)
lcd.drawText(2,17,"Configuration of RX" .. sensor_name[HoTT_Sensor+1] ,SMLSIZE)
lcd.drawText(2,37,"Press menu to cycle Sensors" ,SMLSIZE)
else
--Menu page
for line = 0, 7, 1 do
for i = 0, 21-1, 1 do
value=multiBuffer( line*21+6+i )
if value > 0x80 then
value = value - 0x80
lcd.drawText(2+i*6,1+8*line,string.char(value).." ",SMLSIZE+INVERS)
else
lcd.drawText(2+i*6,1+8*line,string.char(value),SMLSIZE)
end
end
end
end
@@ -98,7 +131,10 @@ local function HoTT_Init()
--Request init of the RX buffer
multiBuffer( 4, 0xFF )
--Request RX to send the config menu
multiBuffer( 5, 0xDF )
HoTT_Send( 0x0F )
HoTT_Sensor = 0;
HoTT_Detected_Sensors=0;
Timer_128 = 100
end
-- Main
@@ -111,18 +147,21 @@ local function HoTT_Run(event)
return 2
else
if event == EVT_VIRTUAL_PREV_PAGE then
killEvents(event);
multiBuffer( 5, 0xD7 )
elseif event == EVT_VIRTUAL_NEXT_PAGE then
multiBuffer( 5, 0xDE )
killEvents(event)
HoTT_Send( 0x07 )
elseif event == EVT_VIRTUAL_ENTER then
multiBuffer( 5, 0xD9 )
elseif event == EVT_VIRTUAL_NEXT then
multiBuffer( 5, 0xDD )
HoTT_Send( 0x09 )
elseif event == EVT_VIRTUAL_PREV then
multiBuffer( 5, 0xDB )
HoTT_Send( 0x0B )
elseif event == EVT_VIRTUAL_NEXT then
HoTT_Send( 0x0D )
elseif event == EVT_VIRTUAL_NEXT_PAGE then
HoTT_Send( 0x0E )
elseif event == EVT_VIRTUAL_MENU then
Timer_128 = 100
HoTT_Sensor_Inc()
else
multiBuffer( 5, 0xDF )
HoTT_Send( 0x0F )
end
HoTT_Draw_LCD()
return 0
@@ -164,8 +164,8 @@ end
-- Init function
local function init()
thrCH1 = defaultChannel(2)
rollCH1 = defaultChannel(0)
yawCH1 = defaultChannel(3)
rollCH1 = defaultChannel(3)
yawCH1 = defaultChannel(0)
pitchCH1 = defaultChannel(1)
local ver, radio, maj, minor, rev = getVersion()
-- if string.match(radio, "x7") then