Swshop: Configurable lamp side

This commit is contained in:
Anavrins
2020-03-24 00:09:51 -04:00
parent 2dc74d80ea
commit 996b8c1cd3
2 changed files with 19 additions and 5 deletions

View File

@@ -33,8 +33,22 @@ local wizardPage = UI.WizardPage {
limit = 64, limit = 64,
}, },
[4] = UI.Chooser { [4] = UI.Chooser {
formLabel = 'RS Signal', formKey = 'rsSide', formIndex = 5,
width = 10,
nochoice = 'Top',
choices = {
{name = 'Bottom', value = 'bottom'},
{name = 'Top', value = 'top'},
{name = 'Back', value = 'back'},
{name = 'Front', value = 'front'},
{name = 'Right', value = 'right'},
{name = 'Left', value = 'left'},
},
required = true,
},
[5] = UI.Chooser {
width = 9, width = 9,
formIndex = 5, formIndex = 6,
formLabel = 'Font Size', formKey = 'textScale', formLabel = 'Font Size', formKey = 'textScale',
nochoice = 'Small', nochoice = 'Small',
choices = { choices = {

View File

@@ -19,7 +19,7 @@ local textutils = _G.textutils
local chat = device['plethora:chat'] local chat = device['plethora:chat']
local storage = Config.load('storage') local storage = Config.load('storage')
rs.setOutput('top', false) Util.each(rs.getSides(), function(side) rs.setOutput(side, false) end)
r.init(jua) r.init(jua)
w.init(jua) w.init(jua)
@@ -31,7 +31,7 @@ local privatekey = config.isPrivateKey and config.password or Krist.toKristWalle
local address = Krist.makev2address(privatekey) local address = Krist.makev2address(privatekey)
jua.on("terminate", function() jua.on("terminate", function()
rs.setOutput('top', false) rs.setOutput(config.rsSide, false)
jua.stop() jua.stop()
_G.printError("Terminated") _G.printError("Terminated")
end) end)
@@ -144,7 +144,7 @@ local function connect()
assert(success, "Failed to get websocket URL") assert(success, "Failed to get websocket URL")
print("Connected to websocket.") print("Connected to websocket.")
rs.setOutput('top', true) rs.setOutput(config.rsSide, true)
success = await(ws.subscribe, "ownTransactions", function(data) success = await(ws.subscribe, "ownTransactions", function(data)
local transaction = data.transaction local transaction = data.transaction
@@ -160,7 +160,7 @@ local s, m = pcall(function()
end) end)
end) end)
rs.setOutput('top', false) rs.setOutput(config.rsSide, false)
if not s then if not s then
error(m, 2) error(m, 2)
end end