refactor: replace hardcoded channel IDs with dynamic retrieval from platform.channels

This commit is contained in:
MayaTheShy
2026-03-26 15:22:36 -04:00
parent 92ea13a680
commit c4b9509b5c

View File

@@ -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()