fix: 即使无法获取GPS信号也上报机器在线状态,并升级版本至v1.5.18
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
local DEFAULT_SERVER_BASE = "http://ticket.fse-media.group"
|
||||
local DEFAULT_SERVER_PATH = "/api/tickets/check"
|
||||
local GATE_OPEN_SECONDS = 2
|
||||
local VERSION = "v1.5.17"
|
||||
local VERSION = "v1.5.18"
|
||||
local VERSION_CHECK_INTERVAL = 5
|
||||
|
||||
local CONFIG_PATH = "gate_config.json"
|
||||
@@ -192,6 +192,7 @@ local function checkAndApplyUpdate()
|
||||
print("OTA Update Error: " .. tostring(res))
|
||||
term.setTextColor(colors.white)
|
||||
end
|
||||
sleep(3)
|
||||
end
|
||||
else
|
||||
lastUpdateError = "loadfile failed: " .. tostring(err)
|
||||
@@ -200,6 +201,7 @@ local function checkAndApplyUpdate()
|
||||
print("OTA Update Error: " .. tostring(err))
|
||||
term.setTextColor(colors.white)
|
||||
end
|
||||
sleep(3)
|
||||
end
|
||||
|
||||
isUpdating = false
|
||||
@@ -1521,24 +1523,23 @@ end
|
||||
|
||||
local function backgroundLocationSyncTask()
|
||||
sleep(5)
|
||||
local x, y, z
|
||||
if gps and type(gps.locate) == "function" then
|
||||
local x, y, z = gps.locate(2)
|
||||
if x and y and z then
|
||||
local label = os.getComputerLabel()
|
||||
if not label or label == "" then label = "#" .. tostring(os.getComputerID()) end
|
||||
local payload = {
|
||||
device_id = label,
|
||||
type = "Gate",
|
||||
gate_mode = modeBySide and "bidirectional" or mode,
|
||||
station_code = stationCodeForSide(nil) or "",
|
||||
x = x,
|
||||
y = y,
|
||||
z = z
|
||||
}
|
||||
local serverBase = guessBaseFromStatusURL(serverURL)
|
||||
pcall(postCheck, serverBase .. '/api/machine-location', payload)
|
||||
end
|
||||
x, y, z = gps.locate(2)
|
||||
end
|
||||
local label = os.getComputerLabel()
|
||||
if not label or label == "" then label = "#" .. tostring(os.getComputerID()) end
|
||||
local payload = {
|
||||
device_id = label,
|
||||
type = "Gate",
|
||||
gate_mode = modeBySide and "bidirectional" or mode,
|
||||
station_code = stationCodeForSide(nil) or "",
|
||||
x = x,
|
||||
y = y,
|
||||
z = z
|
||||
}
|
||||
local serverBase = guessBaseFromStatusURL(serverURL)
|
||||
pcall(postCheck, serverBase .. '/api/machine-location', payload)
|
||||
while true do
|
||||
sleep(86400)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user