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)
-- Monitor and control autonomous mining turtles
local CHANNEL_SEND = 100
local CHANNEL_RECEIVE = 101
local STATUS_CHANNEL = 102
local Channels = require('platform.channels')
local WebBridge = require('platform.webbridge')
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")
if not modem then
@@ -15,8 +18,10 @@ if pocket then
modem = peripheral.find("modem")
end
modem.open(CHANNEL_RECEIVE)
modem.open(STATUS_CHANNEL)
WebBridge.openChannels(modem, {
'remoteturtle.response',
'remoteturtle.status',
})
local w, h = term.getSize()