refactor: replace hardcoded channel IDs with dynamic retrieval from platform.channels
This commit is contained in:
@@ -1,9 +1,12 @@
|
|||||||
-- Touch-Enabled Command Center for Pocket Computer (FIXED)
|
-- Touch-Enabled Command Center for Pocket Computer (FIXED)
|
||||||
-- Monitor and control autonomous mining turtles
|
-- Monitor and control autonomous mining turtles
|
||||||
|
|
||||||
local CHANNEL_SEND = 100
|
local Channels = require('platform.channels')
|
||||||
local CHANNEL_RECEIVE = 101
|
local WebBridge = require('platform.webbridge')
|
||||||
local STATUS_CHANNEL = 102
|
|
||||||
|
local CHANNEL_SEND = Channels.get('remoteturtle.command')
|
||||||
|
local CHANNEL_RECEIVE = Channels.get('remoteturtle.response')
|
||||||
|
local STATUS_CHANNEL = Channels.get('remoteturtle.status')
|
||||||
|
|
||||||
local modem = peripheral.find("modem")
|
local modem = peripheral.find("modem")
|
||||||
if not modem then
|
if not modem then
|
||||||
@@ -15,8 +18,10 @@ if pocket then
|
|||||||
modem = peripheral.find("modem")
|
modem = peripheral.find("modem")
|
||||||
end
|
end
|
||||||
|
|
||||||
modem.open(CHANNEL_RECEIVE)
|
WebBridge.openChannels(modem, {
|
||||||
modem.open(STATUS_CHANNEL)
|
'remoteturtle.response',
|
||||||
|
'remoteturtle.status',
|
||||||
|
})
|
||||||
|
|
||||||
local w, h = term.getSize()
|
local w, h = term.getSize()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user