fix: Enhance GPS position retrieval with increased timeout and logging
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user