fix: Enhance GPS position retrieval with increased timeout and logging

This commit is contained in:
MayaTheShy
2026-02-16 00:34:35 -05:00
parent 9f9abb45ec
commit 94713539da

View File

@@ -54,15 +54,19 @@ print("ID: " .. os.getComputerID())
-- GPS Functions
local function updatePosition()
local x, y, z = gps.locate(2)
print("Requesting GPS position...")
local x, y, z = gps.locate(10) -- Increased timeout to 10 seconds
if x then
state.position = {x = math.floor(x), y = math.floor(y), z = math.floor(z)}
print("GPS position: " .. x .. ", " .. y .. ", " .. z)
return true
end
print("GPS timeout - no position received")
return false
end
local function setHome()
print("Setting home position...")
if updatePosition() then
state.homePosition = {
x = state.position.x,