1
0
mirror of https://github.com/kepler155c/opus synced 2025-10-24 12:17:40 +00:00

relative-gps coord system

This commit is contained in:
kepler155c@gmail.com
2017-05-24 19:48:48 -04:00
parent 64146f8625
commit e6ee432997
11 changed files with 62 additions and 57 deletions

View File

@@ -31,13 +31,13 @@ function GPS.getPoint(timeout, debug)
return pt
end
function GPS.getHeading()
function GPS.getHeading(timeout)
if not turtle then
return
end
local apt = GPS.locate()
local apt = GPS.locate(timeout)
if not apt then
return
end
@@ -67,8 +67,8 @@ function GPS.getHeading()
return 3
end
function GPS.getPointAndHeading()
local heading = GPS.getHeading()
function GPS.getPointAndHeading(timeout)
local heading = GPS.getHeading(timeout)
if heading then
local pt = GPS.getPoint()
if pt then

View File

@@ -1260,6 +1260,8 @@ function UI.Device:runTransitions(transitions, canvas)
canvas:blitClipped(self.device) -- and blit the remainder
canvas:reset()
local queue = { } -- don't miss events while transition is running
-- especially timers
while true do
for _,k in ipairs(Util.keys(transitions)) do
local transition = transitions[k]
@@ -1270,7 +1272,17 @@ function UI.Device:runTransitions(transitions, canvas)
if Util.empty(transitions) then
break
end
os.sleep() -- ?
local timerId = os.startTimer(0)
while true do
local e = { os.pullEvent() }
if e[1] == 'timer' and e[2] == timerId then
break
end
table.insert(queue, e)
end
end
for _, e in ipairs(queue) do
Event.processEvent(e)
end
end