- Sky
- Blueberry
- Slate
- Blackcurrant
- Watermelon
- Strawberry
- Orange
- Banana
- Apple
- Emerald
- Chocolate
- Charcoal
-
Content Count
3 -
Joined
-
Last visited
Posts posted by HerrCrazi
-
-
Unfortunately this did not solve the problem. It seems that term.bind actually does nothing. If the terminal was bound to the correct GPU during boot, everything will work fine, else it won't.
Here's another screenshot illustrating that weird behavior :
term.bind doesn't seems to act in any way on which GPU the terminal is bound to.
Should I open an issue ?
-
Hi everyone !
First of all, I should precise that I'm quite new to OC and Lua, but already used to programming in general.
What I'm trying to do :
I have a basic setup with a computer and a screen attached to it. Another screen (a larger one) is connected via a network cable. Both screens have a keyboard attached to them, and the computer have two graphic cards (one per screen), one is a Tier 3 card and the other a Tier 2.
I would like to be able to use the big screen for displaying informations about my power plant, and the smaller one to control the computer (ie. the terminal should live in the smaller screen). Unfortunately when booting, the terminal attaches to a random GPU and a random screen. Sometimes it's on the large screen, sometimes on the small one. That led me to create a startup script that would care of binding the correct screen to the correct GPU (the large screen with the T3 GPU), and make the terminal use the smaller screen.
Problem is that anything seems to apply. After having bound the screen and GPU to the terminal with term.bind(screen, gpu) , nothing changes. term.screen and term.gpu stay the same, and nothing actually happens to the terminal. It just stays on the screen it booted on.
Here's a screenshot of what is currently happening (the larger screen is referred as "Auxiliary screen" and the smaller as "Master screen")
As you can see, primary GPU, screen and keyboard components refers to the correct devices, but aren't used (the shell is still on the large screen). term.gpu/screen/keyboard returns the same adresses as before running the script.
The code I've written so far :
local component = require("component") local term = require("term") local gpus = component.list("gpu") local screens = component.list("screen") local mgpu, mscreen --Master local sgpu, sscreen --Aux. --Finding the GPUs for addr, type in gpus do print("GPU found : @" .. addr) local gpu = component.proxy(addr) local vx,vy = gpu.getViewport() print(" Viewport : " .. vx .. "," .. vy) if gpu.slot == 0 then print(" Master GPU (slot 0)") mgpu = gpu elseif gpu.slot == 1 then print(" Auxilliary GPU (slot 1)") sgpu = gpu end end --Finding the screens local maxScreenSize = 0 for addr, type in screens do local screen = component.proxy(addr) local w,h = screen.getAspectRatio() print("Screen found : " .. w .. "," .. h .. " @" .. screen.address) if (w*h) > maxScreenSize then if mscreen then sscreen = mscreen end maxScreenSize = w*h mscreen = screen else sscreen = screen end local keyboards = screen.getKeyboards() for i,addr in ipairs(keyboards) do print(" Keyboard : @" .. addr) end if not keyboards[1] then print("Warning : no keyboard found for this screen : " .. screen.address) end end print("Master screen : @" .. mscreen.address) print("Aux. screen : @" .. sscreen.address) io.read() --used to prevent the screen to be cleared when switched without leaving time to read the above adresses --Bind the correct screens to the correct GPUs mgpu.bind(mscreen.address, false) sgpu.bind(sscreen.address, false) mgpu.setResolution(155,45) sgpu.setResolution(50,25) --Set the default components the terminal should use component.setPrimary("gpu", sgpu.address) os.sleep(0.05) component.setPrimary("screen", sscreen.address) os.sleep(0.05) component.setPrimary("keyboard", component.invoke(sgpu.getScreen(), "getKeyboards")[1]) term.bind(sgpu, sscreen, component.invoke(sgpu.getScreen(), "getKeyboards")[1]) os.sleep(0.05) print("Initialization complete !") --This should always be printed on the small screen (hint: it isn't. :( )
I'd be glad if someone could find a solution to that. Thnaks by advance for your answers
Greetings form France
Edit : fixed an error about term.gpu/screen/keyboard
Switching the screen the terminal is bound to.
in Programming
Posted
Thank you for your answer ! Your workaround with tty windows worked perfectly for me.
Just two things to mention :
Again thanks you very much !