Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# macos
.DS_Store
3 changes: 2 additions & 1 deletion ETHOS/c480x272/SD/scripts/yaaputelemetry/lib/drawlib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ function drawLib.drawStatusBar(widget, y, maxRows)
lcd.drawFilledRectangle(0,y,480,27)

-- flight time
local seconds = model.getTimer("Yaapu"):value()
local timer = model.getTimer("Yaapu")
local seconds = timer ~= nil and timer:value() or 0
local ss = (seconds%3600)%60
local mm = math.floor(seconds/60)
drawLib.drawText(480, y-4, string.format("%02.0f:%02.0f",mm,ss), FONT_XXL, status.colors.barText, RIGHT)
Expand Down
14 changes: 11 additions & 3 deletions ETHOS/c480x272/SD/scripts/yaaputelemetry/lib/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -668,8 +668,13 @@ function utils.calcFLVSSBatt(battIdx)
return 0,0,0
end

local cellMin = system.getSource({name=batterySource:name(),options=OPTION_CELL_LOWEST}):value()
local cellCount = system.getSource({name=batterySource:name(),options=OPTION_CELL_COUNT}):value()
local cellMinSrc = system.getSource({name=batterySource:name(),options=OPTION_CELL_LOWEST})
local cellCountSrc = system.getSource({name=batterySource:name(),options=OPTION_CELL_COUNT})
if cellMinSrc == nil or cellCountSrc == nil then
return 0,0,0
end
local cellMin = cellMinSrc:value()
local cellCount = cellCountSrc:value()
local cellSum = batterySource:value()
statusBattSources.vs = true

Expand Down Expand Up @@ -972,7 +977,10 @@ function utils.pushMessage(severity, msg)
end

function utils.updateFlightTime()
status.flightTime = tonumber(model.getTimer("Yaapu"):value())
local timer = model.getTimer("Yaapu")
if timer ~= nil then
status.flightTime = tonumber(timer:value())
end
end

---------------------------------
Expand Down
8 changes: 6 additions & 2 deletions ETHOS/c480x272/SD/scripts/yaaputelemetry/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -803,8 +803,12 @@ local function task1(now)
local gpsData = {}

if status.conf.gpsSource ~= nil then
gpsData.lat = system.getSource({name=status.conf.gpsSource:name(),options=OPTION_LATITUDE}):value()
gpsData.lon = system.getSource({name=status.conf.gpsSource:name(),options=OPTION_LONGITUDE}):value()
local latSrc = system.getSource({name=status.conf.gpsSource:name(),options=OPTION_LATITUDE})
local lonSrc = system.getSource({name=status.conf.gpsSource:name(),options=OPTION_LONGITUDE})
if latSrc ~= nil and lonSrc ~= nil then
gpsData.lat = latSrc:value()
gpsData.lon = lonSrc:value()
end
end

if gpsData.lat ~= nil and gpsData.lon ~= nil then
Expand Down
3 changes: 2 additions & 1 deletion ETHOS/c480x320/SD/scripts/yaaputelemetry/lib/drawlib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ function drawLib.drawStatusBar(widget, y, maxRows)
lcd.drawFilledRectangle(0,y,480,27)

-- flight time
local seconds = model.getTimer("Yaapu"):value()
local timer = model.getTimer("Yaapu")
local seconds = timer ~= nil and timer:value() or 0
local ss = (seconds%3600)%60
local mm = math.floor(seconds/60)
drawLib.drawText(480, y-4, string.format("%02.0f:%02.0f",mm,ss), FONT_XXL, status.colors.barText, RIGHT)
Expand Down
14 changes: 11 additions & 3 deletions ETHOS/c480x320/SD/scripts/yaaputelemetry/lib/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -668,8 +668,13 @@ function utils.calcFLVSSBatt(battIdx)
return 0,0,0
end

local cellMin = system.getSource({name=batterySource:name(),options=OPTION_CELL_LOWEST}):value()
local cellCount = system.getSource({name=batterySource:name(),options=OPTION_CELL_COUNT}):value()
local cellMinSrc = system.getSource({name=batterySource:name(),options=OPTION_CELL_LOWEST})
local cellCountSrc = system.getSource({name=batterySource:name(),options=OPTION_CELL_COUNT})
if cellMinSrc == nil or cellCountSrc == nil then
return 0,0,0
end
local cellMin = cellMinSrc:value()
local cellCount = cellCountSrc:value()
local cellSum = batterySource:value()
statusBattSources.vs = true

