Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wing wizard & plane wizard & dirs #107

Merged
merged 43 commits into from
Sep 2, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
0b2f353
new Rotary Gauge widget
offer-shmuely-cognyte Apr 26, 2022
cbf4c49
Rotary Gauge widget: less ticks on small size
offer-shmuely-cognyte May 1, 2022
4b6b883
new Rotary Gauge widget
offer-shmuely-cognyte May 1, 2022
4da81b3
new Rotary Gauge widget
offer-shmuely-cognyte May 6, 2022
74724ee
Merge branch 'EdgeTX:master' into master
offer-shmuely May 12, 2022
de3a49d
Merge branch 'EdgeTX:master' into master
offer-shmuely Jul 9, 2022
556da6c
Merge branch 'EdgeTX:master' into master
offer-shmuely Jul 24, 2022
371c347
Merge branch 'EdgeTX:master' into master
offer-shmuely Aug 21, 2022
6810b35
Merge branch 'EdgeTX:master' into master
offer-shmuely Sep 12, 2022
e4c197e
Merge branch 'EdgeTX:master' into master
offer-shmuely Oct 1, 2022
1a4f3e0
Merge branch 'EdgeTX:master' into master
offer-shmuely Oct 18, 2022
05212a0
Merge branch 'EdgeTX:master' into master
offer-shmuely Oct 19, 2022
cfaa10e
Merge branch 'EdgeTX:master' into master
offer-shmuely Dec 30, 2022
a065761
Merge branch 'EdgeTX:master' into master
offer-shmuely Jan 26, 2023
bfe1248
Merge branch 'EdgeTX:master' into master
offer-shmuely Feb 1, 2023
07b65c8
Merge branch 'EdgeTX:master' into master
offer-shmuely Feb 23, 2023
7f46640
Merge branch 'EdgeTX:master' into master
offer-shmuely Mar 31, 2023
a984247
wing wizard support
Apr 26, 2023
af11816
wing wizard support
Apr 29, 2023
85c6c14
Mix values didn't match companion wing wizard
pfeerick May 30, 2023
d0d9bd7
Add touch zone to loader for wing wizard
pfeerick May 30, 2023
aa3ec6b
wing wizard: fix expo values on review page
May 30, 2023
90d10bb
wing wizard: choose channel based on stick mode
May 30, 2023
ca87f13
wing wizard: fix creation error
May 31, 2023
69e5dfb
wing wizard: nice base telemetry screen
May 31, 2023
eb920d1
wing wizard: fix expo
Jun 1, 2023
4d0fce2
wind wizard: better code style & telemetry screen & low voltage warning
Jun 5, 2023
fd536e8
wind wizard: revert Wizard loader
Jun 10, 2023
e6d3ea1
wing wizard: move wing wizard to the new location
Jun 10, 2023
baa94d5
wing wizard: reorder wizard elements
Jun 10, 2023
4dbf41c
wing wizard: reorder wizard elements
Jun 10, 2023
9f799dc
wing wizard: move wing wizard to the new location
Jun 14, 2023
49458da
wizards: directory restructure
Jun 16, 2023
ebcfbd7
plane wizards:
Jun 16, 2023
cda64a7
plane wizards:
Jun 24, 2023
3b99cb7
plane wizards:
Jun 24, 2023
74c4dca
plane wizards: no dual-rate on rudder
Jun 25, 2023
b827286
Merge branch 'EdgeTX:master' into shmuely/wing_wizard
offer-shmuely Jun 25, 2023
46bcaa6
plane wizards: no dual-rate on rudder
Jul 4, 2023
ef062cf
plane wizards: Hold [RTN] to exit
Jul 31, 2023
f56b967
plane wizards: remove telemetrySensors
Jul 31, 2023
6e296b6
plane wizards: verify inputs have trim-on
Aug 22, 2023
8738208
plane wizards: arm switch checks
Aug 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
new Rotary Gauge widget
  • Loading branch information
offer-shmuely-cognyte committed Apr 26, 2022
commit 0b2f353e1339a5eeae95308258a4c474776da4c6
165 changes: 165 additions & 0 deletions sdcard/horus/WIDGETS/GaugeRotary/gauge_core.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
local HighAsGreen, p2 = ...

local self = {}
self.HighAsGreen = HighAsGreen

--------------------------------------------------------------
local function log(s)
--return;
print("Gauge_core: " .. s)
end
--------------------------------------------------------------

function self.drawArm(armX, armY, armR, percentageValue, color, isFull)
--min = 5.54
--max = 0.8

local degrees
if isFull then
degrees = 5.51 - (4.74 * percentageValue / 100)
else
--degrees = 4.74 - (3.14 * percentageValue / 100)
degrees = 5.05 - (3.84 * percentageValue / 100)
end

--log("percentageValue: " .. percentageValue .. ", degrees: " .. degrees)
local xh = math.floor(armX + (math.sin(degrees) * armR))
local yh = math.floor(armY + (math.cos(degrees) * armR))

--lcd.setColor(CUSTOM_COLOR, lcd.RGB(0, 0, 255))
--lcd.setColor(CUSTOM_COLOR, lcd.RGB(255, 255, 255))
lcd.setColor(CUSTOM_COLOR, color)

