forked from okyeron/oscgrid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
unload.lua
69 lines (53 loc) · 1.02 KB
/
unload.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
-- oscgrid un-loader
-- run this to unload oscgrid from memory
local grds = {}
local g
local grid_w
local grid_h
function init()
disconnect()
get_grid_names()
--tab.print(grds[1])
--tab.print(grid.vports[1].device)
screen.aa(0)
redraw()
end
function get_grid_names()
-- Get a list of grid devices
for id,device in pairs(grid.vports) do
grds[id] = {name = device.name, id = device.id }
--grds[id].id = device.id
end
end
function disconnect()
grid.update_devices()
g = include('lib/oscgrid')
g.grid.remove(2)
g.cleanup()
arc.update_devices()
ar = include('lib/oscarc')
ar.arc.remove(2)
ar.cleanup()
end
function key(n,z)
if n==2 and z==1 then
redraw()
end
end
function grid_key(x, y, s)
if s == 1 then
--print('keyon')
--g:led(x,y,15)
else
--print('keyoff')
--g:led(x,y,0)
end
--print (x .. ' ' .. y .. ' ' .. s)
end
function redraw()
screen.clear()
screen.level(15)
screen.move (0,10)
screen.text('oscgrid unloaded')
screen.update()
end