Expand Down Expand Up @@ -972,7 +977,10 @@ function utils.pushMessage(severity, msg)
end

function utils.updateFlightTime()
status.flightTime = tonumber(model.getTimer("Yaapu"):value())
local timer = model.getTimer("Yaapu")
if timer ~= nil then
status.flightTime = tonumber(timer:value())
end
end

---------------------------------
Expand Down
8 changes: 6 additions & 2 deletions ETHOS/c480x320/SD/scripts/yaaputelemetry/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -802,8 +802,12 @@ local function task1(now)
local gpsData = {}

if status.conf.gpsSource ~= nil then
gpsData.lat = system.getSource({name=status.conf.gpsSource:name(),options=OPTION_LATITUDE}):value()
gpsData.lon = system.getSource({name=status.conf.gpsSource:name(),options=OPTION_LONGITUDE}):value()
local latSrc = system.getSource({name=status.conf.gpsSource:name(),options=OPTION_LATITUDE})
local lonSrc = system.getSource({name=status.conf.gpsSource:name(),options=OPTION_LONGITUDE})
if latSrc ~= nil and lonSrc ~= nil then
gpsData.lat = latSrc:value()
gpsData.lon = lonSrc:value()
end
end

if gpsData.lat ~= nil and gpsData.lon ~= nil then
Expand Down
3 changes: 2 additions & 1 deletion ETHOS/c800x480/SD/scripts/yaaputelemetry/lib/drawlib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ function drawLib.drawStatusBar(widget, y, maxRows)
lcd.drawFilledRectangle(0,y,800,48)

-- flight time
local seconds = model.getTimer("Yaapu"):value()
local timer = model.getTimer("Yaapu")
local seconds = timer ~= nil and timer:value() or 0
local ss = (seconds%3600)%60
local hh = math.floor(seconds/3600)
local mm = math.floor((seconds%3600)/60)
Expand Down
14 changes: 11 additions & 3 deletions ETHOS/c800x480/SD/scripts/yaaputelemetry/lib/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -668,8 +668,13 @@ function utils.calcFLVSSBatt(battIdx)
return 0,0,0
end

local cellMin = system.getSource({name=batterySource:name(),options=OPTION_CELL_LOWEST}):value()
local cellCount = system.getSource({name=batterySource:name(),options=OPTION_CELL_COUNT}):value()
local cellMinSrc = system.getSource({name=batterySource:name(),options=OPTION_CELL_LOWEST})
local cellCountSrc = system.getSource({name=batterySource:name(),options=OPTION_CELL_COUNT})
if cellMinSrc == nil or cellCountSrc == nil then
return 0,0,0
end
local cellMin = cellMinSrc:value()
local cellCount = cellCountSrc:value()
local cellSum = batterySource:value()
statusBattSources.vs = true

Expand Down Expand Up @@ -972,7 +977,10 @@ function utils.pushMessage(severity, msg)
end

function utils.updateFlightTime()
status.flightTime = tonumber(model.getTimer("Yaapu"):value())
local timer = model.getTimer("Yaapu")
if timer ~= nil then
status.flightTime = tonumber(timer:value())
end
end

---------------------------------
Expand Down
8 changes: 6 additions & 2 deletions ETHOS/c800x480/SD/scripts/yaaputelemetry/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -802,8 +802,12 @@ local function task1(now)
local gpsData = {}

if status.conf.gpsSource ~= nil then
gpsData.lat = system.getSource({name=status.conf.gpsSource:name(),options=OPTION_LATITUDE}):value()
gpsData.lon = system.getSource({name=status.conf.gpsSource:name(),options=OPTION_LONGITUDE}):value()
local latSrc = system.getSource({name=status.conf.gpsSource:name(),options=OPTION_LATITUDE})
local lonSrc = system.getSource({name=status.conf.gpsSource:name(),options=OPTION_LONGITUDE})
if latSrc ~= nil and lonSrc ~= nil then
gpsData.lat = latSrc:value()
gpsData.lon = lonSrc:value()
end
end

if gpsData.lat ~= nil and gpsData.lon ~= nil then
Expand Down