Small changes
This commit is contained in:
parent
26c20bcdf7
commit
d28d55ab4b
@ -58,7 +58,6 @@ function love.mqtt.message(topic, payload)
|
|||||||
BotState.servoBattery = tonumber(payload)
|
BotState.servoBattery = tonumber(payload)
|
||||||
BotState.servoBatteryCorrected = BotState.servoBattery / 2
|
BotState.servoBatteryCorrected = BotState.servoBattery / 2
|
||||||
elseif topic == "telemetry/camfeed" then
|
elseif topic == "telemetry/camfeed" then
|
||||||
print("Got camfeed")
|
|
||||||
fileData = love.filesystem.newFileData(payload, "camfeed")
|
fileData = love.filesystem.newFileData(payload, "camfeed")
|
||||||
BotState.camfeed = love.graphics.newImage(fileData)
|
BotState.camfeed = love.graphics.newImage(fileData)
|
||||||
elseif topic == "telemetry/pong" then
|
elseif topic == "telemetry/pong" then
|
||||||
|
@ -33,6 +33,9 @@ end
|
|||||||
|
|
||||||
-- Receive given amount of data from network connection
|
-- Receive given amount of data from network connection
|
||||||
function luasocket.receive(conn, size)
|
function luasocket.receive(conn, size)
|
||||||
|
if math.random(0, 100) < 50 then
|
||||||
|
return nil, "timeout"
|
||||||
|
end
|
||||||
local ok, err = conn.sock:receive(size)
|
local ok, err = conn.sock:receive(size)
|
||||||
--if ok then
|
--if ok then
|
||||||
-- print(" luasocket.receive good:", size, #ok, require("mqtt.tools").hex(ok))
|
-- print(" luasocket.receive good:", size, #ok, require("mqtt.tools").hex(ok))
|
||||||
|
@ -16,7 +16,6 @@ local function call(target, ...)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function onConnect(connack)
|
local function onConnect(connack)
|
||||||
print("On connect")
|
|
||||||
call("connect", connack)
|
call("connect", connack)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -24,7 +23,6 @@ local function onMessage(message)
|
|||||||
if message.topic:sub(0, 7) == "spider/" then
|
if message.topic:sub(0, 7) == "spider/" then
|
||||||
message.topic = message.topic:sub(8)
|
message.topic = message.topic:sub(8)
|
||||||
end
|
end
|
||||||
print(message.topic)
|
|
||||||
call("message2", message.topic, message.payload)
|
call("message2", message.topic, message.payload)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user