Skip to content

Commit

Permalink
FrSky_S8R: screen layout updates and file re-org (#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
offer-shmuely authored Dec 15, 2024
1 parent 76473fe commit 25c062e
Show file tree
Hide file tree
Showing 11 changed files with 523 additions and 466 deletions.
445 changes: 0 additions & 445 deletions sdcard/c480x272/SCRIPTS/TOOLS/FrSky_S8R_S6R/S8R_setup.lua

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@
chdir("/SCRIPTS/TOOLS/FrSky_S8R_S6R")

local VALUE = 0

local refreshState = 0
local refreshIndex = 0
local calibrationState = 0
local calibrationStep = 0
local modifications = {}

local calibrationPositions = { "up", "down", "left", "right", "forward", "back" }

local calibBitmaps = {}
local calibBitmapsFile = { "img/up.png", "img/down.png", "img/left.png", "img/right.png", "img/forward.png", "img/back.png" }
local calibBitmapsFile = { "img/rx_up.png", "img/rx_down.png", "img/rx_left.png", "img/rx_right.png", "img/rx_forward.png", "img/rx_back.png" }
local telemetryPopTimeout = 0

local fields = {
{ "X", VALUE, 0x9E, 0, -100, 100, "%" },
Expand All @@ -43,12 +41,6 @@ local fields_needed_state = {
{-100, 0, 0}, -- 4
{ 0, -100, 0}, -- 5
{ 0, 100, 0}, -- 6
--{{"X", 0},{"Y", 0},{"Z", 100}}, -- 1
--{{"X", 0},{"Y", 0},{"Z",-100}}, -- 2
--{{"X", 100},{"Y", 0},{"Z", 0}}, -- 3
--{{"X",-100},{"Y", 0},{"Z", 0}}, -- 4
--{{"X", 0},{"Y",-100},{"Z", 0}}, -- 5
--{{"X", 0},{"Y", 100},{"Z", 0}}, -- 6
}

local function telemetryRead(field)
Expand All @@ -59,8 +51,6 @@ local function telemetryWrite(field, value)
return sportTelemetryPush(0x17, 0x31, 0x0C30, field + value * 256)
end

local telemetryPopTimeout = 0

local function refreshNext()
if refreshState == 0 then
if calibrationState == 1 then
Expand Down Expand Up @@ -175,22 +165,22 @@ local function refreshPage(event)
-- expected pos
lcd.drawFilledRectangle(prog_m + x_pos_expected - mark_w_half +1, 80 + 25 * index - 0 +1, mark_w -2, 18 -2, LIGHTGREY);
-- current pos (+ shade)
lcd.drawFilledRectangle(prog_m + x_pos - mark_w_half +1 +4, 80 + 25 * index - 0 +1 +4, mark_w -8, 18 -8, GREY);
lcd.drawFilledRectangle(prog_m + x_pos - mark_w_half +4, 80 + 25 * index - 0 +4, mark_w -8, 18 -8, bg_color);
lcd.drawFilledRectangle(prog_m + x_pos - mark_w_half +1 +2, 80 + 25 * index - 0 +1 +2, mark_w -4, 18 -4, GREY);
lcd.drawFilledRectangle(prog_m + x_pos - mark_w_half +2, 80 + 25 * index - 0 +2, mark_w -4, 18 -4, bg_color);
-- middle mark
lcd.drawFilledRectangle(prog_m -1, 80 + 25 * index - 0, 2, 18, BLACK);
end

if (is_all_v_align) then
if calibrationState == 0 then
lcd.drawFilledRectangle(150, 215, 200, 30, GREEN);
lcd.drawFilledRectangle(150, 225, 200, 30, GREEN);
else
lcd.drawFilledRectangle(150, 215, 200, 30, ORANGE);
lcd.drawFilledRectangle(150, 225, 200, 30, ORANGE);
end
lcd.drawText(160, 220, "Ready! press [Enter]")
lcd.drawText(160, 230, "Ready! press [Enter]")
else
lcd.drawFilledRectangle(150, 215, 200, 30, BLACK);
lcd.drawText(160, 220, "Press [Enter] when 3 greens", WHITE)
lcd.drawFilledRectangle(150, 225, 215, 30, BLACK);
lcd.drawText(160, 230, "Press [Enter] when 3 greens", WHITE)
end
else
lcd.drawText(160, 50, "Calibration completed", 0)
Expand Down Expand Up @@ -233,6 +223,8 @@ local function run(event)

local result = refreshPage(event)
refreshNext()
--lcd.drawText(10, 220, "refreshState: " .. refreshState, GREY + SMLSIZE)
--lcd.drawText(10, 240, "calibrationState: " .. calibrationState, GREY + SMLSIZE)

return result
end
Expand Down
Loading

0 comments on commit 25c062e

Please sign in to comment.