local x1 = math.floor(armX - (math.sin(0) * (20 / 2.3)))
local y1 = math.floor(armY - (math.cos(0) * (20 / 2.3)))
local x2 = math.floor(armX - (math.sin(3) * (20 / 2.3)))
local y2 = math.floor(armY - (math.cos(3) * (20 / 2.3)))
lcd.drawFilledTriangle(x1, y1, x2, y2, xh, yh, CUSTOM_COLOR)
end

-- This function returns green at gvalue, red at rvalue and graduate in between
function self.getRangeColor(value, red_value, green_value)
local range = math.abs(green_value - red_value)
if range == 0 then
return lcd.RGB(0, 0xdf, 0)
end
if value == nil then
return lcd.RGB(0, 0xdf, 0)
end

if green_value > red_value then
if value > green_value then
return lcd.RGB(0, 0xdf, 0)
end
if value < red_value then
return lcd.RGB(0xdf, 0, 0)
end
g = math.floor(0xdf * (value - red_value) / range)
r = 0xdf - g
return lcd.RGB(r, g, 0)
else
if value < green_value then
return lcd.RGB(0, 0xdf, 0)
end
if value > red_value then
return lcd.RGB(0xdf, 0, 0)
end
r = math.floor(0xdf * (value - green_value) / range)
g = 0xdf - r
return lcd.RGB(r, g, 0)
end
end

function self.drawGauge(centerX, centerY, centreR, isFull, percentageValue, percentageValueMin, percentageValueMax, txt1, txt2)

local fender = 4
local tickWidth = 9
local armCenterR = centreR / 2.5
local armR = centreR - 8
local txtSize = DBLSIZE
if centreR < 65 then
txtSize = MIDSIZE
end
if centreR < 30 then
txtSize = SMLSIZE
end

-- main gauge background
if isFull then
lcd.drawFilledCircle(centerX, centerY, centreR, lcd.RGB(0x1A1A1A))
else
lcd.drawPie(centerX,centerY,centreR, -110,110, lcd.RGB(0x1A1A1A))
end

-- fender
if isFull then
lcd.drawAnnulus(centerX, centerY, centreR - fender, centreR, 0, 360, BLACK)
else
lcd.drawAnnulus(centerX, centerY, centreR - fender, centreR, -110, 110, BLACK)
end

-- ticks
local to_tick
local tick_offset
if isFull then
to_tick = 210
tick_offset = 250
else
to_tick = 210
tick_offset = 250
end

for i = 0, to_tick, 10 do
--log("HighAsGreen: " .. self.HighAsGreen)
if (self.HighAsGreen == 1) then
lcd.setColor(CUSTOM_COLOR, self.getRangeColor(i, 0, to_tick - 10))
else
lcd.setColor(CUSTOM_COLOR, self.getRangeColor(i, to_tick - 10, 0))
--lcd.setColor(CUSTOM_COLOR, self.getRangeColor(i, 120 , 30))
end
lcd.drawAnnulus(centerX, centerY, centreR - fender - 3 - tickWidth, centreR - fender - 3, tick_offset + i, tick_offset + i + 7, CUSTOM_COLOR)
--lcd.drawAnnulus(centerX, centerY, centreR -fender -3 -tickWidth, centreR -fender -3 , 250 +i, 250 +i +7, YELLOW)
--lcd.drawAnnulus(centerX, centerY, centreR -fender -3 -tickWidth -15, centreR -fender -3 -tickWidth -4 , 250 +i, 250 +i +7, RED)
end
--lcd.drawPie(centerX,centerY,centreR - fender, 0,20)

local armColor = lcd.RGB(255, 255, 255)
local armColorMin, armColorMax
if (self.HighAsGreen == 1) then
armColorMin = lcd.RGB(100, 0, 0)
armColorMax = lcd.RGB(0, 100, 0)
else
armColorMin = lcd.RGB(0, 100, 0)
armColorMax = lcd.RGB(100, 0, 0)
end

--self.drawArm(centerX, centerY, armR, 0, armColorMin, isFull)
--self.drawArm(centerX, centerY, armR, 10, armColorMin, isFull)
--self.drawArm(centerX, centerY, armR, 50, armColorMin, isFull)
--self.drawArm(centerX, centerY, armR, 90, armColorMin, isFull)
--self.drawArm(centerX, centerY, armR, 100, armColorMin, isFull)

if percentageValueMin ~= nil and percentageValueMax ~= nil then
self.drawArm(centerX, centerY, armR, percentageValueMin, armColorMin, isFull)
self.drawArm(centerX, centerY, armR, percentageValueMax, armColorMax, isFull)
end
self.drawArm(centerX, centerY, armR, percentageValue, armColor, isFull)

-- hide the base of the arm
lcd.drawFilledCircle(centerX, centerY, armCenterR, BLACK)

if isFull then
else
end

-- text in center
lcd.drawText(centerX + 0, centerY - 8, txt2, CENTER + SMLSIZE + WHITE) -- XXLSIZE/DBLSIZE/MIDSIZE/SMLSIZE
if isFull then
-- text below
lcd.drawText(centerX + 8, centerY + 30, txt1, CENTER + txtSize + WHITE)
else
end

end

return self
Loading