Initial commit

This commit is contained in:
kepler155c@gmail.com
2016-12-11 14:24:52 -05:00
commit fc243a9c12
110 changed files with 25577 additions and 0 deletions

40
sys/extensions/tgps.lua Normal file
View File

@@ -0,0 +1,40 @@
if not turtle then
return
end
require = requireInjector(getfenv(1))
local GPS = require('gps')
function turtle.enableGPS()
local pt = GPS.getPointAndHeading()
if pt then
turtle.setPoint(pt)
return true
end
end
function turtle.gotoGPSHome()
local homePt = turtle.loadLocation('gpsHome')
if homePt then
local pt = GPS.getPointAndHeading()
if pt then
turtle.setPoint(pt)
turtle.pathfind(homePt)
end
end
end
function turtle.setGPSHome()
local GPS = require('gps')
local pt = GPS.getPoint()
if pt then
turtle.setPoint(pt)
pt.heading = GPS.getHeading()
if pt.heading then
turtle.point.heading = pt.heading
turtle.storeLocation('gpsHome', pt)
turtle.gotoPoint(pt)
end
end
end