OpenMods / OpenPeripheral-Addons

An addon for OpenPeripheral, adding physical blocks and items to the game
MIT License
11 stars 10 forks source link

Glasses stop syncing if glass.clear() is executed too quickly #32

Closed miyoyo closed 9 years ago

miyoyo commented 10 years ago

If you try to do something like:

local gMain = peripheral.wrap(tArgs[1]) if gMain == nil then term.setCursorPos(term.getSize()-5, 2) termUtils.cWrite("[Fail]\n", colors.red) error("\nBad side or name") else term.setCursorPos(term.getSize()-3, 2) termUtils.cWrite("[OK]\n", colors.green)

termUtils.cWrite("[INIT]Clearing glasses", colors.blue) sleep(0.1) gMain.clear() term.setCursorPos(term.getSize()-3, 3) termUtils.cWrite("[OK]\n", colors.green) end

termUtils.cPrint("[INIT]Testing methods:", colors.blue) termUtils.cWrite("+---+-Boxes", colors.cyan) gMain.addBox(0,0,10,10) gMain.clear() term.setCursorPos(term.getSize()-3, 5) termUtils.cWrite("[OK]\n", colors.green) termUtils.cWrite("| +-------Gradients", colors.cyan) gMain.addGradientBox(0,0,10,10,0x384756,1,0x837465,0.1,0.1) gMain.clear() term.setCursorPos(term.getSize()-3, 6) termUtils.cWrite("+-----Text", colors.cyan) gMain.addText(10, 10, "Text test") gMain.clear() term.setCursorPos(term.getSize()-3, 7) termUtils.cWrite("[OK]\n", colors.green) termUtils.cWrite("+-----Items", colors.cyan) gMain.addIcon(10,10,9514,0) gMain.clear() term.setCursorPos(term.getSize()-3, 8) termUtils.cWrite("[OK]\n", colors.green) termUtils.cWrite("+-----Liquids", colors.cyan) gMain.addLiquid(0,0,10,10,"lava") gMain.clear() term.setCursorPos(term.getSize()-3, 9) termUtils.cWrite("[OK]\n", colors.green) term.setCursorPos(term.getSize()-5, 4) termUtils.cWrite("[DONE]\n", colors.green)

the glasses stop syncing and you must link them again, even if the ID is the same.

you must put a sleep(0.1) between draw calls and clear calls to prevent this from happening

boq commented 9 years ago

Looks like I fixed that with #43. It could've been solved few months earlier, if you included logs (there was very helpful stacktrace in there).