Compare commits
749 Commits
Author | SHA1 | Date |
---|---|---|
|
f17d137d25 | |
|
1fbde2d366 | |
|
e8da086707 | |
|
56310b6969 | |
|
f95c033165 | |
|
93cc0d4151 | |
|
920c257bf1 | |
|
0021bd7512 | |
|
19c5ee3540 | |
|
ae02e3de44 | |
|
eb78341275 | |
|
b43e97bad4 | |
|
344e367cd9 | |
|
93b33f09e2 | |
|
72e91a41fb | |
|
02e697822b | |
|
71e541afb5 | |
|
25ba26b063 | |
|
f775c330a6 | |
|
25f0cce1ff | |
|
6d99122a33 | |
|
1d2a65867b | |
|
498b585b67 | |
|
93ac73f69e | |
|
d40957063c | |
|
34dfb25f57 | |
|
e771056313 | |
|
9a526eac71 | |
|
2866eaa2ef | |
|
e6c65650de | |
|
bc71d86ee6 | |
|
e9b89bd10b | |
|
ff927564b6 | |
|
4b0cc2e766 | |
|
bf5b927cb3 | |
|
c4b175866d | |
|
8de80ab44d | |
|
31adb77f90 | |
|
9515232d12 | |
|
2b2fc66581 | |
|
78aa627c5d | |
|
0eaefb2b48 | |
|
b51b7e8481 | |
|
c365eff6a7 | |
|
4149d77d70 | |
|
28a323f4f8 | |
|
09d7274bce | |
|
af97f5da1e | |
|
16b7a7def2 | |
|
320e38bfd8 | |
|
1f18b59f9d | |
|
750cd3e67c | |
|
b4271c3c86 | |
|
73418031ae | |
|
95f8674d72 | |
|
689447611a | |
|
8de61abd7b | |
|
0b59f4906f | |
|
7cecef3de5 | |
|
35d832f965 | |
|
c3d2943dcc | |
|
abc72087b2 | |
|
f594472fd2 | |
|
29cd83eecf | |
|
c0e7422920 | |
|
84fe1b71be | |
|
966f67882a | |
|
b858c9fba0 | |
|
d1028a7e02 | |
|
603d5b0219 | |
|
df66ff1c7d | |
|
e6ef1ff395 | |
|
8e9a57bcd3 | |
|
4dc988c5bb | |
|
bc081cfe63 | |
|
6c8d2d712d | |
|
b4a974a33e | |
|
b21b899303 | |
|
5597aea828 | |
|
5d31bf0020 | |
|
91ad944c46 | |
|
cb63194fc6 | |
|
7f8a9d4289 | |
|
8e8fac92d1 | |
|
7e24c70454 | |
|
a9f20ebf36 | |
|
4b8c8ee842 | |
|
5bad15a79a | |
|
9b7d1a3e5c | |
|
5f7fa6287f | |
|
2af8b4b209 | |
|
66096fa2ea | |
|
18875a01c6 | |
|
7d2c2b9d09 | |
|
67a290a02a | |
|
63f4278b2b | |
|
6778f871db | |
|
edc72a5486 | |
|
2779258111 | |
|
da735779b4 | |
|
b7e2e912f4 | |
|
d34172d8e9 | |
|
f30ce78f9d | |
|
ed767aedb5 | |
|
ab35895cb3 | |
|
1e2b65644d | |
|
3f58bbc617 | |
|
c1da7b53a2 | |
|
4181c22995 | |
|
d31ac53bd1 | |
|
9b954852aa | |
|
3758916fb5 | |
|
25c1395655 | |
|
440edd7b18 | |
|
a2f045841f | |
|
c890107e1e | |
|
a5df1650b9 | |
|
173ce499bc | |
|
33412b0588 | |
|
3c5e31a961 | |
|
39676f9a06 | |
|
0f893d94c4 | |
|
b08f5094d5 | |
|
70e046eeb7 | |
|
58d0742187 | |
|
f84e8b741a | |
|
fcf24b5539 | |
|
128a4d2ded | |
|
b14d24e650 | |
|
7995665c6b | |
|
a22906d3c2 | |
|
042533dc85 | |
|
5fbefeecbf | |
|
a9772ff081 | |
|
cdf983c7c6 | |
|
03f886580f | |
|
a06e2869b9 | |
|
6bafb263de | |
|
493ff5fbf6 | |
|
c29e0880ac | |
|
986c7a915b | |
|
68b1b8b819 | |
|
382ba56fa7 | |
|
24d6685047 | |
|
565d2ecceb | |
|
c4456e458f | |
|
f707dedc91 | |
|
702fc4680d | |
|
99b63150ac | |
|
6e7c226c57 | |
|
c8e5f7b742 | |
|
0cf147d185 | |
|
cf1514f53e | |
|
af3843a8ef | |
|
91ce2dd450 | |
|
71c9efae42 | |
|
08ce0d792b | |
|
754ef17b74 | |
|
5d4fec8c81 | |
|
1e0338a77f | |
|
e6b9628746 | |
|
6f68081dc5 | |
|
66b18dd351 | |
|
b5f5b6461a | |
|
6dd29d9596 | |
|
29ba125534 | |
|
144af1414c | |
|
06906eca42 | |
|
0d47748d6a | |
|
b1c8192625 | |
|
d2c7781d79 | |
|
37d4f50ef4 | |
|
082ac85c5c | |
|
cfca56ba48 | |
|
c7cb4ddbc5 | |
|
7f98d6028b | |
|
401822a7bb | |
|
173ba06590 | |
|
2677118bad | |
|
8e90456d87 | |
|
0b880a5e79 | |
|
082dbc0826 | |
|
5eccbbf6df | |
|
513deb7a0a | |
|
2b24dc647c | |
|
f8e5968f30 | |
|
18b8c84fff | |
|
1d6ccb7838 | |
|
a7a63a3be7 | |
|
153ef9eceb | |
|
eec7765e73 | |
|
03f2b55762 | |
|
6714374639 | |
|
b6b1f5d5ba | |
|
d7a10f9737 | |
|
d778adc7d0 | |
|
dcbb57f732 | |
|
24452794a9 | |
|
24fe1e8773 | |
|
b30c637c10 | |
|
f16795b11c | |
|
141d27599f | |
|
86c88c4ac2 | |
|
fbab0c043a | |
|
1a01a4f05e | |
|
b0305ae6da | |
|
dd4834de04 | |
|
2d90c127a3 | |
|
51d440fccc | |
|
2e3ed56bb3 | |
|
4be57f3128 | |
|
de6f0d0495 | |
|
98e1e73163 | |
|
1ae524ff31 | |
|
010927c5ca | |
|
3346bf01af | |
|
788cac7d50 | |
|
4c0fa2ba41 | |
|
83209f466f | |
|
10c452c1b3 | |
|
a8a33a823a | |
|
e7e7f86ab3 | |
|
386285d48c | |
|
c4119ab7cc | |
|
176643f148 | |
|
8b235bb6b0 | |
|
8a170f65ca | |
|
2f56dd4b8a | |
|
699c2dbec8 | |
|
dac720863d | |
|
3b03eb70fb | |
|
a173cf0d7c | |
|
55b39e7db3 | |
|
505a2a71e7 | |
|
fb51716e3a | |
|
bdd74fa90a | |
|
8631250b9e | |
|
c9f35ffe90 | |
|
18d6e2c7cd | |
|
f47ea2d382 | |
|
0cc167b3a6 | |
|
5133295f38 | |
|
621948fbac | |
|
4539c6d897 | |
|
a7db072dc6 | |
|
58ce079330 | |
|
dd03583a27 | |
|
3feaea74bf | |
|
1d6cbe5c53 | |
|
318f931dbf | |
|
5400518ea6 | |
|
f73a1e3931 | |
|
60d7ab4b5e | |
|
95cde2907a | |
|
35b67f1815 | |
|
f958789b20 | |
|
4beef04a3f | |
|
6d379d284b | |
|
2c21110b97 | |
|
777db577d7 | |
|
bf320216cf | |
|
b48c498574 | |
|
0b71da8e7b | |
|
c0d6cbccec | |
|
95ede98623 | |
|
3881dd4891 | |
|
71e4bea384 | |
|
83aa3099c4 | |
|
672db32917 | |
|
80a9c23f4d | |
|
49ad3c28a8 | |
|
a29c85628c | |
|
3ec93ab3b1 | |
|
10c29d3af1 | |
|
41840b90c8 | |
|
c89e865d3d | |
|
c6ec54bd06 | |
|
af3b1b8cbb | |
|
86273a9f09 | |
|
ba0241a811 | |
|
1bd73876b4 | |
|
cc806cbe52 | |
|
8f7a40075a | |
|
64faaa9427 | |
|
d44c67ce80 | |
|
144b408092 | |
|
d2390dca30 | |
|
503a8ec92f | |
|
ca22a3ba4b | |
|
ef54e61494 | |
|
b1745c786b | |
|
83efbc18c7 | |
|
f47396e48c | |
|
03c27a9226 | |
|
08655898d4 | |
|
5d347d23e4 | |
|
a25d93ec55 | |
|
bbf0cbd1c6 | |
|
4aceeac1c2 | |
|
1f5bb85304 | |
|
087fd3f763 | |
|
daece3b45a | |
|
9705505285 | |
|
9016062f70 | |
|
a6de66eb66 | |
|
6ada6b08ed | |
|
710e178ba2 | |
|
9e7990851e | |
|
ae34558f18 | |
|
c1a51f1ce8 | |
|
13702a3d5b | |
|
6b66cfe03f | |
|
cbc876c57c | |
|
7813a8c904 | |
|
5f941e91b5 | |
|
d262ed418d | |
|
2e9db4d667 | |
|
bd9317dd8f | |
|
461add1cda | |
|
1528dec668 | |
|
fff9d5d410 | |
|
231c354cb1 | |
|
4e0149e752 | |
|
5c6b9191e5 | |
|
77a0f7d8a0 | |
|
9faae6fc36 | |
|
3689eb7528 | |
|
210dc85558 | |
|
174b900cd8 | |
|
fbe954280f | |
|
142c990a0e | |
|
790ea3d551 | |
|
c6b8592490 | |
|
f67e011d5e | |
|
a4bc54482d | |
|
be50eb6fcf | |
|
a7d784583a | |
|
7af1f739e4 | |
|
3e247703a8 | |
|
c7e338ebff | |
|
cc2af435d5 | |
|
87695b173d | |
|
722ff9c05e | |
|
51114df576 | |
|
9126bc82c0 | |
|
e09fe7d42f | |
|
234e69c7a2 | |
|
d7017af245 | |
|
f49c70ead6 | |
|
9a89dbe6a5 | |
|
844bb286a5 | |
|
4eceecf139 | |
|
95e2e997e5 | |
|
346c303edb | |
|
908fe52ad8 | |
|
3fd1e47b7b | |
|
d41f082839 | |
|
2047ce4f76 | |
|
3ef56cab21 | |
|
6b77b98aad | |
|
211101cd6b | |
|
e27cae353f | |
|
b12a08e47a | |
|
9b298ac676 | |
|
52acb97e08 | |
|
78450e9e6a | |
|
dc746fe6f4 | |
|
0e3bc563a7 | |
|
d0ef5d410d | |
|
d9aa7dc698 | |
|
70ab8cb527 | |
|
512f6c86ad | |
|
d23eb290d9 | |
|
648bca5b2e | |
|
5db5d477e4 | |
|
7741134917 | |
|
3c19cd35cf | |
|
85832d18f6 | |
|
5f0da91659 | |
|
e1bf69e622 | |
|
d9290f7262 | |
|
81b6846261 | |
|
a57519adce | |
|
02639466ee | |
|
6e2795d380 | |
|
8e35596088 | |
|
0162d012c5 | |
|
47fb673b78 | |
|
f296488bc2 | |
|
f5392aea9f | |
|
24b1301f9f | |
|
1290a8f324 | |
|
e64277e438 | |
|
c9bcb74a9f | |
|
42db1f81b8 | |
|
7222952eba | |
|
744f10c948 | |
|
b50704a6a8 | |
|
c152806511 | |
|
4d9454daf2 | |
|
e754c65602 | |
|
b672921c84 | |
|
6116ada2fd | |
|
d7baa4d17b | |
|
ebc5504998 | |
|
c5e66a6f40 | |
|
cff558ef9a | |
|
325837d93e | |
|
135540b261 | |
|
49464cd25a | |
|
d0fe54b429 | |
|
2dce6f4b08 | |
|
99794d04c2 | |
|
cc06655cd6 | |
|
ab6f517d27 | |
|
682167db48 | |
|
f127dc1128 | |
|
0b816ae8e1 | |
|
c600fea4e1 | |
|
92067bdbef | |
|
c181e003a3 | |
|
597137670d | |
|
3036aebbc4 | |
|
cbe6477af2 | |
|
c2546d2bc5 | |
|
46be1bfd3b | |
|
1029885047 | |
|
164bde8cce | |
|
41504caac9 | |
|
9b34b4e026 | |
|
95612c1d18 | |
|
0829ec9081 | |
|
ef0d246901 | |
|
622a8a7c42 | |
|
925659ba4b | |
|
20c9287ac2 | |
|
8aaa2b8940 | |
|
30bd35e21d | |
|
0c2e39f0b2 | |
|
cbd7001228 | |
|
dec96ec9be | |
|
3942cd05be | |
|
ee1e9c9feb | |
|
fcb77232ec | |
|
1fcbec7466 | |
|
98f2c7a24a | |
|
787e6ed06e | |
|
bb5b7c7897 | |
|
42b3aa767d | |
|
b20a6084e6 | |
|
d9a8576701 | |
|
69273d2a1c | |
|
755ea757f7 | |
|
81fc54af8d | |
|
4281ca4390 | |
|
3419172535 | |
|
206c266b08 | |
|
5026cf869f | |
|
d5ecd9e057 | |
|
72b5077356 | |
|
6601c030f7 | |
|
3ec1373f08 | |
|
b29478cb58 | |
|
fe61e63e76 | |
|
ee0ab663d7 | |
|
1964d6002d | |
|
f55b72044c | |
|
3f759f5678 | |
|
6582154ec6 | |
|
9d0545aa4f | |
|
ea055d6e56 | |
|
bc48765b35 | |
|
70c2c695f0 | |
|
8ec5816364 | |
|
c33c6e24f6 | |
|
b0ca15bd8d | |
|
76799bd66d | |
|
18dbb72a54 | |
|
c0ec81c0f9 | |
|
c3661d6ff1 | |
|
c0f056cd8d | |
|
2924efe39f | |
|
e275539fb0 | |
|
4c13c54815 | |
|
62a66f5f6d | |
|
3a435933e3 | |
|
78f7ac0e68 | |
|
28dc19fc32 | |
|
585c47d6c7 | |
|
04a0330327 | |
|
dae4e65aee | |
|
129647b863 | |
|
2f9201716a | |
|
f9d716552b | |
|
818c8453ee | |
|
f7a3c52260 | |
|
9d3bf24627 | |
|
c77201ef4e | |
|
f585aa2a5a | |
|
96e0ce6050 | |
|
17d4ff459f | |
|
c15c376a2f | |
|
22bed4632b | |
|
8b5faaa1a4 | |
|
81d94fd727 | |
|
bbfe6fc657 | |
|
467a5c06d6 | |
|
9dce9fb1f2 | |
|
e1c8ba1320 | |
|
4ef318c55e | |
|
7f7513809a | |
|
b3bb07454f | |
|
faad084b2b | |
|
3e528c23a5 | |
|
6fed941441 | |
|
6fee5a803c | |
|
2861bc52fd | |
|
8c14a06b96 | |
|
3e0ac3f0d0 | |
|
394fbe2323 | |
|
11267796ba | |
|
aac5e5d488 | |
|
8a6bc0b4f5 | |
|
a2af605d37 | |
|
32f70be614 | |
|
31c701734a | |
|
fb7b1e2fb6 | |
|
5061a511ab | |
|
c0121bcfe7 | |
|
66639e951b | |
|
53d147b9bc | |
|
ad1ac51fc8 | |
|
88a6e9f563 | |
|
7dc4d153be | |
|
dcc91501ee | |
|
6473f388d8 | |
|
a21fff82f1 | |
|
2c8eabeffd | |
|
85bfa57127 | |
|
112e6b543c | |
|
232f39b861 | |
|
338a60f947 | |
|
9ab1436d49 | |
|
8d3c035e7b | |
|
10b823bca8 | |
|
7f9020e698 | |
|
6a563e131b | |
|
1fb5c984ac | |
|
b90a68cb39 | |
|
7ebfe16897 | |
|
e84f1ce8ff | |
|
eb7e62aac7 | |
|
dab5c67c04 | |
|
69ca62f884 | |
|
53941835cb | |
|
7d4e53fe24 | |
|
6f19842da0 | |
|
3692195887 | |
|
e672c2dc93 | |
|
65292524b1 | |
|
5e481e77b0 | |
|
7c9543239e | |
|
8672b6584a | |
|
c5d7f9c91f | |
|
9502d255c7 | |
|
08c3c23da0 | |
|
6eeeae85c8 | |
|
7c61af7043 | |
|
d501623290 | |
|
0ccb29dfb0 | |
|
f02782d4da | |
|
c2e83ab27b | |
|
32356b0037 | |
|
dd1bec8394 | |
|
4f2252d113 | |
|
0145bebb4b | |
|
5e6fbbb43c | |
|
7e516a59b6 | |
|
948b20fead | |
|
c61c128044 | |
|
296ef93ecb | |
|
74621ef1fb | |
|
0811222d27 | |
|
0c364576c9 | |
|
7ff49f0aa6 | |
|
a9b678f748 | |
|
f2fd77a858 | |
|
8c97258866 | |
|
5c691a8e12 | |
|
e5e4c7ded7 | |
|
a748f689bd | |
|
5309f85638 | |
|
efc6d0ef03 | |
|
a379e4b086 | |
|
4a1bf417a4 | |
|
b702929e1f | |
|
d042381293 | |
|
9805127387 | |
|
270862bd5f | |
|
53e012018f | |
|
420a3fbd50 | |
|
5258fcbf30 | |
|
4db3ce8b88 | |
|
e3d36a1f27 | |
|
67d0e750c2 | |
|
f4eb066725 | |
|
fb63bade2f | |
|
ed0175b733 | |
|
8163f7d454 | |
|
5ec50713ba | |
|
37719b9974 | |
|
3fd2b04e75 | |
|
c15cd512ae | |
|
cc41b75130 | |
|
f929ea2cc2 | |
|
d4987ed3a3 | |
|
da00c62db3 | |
|
55c460fbb4 | |
|
01cac728f5 | |
|
8d5663d3a2 | |
|
1c940d6df7 | |
|
891c34ad88 | |
|
aec5b79f90 | |
|
e25a8bbc7c | |
|
d70de98256 | |
|
aec3e29476 | |
|
32fe873707 | |
|
549cd3cc04 | |
|
8dc955a5e7 | |
|
ed75924e24 | |
|
49ba9a090b | |
|
691e741d70 | |
|
35b8b0def2 | |
|
529c275c0f | |
|
d604f2aab5 | |
|
b0c7e4eed4 | |
|
c6d0256929 | |
|
b74fd270e2 | |
|
4d022883ff | |
|
b595225870 | |
|
fc2593c6ee | |
|
4c0aa4220c | |
|
42621bbf71 | |
|
4c8c2b66f3 | |
|
c6ebab4032 | |
|
3fb276f401 | |
|
bf4ef96a06 | |
|
6ec81a3429 | |
|
00ccf4cb8f | |
|
09da9500b5 | |
|
de7015022f | |
|
e59d165689 | |
|
1075c7ff4a | |
|
4461670e14 | |
|
8e4c32073a | |
|
ac1da17b8d | |
|
9b2ed018bf | |
|
51acbdfd30 | |
|
5ce0aed2ff | |
|
f0c28b8624 | |
|
5f701ccecb | |
|
cfa22d3a1d | |
|
1b83fe6937 | |
|
2ff98a2148 | |
|
30c36baa9c | |
|
bd79025305 | |
|
7c4e9d5823 | |
|
5695bfd645 | |
|
c5f3c72f73 | |
|
7e05b5f680 | |
|
741d4619ee | |
|
7c50b66499 | |
|
96d0897f65 | |
|
c01f3ceff8 | |
|
4023704d31 | |
|
798e9ce1a3 | |
|
6612ffa6d1 | |
|
07100a588c | |
|
0b2d386ca2 | |
|
4b5dd4868b | |
|
f0804fe23b | |
|
97591b1c1d | |
|
b5da7ba233 | |
|
0f52812767 | |
|
0d6c3e44b0 | |
|
60147e3b0f | |
|
f8c64b45a7 | |
|
504912009b | |
|
084916c317 | |
|
073e778a3b | |
|
b5465384ce | |
|
45f96e6537 | |
|
f8fc9fded6 | |
|
f239f862e8 | |
|
872b46d4a5 | |
|
ddfc46a48f | |
|
ad67e2f010 | |
|
9331a766df | |
|
6b10e9c28d | |
|
d15fe37de5 | |
|
5014a2db38 | |
|
f3e885df35 | |
|
98a0eff503 | |
|
6cda9aed1d | |
|
9a464a2fcf | |
|
a4f8ffc3c6 | |
|
23a7896db9 | |
|
e25054117f | |
|
2e4ef09a60 | |
|
717cf77e55 | |
|
ede6fcdfb8 | |
|
6fcb85bca2 | |
|
0cff7c5794 | |
|
9b17d5cd47 | |
|
8ebbd0ac47 | |
|
49f9f7f160 | |
|
22187777e7 | |
|
00b26719f6 | |
|
d6da1824cd | |
|
23d663c3e7 | |
|
1e2b542e4c | |
|
5cd6b22ea4 | |
|
32f02d42ce | |
|
7740dc39ec | |
|
07940bc2c6 | |
|
7c43f2de2c | |
|
39e6ab5247 | |
|
76c7b49142 | |
|
5b418aeccd | |
|
b5fbe0153b | |
|
da7d14e898 | |
|
3aeb971b4d | |
|
dab5c34bad | |
|
596832119b | |
|
6442d99817 | |
|
a7c7715207 | |
|
e3d213e4f1 | |
|
c169b7fbae | |
|
d8e5e4521a | |
|
418670ce33 | |
|
8ddc6e5a20 | |
|
f015a6f2c5 | |
|
7907ba9533 | |
|
1fd3b83ca1 | |
|
35a540f5df | |
|
da6fef6080 | |
|
9a0ebcca06 | |
|
93144322db | |
|
8e832d0aa3 |
|
@ -3,4 +3,14 @@
|
|||
*.Parent
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist
|
||||
|
||||
*.svd
|
||||
*debug_custom.json
|
||||
*debug.cfg
|
||||
|
||||
notes/mphd
|
||||
|
||||
./lib
|
||||
|
||||
./debug
|
|
@ -0,0 +1,17 @@
|
|||
[submodule "scad/common"]
|
||||
path = scad/common
|
||||
url = https://git.sixteenmillimeter.com/modules/common.git
|
||||
ignore = dirty
|
||||
[submodule "scad/takeup"]
|
||||
path = scad/takeup
|
||||
url = https://git.sixteenmillimeter.com/modules/takeup.git
|
||||
ignore = dirty
|
||||
[submodule "scad/sprocketed_roller"]
|
||||
path = scad/sprocketed_roller
|
||||
url = https://git.sixteenmillimeter.com/modules/sprocketed_roller.git
|
||||
ignore = dirty
|
||||
[submodule "scad/MCAD"]
|
||||
path = scad/MCAD
|
||||
url = https://github.com/openscad/MCAD.git
|
||||
branch = master
|
||||
ignore = dirty
|
2
LICENSE
2
LICENSE
|
@ -1,4 +1,4 @@
|
|||
Copyright 2018 M McWilliams
|
||||
Copyright 2018-2021 M McWilliams
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
|
|
167
Readme.md
167
Readme.md
|
@ -1,74 +1,93 @@
|
|||
# mcopy
|
||||
|
||||
An open platform for controlling small-gauge film optical printers (16mm, Super8, 8mm).
|
||||
|
||||
-------
|
||||
1. <a href="#intro">Introduction</a>
|
||||
2. <a href="#downloads">Downloads</a>
|
||||
1. <a href="#usage">Usage</a>
|
||||
2. <a href="#software">Software</a>
|
||||
3. <a href="#firmware">Firmware</a>
|
||||
3. <a href="#hardware">Hardware</a>
|
||||
4. <a href="#why">Why?</a>
|
||||
|
||||
-------
|
||||
|
||||
## Introduction <a name="intro"></a>
|
||||
|
||||
The `mcopy` project is comprised of software and hardware for optical printers, built with re-purposed broken projectors.
|
||||
|
||||
#### Components
|
||||
|
||||
* Sequencer desktop app
|
||||
* Scripting language, called `mscript`, for orchestrating complex sequences
|
||||
* Arduino firmware for projectors, cameras, lights and existing printers
|
||||
* 3D models of parts used for modifying projectors and printers
|
||||
* Schematics for simple Arduino-based electronics
|
||||
|
||||
## Downloads <a name="downloads"></a>
|
||||
|
||||
* [1.2.0](https://github.com/sixteenmillimeter/mcopy/releases/tag/1.2.0) for macOS and Linux (.deb)
|
||||
* [1.0.3](https://github.com/sixteenmillimeter/mcopy/releases/tag/1.0.3) for macOS and Linux (.deb)
|
||||
|
||||
For Windows, you can [install from source](https://github.com/sixteenmillimeter/mcopy/tree/master/app#mcopy-desktop-app) for now.
|
||||
|
||||
## Usage <a name="usage"></a>
|
||||
|
||||
The software requires your hardware to be in place before the mcopy control app is useful.
|
||||
|
||||

|
||||
|
||||
## Software <a name="software"></a>
|
||||
|
||||
The mcopy desktop app is an Electron-based project which can be built for Linux, Windows and macOS.
|
||||
Pre-built packages will be made available for macOS, initially, with the other two target platforms to follow.
|
||||
To build the desktop app from source, see the [installation and running instructions](https://github.com/sixteenmillimeter/mcopy/tree/master/app#mcopy-desktop-app).
|
||||
The desktop software also interoperates with two related projects; the Bluetooth + Wifi capable, Raspberry Pi-based [INTVAL3](https://github.com/sixteenmillimeter/intval3) and the Arduino-based [intval2](https://github.com/sixteenmillimeter/intval2).
|
||||
|
||||
## Firmware <a name="firmware"></a>
|
||||
|
||||
This project contains Arduino formware for controlling:
|
||||
|
||||
* a projector
|
||||
* a camera (see [intval2](https://github.com/sixteenmillimeter/intval2) for more info)
|
||||
* a light
|
||||
* a projector + a camera
|
||||
* a projector + a light
|
||||
* a camera + a light
|
||||
* a camera + a projector + a light
|
||||
|
||||
Using a simple serial interface, this modular platform can be used to control DIY components, modified existing optical printers or a mixture of components.
|
||||
The desktop app can connect to multiple serial devices, so your mcopy optical printer can be built from various designs that suit your hardware tastes/needs/available parts.
|
||||
|
||||
|
||||
## Hardware <a name="hardware"></a>
|
||||
|
||||
All non-electronic hardware for this project is available as plaintext OpenSCAD files and 3D print-able .STL files.
|
||||
The hardware component of this project is aimed at modifying broken Bell & Howell projectors into USB serial-controlled projectors to be used in optical printing.
|
||||
As a secondary capability, this desktop software and firmware package can be used to replace the sequencers for early-model JK optical printers, with some modification.
|
||||
|
||||
|
||||
## Why? <a name="why"></a>
|
||||
|
||||
I'm interested in expanding the viability and access of the 16mm film format and to repurpose thre rising tide of discarded film technology.
|
||||
|
||||
# mcopy
|
||||
|
||||
An open platform for controlling small-gauge film optical printers (16mm, Super8, 8mm).
|
||||
|
||||
## [Project Home - git.sixteenmillimeter.com/16mm/mcopy](https://git.sixteenmillimeter.com/16mm/mcopy)
|
||||
|
||||
* Github Mirror - [github.com/sixteenmillimeter/mcopy](https://github.com/sixteenmillimeter/mcopy)
|
||||
* Gitlab Mirror - [gitlab.com/16mm/mcopy](https://gitlab.com/16mm/mcopy)
|
||||
|
||||
-------
|
||||
1. <a href="#intro">Introduction</a>
|
||||
2. <a href="#downloads">Downloads</a>
|
||||
1. <a href="#usage">Usage</a>
|
||||
2. <a href="#software">Software</a>
|
||||
3. <a href="#firmware">Firmware</a>
|
||||
3. <a href="#hardware">Hardware</a>
|
||||
4. <a href="#why">Why?</a>
|
||||
|
||||
-------
|
||||
|
||||
## Introduction <a name="intro"></a>
|
||||
|
||||
The `mcopy` project is comprised of software and hardware for optical printers, built with re-purposed broken projectors.
|
||||
|
||||
#### Components
|
||||
|
||||
* Sequencer desktop app
|
||||
* Scripting language, called `mscript`, for orchestrating complex sequences
|
||||
* Arduino firmware for projectors, cameras, lights and existing printers
|
||||
* 3D models of parts used for modifying projectors and printers
|
||||
* Schematics for simple Arduino-based electronics
|
||||
* Filmout feature for digitally transferring video and images to analog film
|
||||
* Interoperability with the [intval3](https://github.com/sixteenmillimeter/intval3) intervalometer
|
||||
|
||||
## Downloads <a name="downloads"></a>
|
||||
|
||||
### Latest Installers
|
||||
|
||||
* [1.6.9](https://github.com/sixteenmillimeter/mcopy/releases/tag/1.6.9) for macOS, Linux (.deb) and Windows (.msi)
|
||||
|
||||
### Older Versions
|
||||
* [1.6.7](https://github.com/sixteenmillimeter/mcopy/releases/tag/1.6.7) for macOS and Linux (.deb)
|
||||
* [1.6.4](https://github.com/sixteenmillimeter/mcopy/releases/tag/1.6.4) for macOS, Linux (.deb) and Windows (.msi)
|
||||
* [1.6.2](https://github.com/sixteenmillimeter/mcopy/releases/tag/1.6.2) for macOS
|
||||
* [1.6.1](https://github.com/sixteenmillimeter/mcopy/releases/tag/1.6.1) for macOS
|
||||
* [1.5.2](https://github.com/sixteenmillimeter/mcopy/releases/tag/1.5.2) for macOS
|
||||
* [1.4.9](https://github.com/sixteenmillimeter/mcopy/releases/tag/1.4.9) for macOS and Linux (.deb)
|
||||
* [1.2.0](https://github.com/sixteenmillimeter/mcopy/releases/tag/1.2.0) for macOS and Linux (.deb)
|
||||
* [1.0.3](https://github.com/sixteenmillimeter/mcopy/releases/tag/1.0.3) for macOS and Linux (.deb)
|
||||
|
||||
For Windows, you can [install from source](https://github.com/sixteenmillimeter/mcopy/tree/master/app#mcopy-desktop-app) for now.
|
||||
|
||||
## Usage <a name="usage"></a>
|
||||
|
||||
The software requires your hardware to be in place before the mcopy control app is useful.
|
||||
|
||||

|
||||
|
||||
## Software <a name="software"></a>
|
||||
|
||||
The mcopy desktop app is an Electron-based project which can be built for Linux, Windows and macOS.
|
||||
Pre-built packages will be made available for macOS, initially, with the other two target platforms to follow.
|
||||
To build the desktop app from source, see the [installation and running instructions](https://github.com/sixteenmillimeter/mcopy/tree/master/app#mcopy-desktop-app).
|
||||
The desktop software also interoperates with two related projects; the Bluetooth + Wifi capable, Raspberry Pi-based [INTVAL3](https://github.com/sixteenmillimeter/intval3) and the Arduino-based [intval2](https://github.com/sixteenmillimeter/intval2).
|
||||
|
||||
## Firmware <a name="firmware"></a>
|
||||
|
||||
This project contains Arduino formware for controlling:
|
||||
|
||||
* a projector
|
||||
* a camera (see [intval2](https://github.com/sixteenmillimeter/intval2) for more info)
|
||||
* a light
|
||||
* a projector + a camera
|
||||
* a projector + a light
|
||||
* a camera + a light
|
||||
* a camera + a projector + a light
|
||||
|
||||
Using a simple serial interface, this modular platform can be used to control DIY components, modified existing optical printers or a mixture of components.
|
||||
The desktop app can connect to multiple serial devices, so your mcopy optical printer can be built from various designs that suit your hardware tastes/needs/available parts.
|
||||
|
||||
|
||||
## Hardware <a name="hardware"></a>
|
||||
|
||||
All non-electronic hardware for this project is available as plaintext OpenSCAD files and 3D print-able .STL files.
|
||||
The hardware component of this project is aimed at modifying broken Bell & Howell projectors into USB serial-controlled projectors to be used in optical printing.
|
||||
|
||||
As a secondary capability, this desktop software and firmware package can be used to replace the sequencers for early-model JK optical printers, with some modification.
|
||||
|
||||
|
||||
## Why? <a name="why"></a>
|
||||
|
||||
I'm interested in expanding the viability and access of the 16mm film format and to repurpose thre rising tide of discarded film technology.
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
node_modules/*
|
||||
logs/*
|
||||
data/transfer*.json
|
||||
data/transfer*.json
|
||||
.appleId*
|
||||
.applePwd*
|
||||
.appleIdentity*
|
||||
|
|
239
app/css/app.css
239
app/css/app.css
|
@ -194,8 +194,8 @@ button:focus {
|
|||
width: 66px;
|
||||
height: 66px;
|
||||
position: absolute;
|
||||
top: 7px;
|
||||
left: 7px;
|
||||
top: 14px / 2;
|
||||
left: 14px / 2;
|
||||
}
|
||||
.dial-wrapper input {
|
||||
margin-top: 94px;
|
||||
|
@ -210,10 +210,10 @@ button:focus {
|
|||
top: 0;
|
||||
bottom: 0;
|
||||
overflow: hidden;
|
||||
width: 40px;
|
||||
width: 80px / 2;
|
||||
}
|
||||
.dial-container.dial-container1 {
|
||||
left: 40px;
|
||||
left: 80px / 2;
|
||||
}
|
||||
.dial-container.dial-container1 .dial-wedge {
|
||||
transform: rotateZ(0deg);
|
||||
|
@ -227,16 +227,16 @@ button:focus {
|
|||
.dial-container.dial-container2 .dial-wedge {
|
||||
transform: rotateZ(0deg);
|
||||
border-radius: 80px 0 0 80px;
|
||||
transform-origin: 40px 40px;
|
||||
transform-origin: 80px/2 80px/2;
|
||||
}
|
||||
.dial-wedge {
|
||||
height: 80px;
|
||||
width: 40px;
|
||||
width: 80px / 2;
|
||||
}
|
||||
.dial-marker {
|
||||
border-radius: 50%;
|
||||
height: 7px;
|
||||
width: 7px;
|
||||
height: 14px / 2;
|
||||
width: 14px / 2;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: calc(50% - (14px * 2));
|
||||
|
@ -367,6 +367,7 @@ button:focus {
|
|||
float: right;
|
||||
width: 90px;
|
||||
margin-right: 60px;
|
||||
height: 32px;
|
||||
}
|
||||
#seq_stats {
|
||||
width: 40%;
|
||||
|
@ -484,6 +485,9 @@ button:focus {
|
|||
#sequence #projector_second_backward > div {
|
||||
color: #bf2e39;
|
||||
}
|
||||
#sequence #black input[type=checkbox]:checked {
|
||||
background: white;
|
||||
}
|
||||
#sequence input[type=checkbox] {
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
|
@ -500,6 +504,10 @@ button:focus {
|
|||
box-sizing: border-box;
|
||||
cursor: pointer;
|
||||
}
|
||||
#sequence input[type=checkbox].disabled {
|
||||
cursor: not-allowed;
|
||||
border-color: #646464;
|
||||
}
|
||||
#sequence .L {
|
||||
display: inline-block;
|
||||
width: 35px;
|
||||
|
@ -627,6 +635,11 @@ button:focus {
|
|||
background: #AB1A25;
|
||||
border-color: #AB1A25;
|
||||
}
|
||||
.cmd:active.capper,
|
||||
.cmd.active.capper {
|
||||
background: white;
|
||||
color: #272b30;
|
||||
}
|
||||
.cmd:active i,
|
||||
.cmd.active i {
|
||||
color: #272b30;
|
||||
|
@ -650,14 +663,44 @@ button:focus {
|
|||
::-webkit-scrollbar-thumb:window-inactive {
|
||||
background: rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
#settings h4 {
|
||||
margin-bottom: 1px;
|
||||
}
|
||||
#settings > div {
|
||||
width: 300px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
#settings > div.left {
|
||||
float: left;
|
||||
padding-left: 30px;
|
||||
}
|
||||
#settings > div.right {
|
||||
float: right;
|
||||
padding-right: 30px;
|
||||
}
|
||||
#settings > div.right input[type=number] {
|
||||
min-width: 200px;
|
||||
width: 200px;
|
||||
}
|
||||
#settings > div.right input[readonly] {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
#settings > div.right .spacer {
|
||||
height: 62px;
|
||||
}
|
||||
#settings > div.right .proj_time {
|
||||
height: 111px;
|
||||
}
|
||||
#settings > div.right .cam_time {
|
||||
height: 111px;
|
||||
}
|
||||
#settings > div.right > div {
|
||||
width: 270px;
|
||||
}
|
||||
#settings > div > div {
|
||||
width: 360px;
|
||||
}
|
||||
#settings input[type=text],
|
||||
#settings input[type=number],
|
||||
#settings select {
|
||||
display: block;
|
||||
border-radius: 5px;
|
||||
|
@ -672,33 +715,43 @@ button:focus {
|
|||
padding: 6px 12px;
|
||||
font-size: 21px;
|
||||
min-width: 300px;
|
||||
max-width: 300px;
|
||||
}
|
||||
#settings input[type=text] span,
|
||||
#settings input[type=number] span,
|
||||
#settings select span {
|
||||
display: block;
|
||||
font-size: 16px;
|
||||
font-weight: 200;
|
||||
}
|
||||
#settings input[type=text]:active,
|
||||
#settings input[type=number]:active,
|
||||
#settings select:active,
|
||||
#settings input[type=text] .active,
|
||||
#settings input[type=number] .active,
|
||||
#settings select .active {
|
||||
background: #fff;
|
||||
color: #272b30;
|
||||
outline: none;
|
||||
}
|
||||
#settings input[type=text]:focus,
|
||||
#settings input[type=number]:focus,
|
||||
#settings select:focus {
|
||||
outline: none;
|
||||
}
|
||||
#settings input[type=text].active,
|
||||
#settings input[type=number].active,
|
||||
#settings select.active {
|
||||
border-color: #DAE035;
|
||||
color: #DAE035;
|
||||
}
|
||||
#settings input[type=text] {
|
||||
width: 200px;
|
||||
}
|
||||
#settings button {
|
||||
margin-top: -1px;
|
||||
margin-top: 0px;
|
||||
float: right;
|
||||
padding: 8px 16px 9px;
|
||||
}
|
||||
#settings input[type=radio] {
|
||||
float: right;
|
||||
|
@ -707,6 +760,17 @@ button:focus {
|
|||
#settings .spacer {
|
||||
margin-top: 10px;
|
||||
}
|
||||
#settings #version {
|
||||
position: absolute;
|
||||
right: 20px;
|
||||
bottom: 10px;
|
||||
z-index: 1000;
|
||||
height: 14px;
|
||||
width: auto;
|
||||
font-size: 14px;
|
||||
line-height: 14px;
|
||||
color: #999;
|
||||
}
|
||||
.cm-s-monokai.CodeMirror {
|
||||
background: #272b30 !important;
|
||||
}
|
||||
|
@ -739,6 +803,149 @@ button:focus {
|
|||
background: black;
|
||||
color: #fff;
|
||||
}
|
||||
#video input,
|
||||
#video select {
|
||||
display: block;
|
||||
border-radius: 5px;
|
||||
border: 2px solid #fff;
|
||||
text-align: center;
|
||||
background: transparent;
|
||||
color: #fff;
|
||||
padding: 8px 0;
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
display: inline-block;
|
||||
padding: 6px 12px;
|
||||
font-size: 21px;
|
||||
min-width: 300px;
|
||||
}
|
||||
#video input span,
|
||||
#video select span {
|
||||
display: block;
|
||||
font-size: 16px;
|
||||
font-weight: 200;
|
||||
}
|
||||
#video input:active,
|
||||
#video select:active,
|
||||
#video input .active,
|
||||
#video select .active {
|
||||
background: #fff;
|
||||
color: #272b30;
|
||||
outline: none;
|
||||
}
|
||||
#video input:focus,
|
||||
#video select:focus {
|
||||
outline: none;
|
||||
}
|
||||
#video input.active,
|
||||
#video select.active {
|
||||
border-color: #DAE035;
|
||||
color: #DAE035;
|
||||
}
|
||||
#video button,
|
||||
#video select {
|
||||
padding: 9px 16px 8px;
|
||||
}
|
||||
#path_bar {
|
||||
padding: 5px;
|
||||
height: 50px;
|
||||
}
|
||||
#path_bar input {
|
||||
float: left;
|
||||
}
|
||||
#path_bar button {
|
||||
float: left;
|
||||
margin-left: 5px;
|
||||
}
|
||||
#path_bar select {
|
||||
line-height: 41px;
|
||||
height: 37px;
|
||||
margin-right: 5px;
|
||||
float: right;
|
||||
box-sizing: content-box;
|
||||
padding: 0 0 0 8px;
|
||||
}
|
||||
#filmout_monitor {
|
||||
display: none;
|
||||
border: 2px solid white;
|
||||
box-sizing: border-box;
|
||||
height: 360px;
|
||||
margin: 0 auto;
|
||||
position: relative;
|
||||
}
|
||||
#filmout_monitor.on {
|
||||
display: block;
|
||||
}
|
||||
#filmout_preview_wrap {
|
||||
background: #000;
|
||||
width: 100%;
|
||||
height: 360px;
|
||||
}
|
||||
#filmout {
|
||||
position: absolute;
|
||||
background-repeat: no-repeat;
|
||||
background-size: contain;
|
||||
background-position: center;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
display: block;
|
||||
opacity: 0;
|
||||
}
|
||||
#filmout.on {
|
||||
opacity: 1;
|
||||
}
|
||||
#filmout_position_wrap {
|
||||
padding-top: 5px;
|
||||
height: 50px;
|
||||
}
|
||||
#filmout_position_wrap input {
|
||||
margin-right: 5px;
|
||||
margin-left: 5px;
|
||||
width: 308px !important;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
#filmout_position_wrap button,
|
||||
#filmout_position_wrap input {
|
||||
float: left;
|
||||
}
|
||||
#filmout_position_wrap > div {
|
||||
width: 425px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
#filmout_functions {
|
||||
padding-top: 5px;
|
||||
}
|
||||
#filmout_functions > div {
|
||||
width: 425px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
#filmout_stats_video,
|
||||
#filmout_stats_monitor {
|
||||
width: 150px;
|
||||
position: absolute;
|
||||
padding: 10px 5px;
|
||||
text-align: center;
|
||||
}
|
||||
#filmout_stats_video h3,
|
||||
#filmout_stats_monitor h3 {
|
||||
font-size: 20px;
|
||||
margin: 16px 0 3px;
|
||||
text-align: center;
|
||||
}
|
||||
#filmout_stats_video {
|
||||
left: 5px;
|
||||
}
|
||||
#filmout_stats_monitor {
|
||||
right: 5px;
|
||||
}
|
||||
.hide {
|
||||
display: none;
|
||||
}
|
||||
.show {
|
||||
display: block;
|
||||
}
|
||||
#screens {
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
@ -991,19 +1198,23 @@ button:focus {
|
|||
float: right;
|
||||
}
|
||||
.cam2,
|
||||
.proj2 {
|
||||
.proj2,
|
||||
.black {
|
||||
display: none;
|
||||
}
|
||||
.cam2 > *,
|
||||
.proj2 > * {
|
||||
.proj2 > *,
|
||||
.black > * {
|
||||
visibility: hidden;
|
||||
}
|
||||
.cam2.on,
|
||||
.proj2.on {
|
||||
.proj2.on,
|
||||
.black.on {
|
||||
display: block;
|
||||
}
|
||||
.cam2.on > *,
|
||||
.proj2.on > * {
|
||||
.proj2.on > *,
|
||||
.black.on > * {
|
||||
visibility: visible;
|
||||
}
|
||||
#overlay {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "1.4.6",
|
||||
"version": "1.8.164",
|
||||
"ext_port": 1111,
|
||||
"profiles": {
|
||||
"mcopy": {
|
||||
|
@ -15,9 +15,10 @@
|
|||
"momentary": 0
|
||||
},
|
||||
"black": {
|
||||
"before": 0,
|
||||
"after": 0
|
||||
}
|
||||
"before": 100,
|
||||
"after": 100
|
||||
},
|
||||
"light": false
|
||||
},
|
||||
"jk103": {
|
||||
"label": "JK103",
|
||||
|
@ -52,7 +53,8 @@
|
|||
"black": {
|
||||
"before": 250,
|
||||
"after": 250
|
||||
}
|
||||
},
|
||||
"light": false
|
||||
},
|
||||
"intval3": {
|
||||
"label": "INTVAL3",
|
||||
|
@ -60,7 +62,8 @@
|
|||
"time": 630,
|
||||
"delay": 50,
|
||||
"momentary": 0
|
||||
}
|
||||
},
|
||||
"light": false
|
||||
},
|
||||
"jk_mono": {
|
||||
"label": "MONO's JK",
|
||||
|
@ -76,6 +79,29 @@
|
|||
},
|
||||
"light": false,
|
||||
"projector_second": true
|
||||
},
|
||||
"oxberry": {
|
||||
"label": "Oxberry",
|
||||
"cam": {
|
||||
"time": 550,
|
||||
"delay": 50,
|
||||
"momentary": 130
|
||||
},
|
||||
"proj": {
|
||||
"time": 1340,
|
||||
"delay": 50,
|
||||
"momentary": 300
|
||||
},
|
||||
"light": false
|
||||
},
|
||||
"norris": {
|
||||
"label": "Norris",
|
||||
"cam": {
|
||||
"time": 650,
|
||||
"delay": 50,
|
||||
"momentary": 130
|
||||
},
|
||||
"light": false
|
||||
}
|
||||
},
|
||||
"cmd": {
|
||||
|
@ -96,7 +122,9 @@
|
|||
"projectors_forward": "PPF",
|
||||
"projectors_backward": "PPB",
|
||||
"projector_forward_projector_second_backward": "PFPB",
|
||||
"projector_backward_projector_second_forward": "PBPF"
|
||||
"projector_backward_projector_second_forward": "PBPF",
|
||||
"pause": "PA",
|
||||
"alert": "AL"
|
||||
},
|
||||
"arduino": {
|
||||
"baud": 57600,
|
||||
|
@ -150,7 +178,22 @@
|
|||
"cameras": "4",
|
||||
"camera_projectors_identifier": "5",
|
||||
"cameras_projector_identifier": "6",
|
||||
"cameras_projectors_identifier": "7"
|
||||
"cameras_projectors_identifier": "7",
|
||||
"capper_identifier": "C",
|
||||
"camera_capper_identifier": "8",
|
||||
"camera_capper_projector_identifier": "9",
|
||||
"camera_capper_projectors_identifier": "0",
|
||||
"capper_on": "A",
|
||||
"capper_off": "B",
|
||||
"camera_open": "J",
|
||||
"camera_close": "K",
|
||||
"takeup_forward": "D",
|
||||
"takeup_backward": "F",
|
||||
"error": "E",
|
||||
"camera_exposure": "G",
|
||||
"state": "H",
|
||||
"home": "I",
|
||||
"offset": "O"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
221
app/display.html
221
app/display.html
|
@ -13,6 +13,16 @@
|
|||
body.meter {
|
||||
background: rgb(117, 117, 117);
|
||||
}
|
||||
body.meter #img,
|
||||
body.meter #can {
|
||||
display: none;
|
||||
}
|
||||
body.image #can{
|
||||
display: none;
|
||||
}
|
||||
body.image #img {
|
||||
display: block;
|
||||
}
|
||||
#img {
|
||||
position: absolute;
|
||||
/*background-image: url(".../img/background.jpg");*/
|
||||
|
@ -30,8 +40,9 @@
|
|||
background: #fff;
|
||||
display: none;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%,-50%);
|
||||
}
|
||||
#can.show{
|
||||
display: block;
|
||||
|
@ -45,61 +56,158 @@
|
|||
</canvas>
|
||||
<script>
|
||||
'use strict';
|
||||
const { remote, ipcRenderer } = require('electron')
|
||||
|
||||
async function setImage (src) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
//let img = new Image()
|
||||
let img = document.getElementById('img')
|
||||
let body = document.querySelector('body')
|
||||
if (body.classList.contains('meter')) {
|
||||
body.classList.remove('meter')
|
||||
}
|
||||
|
||||
img.style.backgroundImage = `url('${src}')`;
|
||||
//img.onload = () => {
|
||||
//document.body.appendChild(img)
|
||||
//return resolve(img)
|
||||
//}
|
||||
//img.onerror = reject
|
||||
//img.src = src
|
||||
const { ipcRenderer } = require('electron')
|
||||
const remote = require('@electron/remote')
|
||||
let imgTmp;
|
||||
function delay (ms) {
|
||||
return new Promise((resolve) => {
|
||||
return setTimeout(resolve, ms)
|
||||
})
|
||||
}
|
||||
async function setMeter () {
|
||||
let body = document.querySelector('body')
|
||||
if (!body.classList.contains('meter')) {
|
||||
body.classList.add('meter')
|
||||
}
|
||||
async function setImage (src) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
imgTmp = new Image()
|
||||
let img = document.getElementById('img')
|
||||
let body = document.querySelector('body')
|
||||
body.className = ''
|
||||
body.classList.add('image')
|
||||
imgTmp.onload = function () {
|
||||
img.style.backgroundImage = `url('${src}')`
|
||||
return resolve(src)
|
||||
}
|
||||
imgTmp.src = src
|
||||
})
|
||||
}
|
||||
async function setGrid () {
|
||||
|
||||
function setBlank () {
|
||||
let img = document.getElementById('img')
|
||||
img.style.background = ''
|
||||
img.style.backgroundUrl = ''
|
||||
img.style.backgroundColor = 'black'
|
||||
}
|
||||
async function onMeter () {
|
||||
console.log('meter')
|
||||
const body = document.querySelector('body')
|
||||
body.className = ''
|
||||
body.classList.add('meter')
|
||||
}
|
||||
async function onFocus () {
|
||||
console.log('focus')
|
||||
const can = document.getElementById('can')
|
||||
const ctx = can.getContext('2d')
|
||||
const dpr = window.devicePixelRatio || 1
|
||||
const body = document.querySelector('body')
|
||||
let ctx;
|
||||
body.className = ''
|
||||
if (!can.classList.contains('show')) {
|
||||
can.classList.add('show')
|
||||
}
|
||||
can.width = window.innerWidth
|
||||
can.height = window.innerHeight
|
||||
can.width = window.innerWidth * dpr
|
||||
can.height = window.innerHeight * dpr
|
||||
|
||||
can.style.width = `${window.innerWidth}px`
|
||||
can.style.height = `${window.innerHeight}px`
|
||||
|
||||
ctx = can.getContext('2d')
|
||||
ctx.scale(dpr, dpr)
|
||||
|
||||
try{
|
||||
await drawGrid(can, ctx)
|
||||
await drawFocus(can, ctx)
|
||||
} catch (err) {
|
||||
alert(JSON.stringify(err))
|
||||
}
|
||||
}
|
||||
async function drawGrid (can, ctx) {
|
||||
async function drawFocus (can, ctx) {
|
||||
const count = 20
|
||||
const half = Math.round(count / 2)
|
||||
const w = can.width
|
||||
const h = can.height
|
||||
const dpr = window.devicePixelRatio || 1
|
||||
const w = can.width / dpr
|
||||
const h = can.height / dpr
|
||||
const longest = w >= h ? w * 1.5 : h * 1.5
|
||||
const opp = Math.tan(360 / (count * 32)) * longest / 10
|
||||
|
||||
//console.log(`l: ${longest}`)
|
||||
//console.log(`${360 / (count * 8)}deg`)
|
||||
//console.log(`o: ${opp}`)
|
||||
|
||||
for (let i = 0; i < count; i++) {
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(w / 2, h / 2)
|
||||
ctx.lineTo((w / 2) + opp, longest)
|
||||
ctx.lineTo((w / 2) - opp, longest)
|
||||
ctx.fill()
|
||||
ctx.translate(w / 2, h / 2);
|
||||
ctx.rotate((360 / count) * Math.PI / 180)
|
||||
ctx.translate(- w / 2, -h / 2)
|
||||
}
|
||||
}
|
||||
async function onField (evt, arg) {
|
||||
console.log('field guide')
|
||||
const can = document.getElementById('can')
|
||||
const dpr = window.devicePixelRatio || 1
|
||||
const screen = window.outerWidth / window.outerHeight
|
||||
const body = document.querySelector('body')
|
||||
let ctx
|
||||
body.className = ''
|
||||
if (!can.classList.contains('show')) {
|
||||
can.classList.add('show')
|
||||
}
|
||||
if (arg.ratio) {
|
||||
if (arg.ratio < screen) {
|
||||
can.width = (window.innerHeight * arg.ratio) * dpr
|
||||
can.height = window.innerHeight * dpr
|
||||
} else {
|
||||
can.width = window.innerWidth * dpr
|
||||
can.height = (window.innerWidth / arg.ratio) * dpr
|
||||
}
|
||||
} else {
|
||||
can.width = window.innerWidth * dpr
|
||||
can.height = window.innerHeight * dpr
|
||||
}
|
||||
|
||||
|
||||
if (arg.ratio) {
|
||||
if (arg.ratio < screen) {
|
||||
can.style.width = `${window.innerHeight * arg.ratio}px`
|
||||
can.style.height = `${window.innerHeight}px`
|
||||
} else {
|
||||
can.style.width = `${window.innerWidth}px`
|
||||
can.style.height = `${window.innerWidth / arg.ratio}px`
|
||||
}
|
||||
} else {
|
||||
can.style.width = `${window.innerWidth}px`
|
||||
can.style.height = `${window.innerHeight}px`
|
||||
}
|
||||
|
||||
ctx = can.getContext('2d')
|
||||
ctx.scale(dpr, dpr)
|
||||
|
||||
try{
|
||||
await drawField(can, ctx)
|
||||
} catch (err) {
|
||||
alert(JSON.stringify(err))
|
||||
}
|
||||
}
|
||||
// draw a field guide
|
||||
async function drawField (can, ctx) {
|
||||
const count = 20
|
||||
const half = Math.round(count / 2)
|
||||
const dpr = window.devicePixelRatio || 1
|
||||
const w = can.width / dpr
|
||||
const h = can.height / dpr
|
||||
const wsec = w / count
|
||||
const hsec= h / count
|
||||
const hsec = h / count
|
||||
const spacer = 12
|
||||
const fontSize = 18
|
||||
|
||||
ctx.lineWidth = 2
|
||||
|
||||
ctx.moveTo(w / 2, 0)
|
||||
ctx.lineTo(w / 2, h)
|
||||
ctx.stroke()
|
||||
ctx.moveTo(0, h / 2)
|
||||
ctx.lineTo(w, h / 2)
|
||||
ctx.stroke()
|
||||
|
||||
for (let i = 0; i < count; i++) {
|
||||
ctx.moveTo(wsec * i, hsec * i)
|
||||
ctx.lineTo(wsec * i, h - (hsec * i))
|
||||
|
@ -108,40 +216,45 @@
|
|||
ctx.lineTo(w - (wsec * i), hsec * i)
|
||||
ctx.stroke()
|
||||
}
|
||||
ctx.font = '30px Arial'
|
||||
|
||||
ctx.lineWidth = 1
|
||||
|
||||
ctx.font = `${fontSize}px Arial`
|
||||
for (let i = 0; i < half; i++) {
|
||||
ctx.fillText(`${(half - i)}`, (wsec * i) + 15, (h / 2) - 15)
|
||||
ctx.fillText(`${(half - i)}`, (w - (wsec * i)) - 25, (h / 2) - 15)
|
||||
ctx.fillText(`${(half - i)}`, (w / 2) + 15, (hsec * i) + 25 )
|
||||
ctx.fillText(`${(half - i)}`, (w / 2) + 15, (h - (hsec * i)) - 15)
|
||||
//left count
|
||||
ctx.fillText(`${(half - i)}`, (wsec * i) + spacer, (h / 2) - spacer)
|
||||
//right count
|
||||
ctx.fillText(`${(half - i)}`, (w - (wsec * i)) - (spacer * 2), (h / 2) + (spacer * 2))
|
||||
//up count
|
||||
ctx.fillText(`${(half - i)}`, (w / 2) + spacer, (hsec * i) + spacer + (fontSize / 2) )
|
||||
//down count
|
||||
ctx.fillText(`${(half - i)}`, (w / 2) - (spacer * 2), (h - (hsec * i)) - spacer)
|
||||
}
|
||||
}
|
||||
async function onDigital (event, arg) {
|
||||
console.log('called')
|
||||
if (arg.src) {
|
||||
if (arg.exposure) {
|
||||
setBlank()
|
||||
await delay(10)
|
||||
}
|
||||
try {
|
||||
await setImage(arg.src)
|
||||
await setImage(arg.src)
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
} else if (arg.meter) {
|
||||
try {
|
||||
await setMeter()
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
} else if (arg.grid) {
|
||||
try {
|
||||
await setGrid()
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
if (arg.exposure) {
|
||||
await delay(arg.exposure)
|
||||
setBlank()
|
||||
}
|
||||
ipcRenderer.send('display_load', { src : arg.src })
|
||||
}
|
||||
return event.returnValue = true
|
||||
}
|
||||
|
||||
async function onEscape (evt) {
|
||||
let isEscape = false
|
||||
let win
|
||||
|
||||
evt = evt || window.event
|
||||
|
||||
if ('key' in evt) {
|
||||
|
@ -149,12 +262,16 @@
|
|||
} else {
|
||||
isEscape = (evt.keyCode == 27)
|
||||
}
|
||||
|
||||
if (isEscape) {
|
||||
win = remote.getCurrentWindow()
|
||||
win.close()
|
||||
}
|
||||
}
|
||||
ipcRenderer.on('display', onDigital)
|
||||
ipcRenderer.on('field', onField)
|
||||
ipcRenderer.on('meter', onMeter)
|
||||
ipcRenderer.on('focus', onFocus)
|
||||
document.onkeydown = onEscape
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.cs.allow-jit</key>
|
||||
<true/>
|
||||
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
|
||||
<true/>
|
||||
<key>com.apple.security.cs.debugger</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
|
@ -18,17 +18,17 @@ var scripts = [
|
|||
'./src/index.js'
|
||||
];
|
||||
|
||||
gulp.task('js', function () {
|
||||
gulp.task('js', () => {
|
||||
'use strict';
|
||||
return gulp.src(scripts)
|
||||
.pipe(concat('app.js'))
|
||||
.pipe(gulp.dest('./js/'));
|
||||
});
|
||||
|
||||
gulp.task('less', function () {
|
||||
gulp.task('less', () => {
|
||||
return gulp.src('./less/app.less')
|
||||
.pipe(less())
|
||||
.pipe(gulp.dest('./css'));
|
||||
});
|
||||
|
||||
gulp.task('default', ['js', 'less']);
|
||||
gulp.task('default', gulp.parallel('js', 'less'));
|
||||
|
|
102
app/index.html
102
app/index.html
|
@ -13,20 +13,20 @@
|
|||
</head>
|
||||
<body onload="init();" style="background:#272b30;">
|
||||
<nav id="toolbar"></nav>
|
||||
<div id="screens">
|
||||
<div id="screens" class="hide">
|
||||
<div id="sequencer" class="screen" style="display: block;">
|
||||
<div id="counters">
|
||||
<div class="cam">
|
||||
<label>CAMERA</label>
|
||||
<input type="number" id="seq_cam_count" class="count" value="00000" onchange="gui.counterFormat(this, cam.pos);" onblur="gui.updateCam2(this);" />
|
||||
<input type="number" id="seq_cam_count" class="count" value="00000" onchange="gui.counterFormat(this, cam.pos);" onblur="gui.updateCam(this);" />
|
||||
</div>
|
||||
<div class="cam2">
|
||||
<label>CAMERA</label>
|
||||
<input type="number" id="seq_cam_count_2" class="count" value="00000" onchange="gui.counterFormat(this, cam.pos);" onblur="gui.updateCam(this);" />
|
||||
<input type="number" id="seq_cam_2_count" class="count" value="00000" onchange="gui.counterFormat(this, cam.second.pos);" onblur="gui.updateCam2(this);" />
|
||||
</div>
|
||||
<div class="proj2">
|
||||
<label>PROJECTOR 2</label>
|
||||
<input type="number" id="seq_proj_count_2" class="count" value="00000" onchange="gui.counterFormat(this, proj.pos);" onblur="gui.updateProj2(this);" />
|
||||
<input type="number" id="seq_proj_2_count" class="count" value="00000" onchange="gui.counterFormat(this, proj.second.pos);" onblur="gui.updateProj2(this);" />
|
||||
</div>
|
||||
<div class="proj">
|
||||
<label>PROJECTOR</label>
|
||||
|
@ -45,6 +45,8 @@
|
|||
<div id="camera_second_backward" class="row cam2" y="2"></div>
|
||||
<div id="projector_backward" class="row" y="1"></div>
|
||||
<div id="projector_second_backward" class="row proj2" y="3"></div>
|
||||
|
||||
<div id="black" class="row black"></div>
|
||||
|
||||
<div id="light_set" class="row spacer"></div>
|
||||
<div id="numbers" class="row"></div>
|
||||
|
@ -60,6 +62,8 @@
|
|||
<div><span>PROJ </span><i class="fa fa-minus"></i></div>
|
||||
<div class="proj2"><span>PROJ2 </span><i class="fa fa-minus"></i></div>
|
||||
|
||||
<div class="black"><span>BLANK </span><i class="fa fa-times"></i></div>
|
||||
|
||||
<div class="spacer"><span>LIGHT</span></div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -144,20 +148,34 @@
|
|||
<i class="fa fa-step-backward"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<div class="hide">
|
||||
<button id="cmd_black_forward" onclick="cmd.black_forward();" class="cmd fwd">
|
||||
<i class="fa fa-times-circle"></i>
|
||||
BLANK +1
|
||||
<i class="fa fa-step-forward"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<div class="hide">
|
||||
<button id="cmd_black_backward" onclick="cmd.black_backward();" class="cmd bwd">
|
||||
<i class="fa fa-times-circle"></i>
|
||||
BLANK -1
|
||||
<i class="fa fa-step-backward"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="hide">
|
||||
<button id="cmd_capper_on" onclick="cmd.capper_on();" class="cmd capper">
|
||||
<i class="fa fa-times-circle"></i>
|
||||
CAPPER ON
|
||||
<i class="fa fa-eye"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="hide">
|
||||
<button id="cmd_capper_off" onclick="cmd.capper_off();" class="cmd capper active">
|
||||
<i class="fa fa-eye"></i>
|
||||
CAPPER OFF
|
||||
<i class="fa fa-eye"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div>
|
||||
|
@ -179,11 +197,11 @@
|
|||
<div id="counters_3" class="clearfix">
|
||||
<div class="cam2">
|
||||
<label>CAMERA 2</label>
|
||||
<input type="number" id="seq_cam_count_3" class="count" value="00000" onchange="gui.counterFormat(this, cam.pos);" onblur="gui.updateCam(this);" />
|
||||
<input type="number" id="seq_cam_2_count_2" class="count" value="00000" onchange="gui.counterFormat(this, cam.second.pos);" onblur="gui.updateCam2(this);" />
|
||||
</div>
|
||||
<div class="proj2">
|
||||
<label>PROJECTOR 2</label>
|
||||
<input type="number" id="seq_proj_count_3" class="count" value="00000" onchange="gui.counterFormat(this, proj.pos);" onblur="gui.updateProj(this);" />
|
||||
<input type="number" id="seq_proj_2_count_2" class="count" value="00000" onchange="gui.counterFormat(this, proj.second.pos);" onblur="gui.updateProj2(this);" />
|
||||
</div>
|
||||
</div>
|
||||
<div id="move_to_2" class="clearfix">
|
||||
|
@ -345,13 +363,51 @@
|
|||
<div id="video" class="screen">
|
||||
<div>
|
||||
<div>
|
||||
<input id="video_file" type="text" onclick="devices.digitalSelect();" readonly />
|
||||
<img src="#" id="video_preview">
|
||||
<div id="path_bar">
|
||||
<input id="filmout_file" type="text" onclick="filmout.selectFile();" readonly />
|
||||
<button onclick="$('#projector_type_digital').click();">USE FILE</button>
|
||||
<select id="filmout_displays"></select>
|
||||
</div>
|
||||
|
||||
<div id="filmout_preview_wrap">
|
||||
<div id="filmout_monitor">
|
||||
<div id="filmout"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="filmout_stats">
|
||||
<div id="filmout_stats_video">
|
||||
<h3>File</h3>
|
||||
<div id="filmout_stats_video_name"></div>
|
||||
<div id="filmout_stats_video_size"></div>
|
||||
<div id="filmout_stats_video_frames"></div>
|
||||
</div>
|
||||
<div id="filmout_stats_monitor">
|
||||
<h3>Monitor</h3>
|
||||
<div id="filmout_stats_monitor_size"></div>
|
||||
<div id="filmout_stats_monitor_aspect"></div>
|
||||
<div id="filmout_stats_monitor_scale"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="filmout_position_wrap">
|
||||
<div>
|
||||
<button id="filmout_rewind" title="Rewind 1 Frame" onclick="filmout.rewind();"><</button>
|
||||
<input id="filmout_position" class="count" type="number" value="00000" onchange="gui.counterFormat(this, this.value);" />
|
||||
<button id="filmout_advance" title="Advance 1 Frame" onclick="filmout.advance();">></button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="filmout_functions">
|
||||
<div>
|
||||
<button id="filmout_preview" onclick="filmout.preview();">PREVIEW</button>
|
||||
<button id="filmout_meter" onclick="filmout.meter();">METER</button>
|
||||
<button id="filmout_focus" onclick="filmout.focus();">FOCUS</button>
|
||||
<button id="filmout_field" onclick="filmout.field();">FIELD GUIDE</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="settings" class="screen">
|
||||
<div>
|
||||
<div class="left">
|
||||
<div>
|
||||
<h4>Devices</h4>
|
||||
<select id="devices">
|
||||
|
@ -367,8 +423,8 @@
|
|||
<input type="radio" id="projector_type_arduino" name="projector_type" value="arduino" checked="checked" />
|
||||
</div>
|
||||
<div class="spacer">
|
||||
<input type="text" id="digital" name="digital" placeholder="Digital file" onclick="devices.digitalSelect();" data-file="" readonly />
|
||||
<input type="radio" id="projector_type" name="projector_type" value="video" onclick="devices.digital();" />
|
||||
<input type="text" id="digital" name="digital" placeholder="Digital file" onclick="filmout.selectFile();" data-file="" readonly />
|
||||
<input type="radio" id="projector_type_digital" name="projector_type" value="video" onclick="filmout.useFile();" />
|
||||
</div>
|
||||
<div>
|
||||
<h4>Camera</h4>
|
||||
|
@ -381,6 +437,13 @@
|
|||
<input type="text" id="intval" name="intval" placeholder="INTVAL3 URL"/>
|
||||
<input type="radio" id="camera_type_intval" name="camera_type" value="intval" onclick="devices.intval();" />
|
||||
</div>
|
||||
<div class="spacer">
|
||||
<input type="text" id="processing" name="processing" placeholder="PROCESSING URL" />
|
||||
<input type="radio" id="camera_type_processing" name="camera_type" value="processing" onclick="devices.processing();" />
|
||||
</div>
|
||||
<div>
|
||||
<div id="version"></div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Light</h4>
|
||||
<select id="light_device">
|
||||
|
@ -394,6 +457,19 @@
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<div class="spacer"></div>
|
||||
<div class="proj_time">
|
||||
<h4>Projector Time (ms)</h4>
|
||||
<input type="number" readonly id="proj_time" value="0" />
|
||||
<button id="submit_proj_time" class="hide">✓</button>
|
||||
</div>
|
||||
<div class="cam_time">
|
||||
<h4>Camera Time (ms)</h4>
|
||||
<input type="number" readonly id="cam_time" value="0" />
|
||||
<button id="submit_cam_time" class="hide" onclick="cam.exposure($('#cam_time').val());">✓</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="overlay" onclick="gui.overlay(false);gui.spinner(false);"></div>
|
||||
|
|
|
@ -2474,12 +2474,14 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
!function(a,b){"object"==typeof exports?module.exports=b():"function"==typeof define&&define.amd?define(b):a.Spinner=b()}(this,function(){"use strict";function a(a,b){var c,d=document.createElement(a||"div");for(c in b)d[c]=b[c];return d}function b(a){for(var b=1,c=arguments.length;c>b;b++)a.appendChild(arguments[b]);return a}function c(a,b,c,d){var e=["opacity",b,~~(100*a),c,d].join("-"),f=.01+c/d*100,g=Math.max(1-(1-a)/b*(100-f),a),h=j.substring(0,j.indexOf("Animation")).toLowerCase(),i=h&&"-"+h+"-"||"";return l[e]||(m.insertRule("@"+i+"keyframes "+e+"{0%{opacity:"+g+"}"+f+"%{opacity:"+a+"}"+(f+.01)+"%{opacity:1}"+(f+b)%100+"%{opacity:"+a+"}100%{opacity:"+g+"}}",m.cssRules.length),l[e]=1),e}function d(a,b){var c,d,e=a.style;for(b=b.charAt(0).toUpperCase()+b.slice(1),d=0;d<k.length;d++)if(c=k[d]+b,void 0!==e[c])return c;return void 0!==e[b]?b:void 0}function e(a,b){for(var c in b)a.style[d(a,c)||c]=b[c];return a}function f(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)void 0===a[d]&&(a[d]=c[d])}return a}function g(a,b){return"string"==typeof a?a:a[b%a.length]}function h(a){this.opts=f(a||{},h.defaults,n)}function i(){function c(b,c){return a("<"+b+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',c)}m.addRule(".spin-vml","behavior:url(#default#VML)"),h.prototype.lines=function(a,d){function f(){return e(c("group",{coordsize:k+" "+k,coordorigin:-j+" "+-j}),{width:k,height:k})}function h(a,h,i){b(m,b(e(f(),{rotation:360/d.lines*a+"deg",left:~~h}),b(e(c("roundrect",{arcsize:d.corners}),{width:j,height:d.width,left:d.radius,top:-d.width>>1,filter:i}),c("fill",{color:g(d.color,a),opacity:d.opacity}),c("stroke",{opacity:0}))))}var i,j=d.length+d.width,k=2*j,l=2*-(d.width+d.length)+"px",m=e(f(),{position:"absolute",top:l,left:l});if(d.shadow)for(i=1;i<=d.lines;i++)h(i,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(i=1;i<=d.lines;i++)h(i);return b(a,m)},h.prototype.opacity=function(a,b,c,d){var e=a.firstChild;d=d.shadow&&d.lines||0,e&&b+d<e.childNodes.length&&(e=e.childNodes[b+d],e=e&&e.firstChild,e=e&&e.firstChild,e&&(e.opacity=c))}}var j,k=["webkit","Moz","ms","O"],l={},m=function(){var c=a("style",{type:"text/css"});return b(document.getElementsByTagName("head")[0],c),c.sheet||c.styleSheet}(),n={lines:12,length:7,width:5,radius:10,rotate:0,corners:1,color:"#000",direction:1,speed:1,trail:100,opacity:.25,fps:20,zIndex:2e9,className:"spinner",top:"50%",left:"50%",position:"absolute"};h.defaults={},f(h.prototype,{spin:function(b){this.stop();{var c=this,d=c.opts,f=c.el=e(a(0,{className:d.className}),{position:d.position,width:0,zIndex:d.zIndex});d.radius+d.length+d.width}if(e(f,{left:d.left,top:d.top}),b&&b.insertBefore(f,b.firstChild||null),f.setAttribute("role","progressbar"),c.lines(f,c.opts),!j){var g,h=0,i=(d.lines-1)*(1-d.direction)/2,k=d.fps,l=k/d.speed,m=(1-d.opacity)/(l*d.trail/100),n=l/d.lines;!function o(){h++;for(var a=0;a<d.lines;a++)g=Math.max(1-(h+(d.lines-a)*n)%l*m,d.opacity),c.opacity(f,a*d.direction+i,g,d);c.timeout=c.el&&setTimeout(o,~~(1e3/k))}()}return c},stop:function(){var a=this.el;return a&&(clearTimeout(this.timeout),a.parentNode&&a.parentNode.removeChild(a),this.el=void 0),this},lines:function(d,f){function h(b,c){return e(a(),{position:"absolute",width:f.length+f.width+"px",height:f.width+"px",background:b,boxShadow:c,transformOrigin:"left",transform:"rotate("+~~(360/f.lines*k+f.rotate)+"deg) translate("+f.radius+"px,0)",borderRadius:(f.corners*f.width>>1)+"px"})}for(var i,k=0,l=(f.lines-1)*(1-f.direction)/2;k<f.lines;k++)i=e(a(),{position:"absolute",top:1+~(f.width/2)+"px",transform:f.hwaccel?"translate3d(0,0,0)":"",opacity:f.opacity,animation:j&&c(f.opacity,f.trail,l+k*f.direction,f.lines)+" "+1/f.speed+"s linear infinite"}),f.shadow&&b(i,e(h("#000","0 0 4px #000"),{top:"2px"})),b(d,b(i,h(g(f.color,k),"0 0 1px rgba(0,0,0,.1)")));return d},opacity:function(a,b,c){b<a.childNodes.length&&(a.childNodes[b].style.opacity=c)}});var o=e(a("group"),{behavior:"url(#default#VML)"});return!d(o,"transform")&&o.adj?i():j=d(o,"animation"),h});
|
||||
const mcopy = {};
|
||||
|
||||
const { remote, ipcRenderer } = require('electron');
|
||||
const dialog = require('electron').remote.dialog;
|
||||
const remote = require('@electron/remote');
|
||||
const { ipcRenderer } = require('electron');
|
||||
const { dialog } = remote;
|
||||
const notifier = require('node-notifier');
|
||||
const fs = require('fs');
|
||||
const uuid = require('uuid').v4;
|
||||
const moment = require('moment');
|
||||
const path = require('path');
|
||||
const humanizeDuration = require('humanize-duration');
|
||||
const PACKAGE = require('./package.json');
|
||||
const cfg = require('./data/cfg.json');
|
||||
|
@ -2492,8 +2494,16 @@ const nav = require('./lib/ui/nav.js');
|
|||
const seq = require('./lib/ui/seq.js');
|
||||
const cmd = require('./lib/ui/cmd.js');
|
||||
const devices = require('./lib/ui/devices.js');
|
||||
const filmout = require('./lib/ui/filmout.js');
|
||||
const mse = require('./lib/ui/mscript.js');
|
||||
const capper = require('./lib/ui/capper.js');
|
||||
const timing = require('./lib/ui/timing.js');
|
||||
const Mscript = require('./lib/mscript');
|
||||
const { delay } = require('./lib/delay');
|
||||
const alertObj = require('./lib/ui/alert.js');
|
||||
const gamecontroller = require('./lib/ui/gamecontroller.js');
|
||||
const { Log } = require('./lib/log');
|
||||
|
||||
let log;
|
||||
|
||||
/******
|
||||
|
@ -2507,16 +2517,22 @@ mcopy.state = {
|
|||
async function init () {
|
||||
'use strict';
|
||||
|
||||
log = await require('log')({})
|
||||
log = await Log({ label : 'ui' })
|
||||
|
||||
nav.init();
|
||||
gui.init();
|
||||
grid.init();
|
||||
mse.mscript.init();
|
||||
mse.console.init();
|
||||
|
||||
devices.init();
|
||||
filmout.init();
|
||||
light.init();
|
||||
proj.init();
|
||||
cam.init();
|
||||
seq.init();
|
||||
capper.init();
|
||||
alertObj.init();
|
||||
timing.init();
|
||||
gamecontroller.init(seq, cmd, cam, proj);
|
||||
};
|
|
@ -8,7 +8,14 @@
|
|||
@import "./scroll.less";
|
||||
@import "./settings.less";
|
||||
@import "./mscript.less";
|
||||
@import "./filmout.less";
|
||||
|
||||
.hide {
|
||||
display: none;
|
||||
}
|
||||
.show {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#screens{
|
||||
overflow-x: hidden;
|
||||
|
@ -168,7 +175,8 @@
|
|||
}
|
||||
|
||||
.cam2,
|
||||
.proj2{
|
||||
.proj2,
|
||||
.black{
|
||||
display : none;
|
||||
> * {
|
||||
visibility: hidden;
|
||||
|
|
|
@ -42,6 +42,10 @@
|
|||
background: @BACKWARD;
|
||||
border-color: @BACKWARD;
|
||||
}
|
||||
&.capper{
|
||||
background: white;
|
||||
color: @BG;
|
||||
}
|
||||
i{
|
||||
color: @BG;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,117 @@
|
|||
#video{
|
||||
input,select{
|
||||
.button();
|
||||
display: inline-block;
|
||||
padding: 6px 12px;
|
||||
font-size: 21px;
|
||||
min-width: 300px;
|
||||
&.active{
|
||||
border-color: @SELECTED;
|
||||
color: @SELECTED;
|
||||
}
|
||||
}
|
||||
button, select {
|
||||
padding: 9px 16px 8px;
|
||||
}
|
||||
}
|
||||
|
||||
#path_bar{
|
||||
padding: 5px;
|
||||
height: 50px;
|
||||
input{
|
||||
float: left;
|
||||
}
|
||||
button{
|
||||
float: left;
|
||||
margin-left: 5px;
|
||||
}
|
||||
select{
|
||||
line-height: 41px;
|
||||
height: 37px;
|
||||
margin-right: 5px;
|
||||
float: right;
|
||||
box-sizing: content-box;
|
||||
padding: 0 0 0 8px;
|
||||
}
|
||||
}
|
||||
#filmout_file {
|
||||
|
||||
}
|
||||
#filmout_monitor{
|
||||
display: none;
|
||||
border: 2px solid white;
|
||||
box-sizing: border-box;
|
||||
height: 360px;
|
||||
margin: 0 auto;
|
||||
position: relative;
|
||||
&.on{
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
#filmout_preview_wrap {
|
||||
background: #000;
|
||||
width: 100%;
|
||||
height: 360px;
|
||||
}
|
||||
#filmout {
|
||||
position: absolute;
|
||||
background-repeat:no-repeat;
|
||||
background-size: contain;
|
||||
background-position: center;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
display: block;
|
||||
opacity: 0;
|
||||
&.on {
|
||||
opacity: 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
#filmout_position_wrap{
|
||||
padding-top: 5px;
|
||||
height: 50px;
|
||||
input{
|
||||
margin-right: 5px;
|
||||
margin-left: 5px;
|
||||
width: 308px !important;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
button, input{
|
||||
float: left;
|
||||
}
|
||||
> div{
|
||||
width: 425px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
}
|
||||
|
||||
#filmout_functions{
|
||||
padding-top: 5px;
|
||||
> div{
|
||||
width: 425px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
}
|
||||
|
||||
#filmout_stats_video,
|
||||
#filmout_stats_monitor{
|
||||
width: 150px;
|
||||
position: absolute;
|
||||
//background: grey;
|
||||
padding: 10px 5px;
|
||||
text-align: center;
|
||||
h3{
|
||||
font-size: 20px;
|
||||
margin: 16px 0 3px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
#filmout_stats_video{
|
||||
left: 5px;
|
||||
}
|
||||
#filmout_stats_monitor{
|
||||
right: 5px;
|
||||
}
|
|
@ -28,6 +28,7 @@
|
|||
float: right;
|
||||
width: 90px;
|
||||
margin-right: 60px;
|
||||
height: 32px;
|
||||
}
|
||||
}
|
||||
#seq_stats{
|
||||
|
@ -126,6 +127,13 @@
|
|||
color: @BACKWARD + @SECOND;
|
||||
}
|
||||
}
|
||||
#black{
|
||||
input[type=checkbox]{
|
||||
&:checked{
|
||||
background: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
input[type=checkbox]{
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
|
@ -141,6 +149,10 @@
|
|||
display: inline-block;
|
||||
box-sizing: border-box;
|
||||
cursor: pointer;
|
||||
&.disabled{
|
||||
cursor: not-allowed;
|
||||
border-color: rgb(100, 100, 100);
|
||||
}
|
||||
}
|
||||
.L{
|
||||
display: inline-block;
|
||||
|
|
|
@ -1,25 +1,61 @@
|
|||
#settings{
|
||||
h4{
|
||||
margin-bottom: 1px;
|
||||
}
|
||||
> div{
|
||||
width: 300px;
|
||||
margin: 0 auto;
|
||||
&.left{
|
||||
float: left;
|
||||
padding-left: 30px;
|
||||
}
|
||||
&.right{
|
||||
float: right;
|
||||
padding-right: 30px;
|
||||
input[type=number] {
|
||||
min-width: 200px;
|
||||
width: 200px;
|
||||
}
|
||||
input[readonly]{
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.spacer{
|
||||
height: 62px;
|
||||
}
|
||||
.proj_time{
|
||||
height: 111px;
|
||||
}
|
||||
.cam_time{
|
||||
height: 111px;
|
||||
}
|
||||
& > div {
|
||||
width: 270px;
|
||||
}
|
||||
}
|
||||
}
|
||||
> div > div{
|
||||
width: 360px;
|
||||
}
|
||||
input[type=text], select{
|
||||
input[type=text],
|
||||
input[type=number],
|
||||
select{
|
||||
.button();
|
||||
display: inline-block;
|
||||
padding: 6px 12px;
|
||||
font-size: 21px;
|
||||
min-width: 300px;
|
||||
max-width: 300px;
|
||||
&.active{
|
||||
border-color: @SELECTED;
|
||||
color: @SELECTED;
|
||||
}
|
||||
}
|
||||
input[type=text]{
|
||||
width: 200px;
|
||||
}
|
||||
button{
|
||||
margin-top: -1px;
|
||||
float: right;
|
||||
margin-top: 0px;
|
||||
float: right;
|
||||
padding: 8px 16px 9px;
|
||||
}
|
||||
input[type=radio]{
|
||||
float: right;
|
||||
|
@ -28,4 +64,15 @@
|
|||
.spacer{
|
||||
margin-top: 10px;
|
||||
}
|
||||
#version{
|
||||
position: absolute;
|
||||
right: 20px;
|
||||
bottom: 10px;
|
||||
z-index: 1000;
|
||||
height: 14px;
|
||||
width: auto;
|
||||
font-size: 14px;
|
||||
line-height: 14px;
|
||||
color: #999;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<a name="module_lib/alert"></a>
|
||||
|
||||
## lib/alert
|
||||
|
||||
* [lib/alert](#module_lib/alert)
|
||||
* [~Alert](#module_lib/alert..Alert)
|
||||
* [.init()](#module_lib/alert..Alert+init)
|
||||
* [.listen()](#module_lib/alert..Alert+listen)
|
||||
* [.listener()](#module_lib/alert..Alert+listener)
|
||||
* [.start()](#module_lib/alert..Alert+start)
|
||||
|
||||
<a name="module_lib/alert..Alert"></a>
|
||||
|
||||
### lib/alert~Alert
|
||||
Class for pushing an alert to the UI from the backend.
|
||||
|
||||
**Kind**: inner class of [<code>lib/alert</code>](#module_lib/alert)
|
||||
|
||||
* [~Alert](#module_lib/alert..Alert)
|
||||
* [.init()](#module_lib/alert..Alert+init)
|
||||
* [.listen()](#module_lib/alert..Alert+listen)
|
||||
* [.listener()](#module_lib/alert..Alert+listener)
|
||||
* [.start()](#module_lib/alert..Alert+start)
|
||||
|
||||
<a name="module_lib/alert..Alert+init"></a>
|
||||
|
||||
#### alert.init()
|
||||
**Kind**: instance method of [<code>Alert</code>](#module_lib/alert..Alert)
|
||||
<a name="module_lib/alert..Alert+listen"></a>
|
||||
|
||||
#### alert.listen()
|
||||
**Kind**: instance method of [<code>Alert</code>](#module_lib/alert..Alert)
|
||||
<a name="module_lib/alert..Alert+listener"></a>
|
||||
|
||||
#### alert.listener()
|
||||
**Kind**: instance method of [<code>Alert</code>](#module_lib/alert..Alert)
|
||||
<a name="module_lib/alert..Alert+start"></a>
|
||||
|
||||
#### alert.start()
|
||||
**Kind**: instance method of [<code>Alert</code>](#module_lib/alert..Alert)
|
|
@ -0,0 +1,29 @@
|
|||
import type { WebContents } from 'electron';
|
||||
/** @module lib/alert */
|
||||
/**
|
||||
* Class for pushing an alert to the UI from the backend.
|
||||
*/
|
||||
export declare class Alert {
|
||||
private ipc;
|
||||
private log;
|
||||
private id;
|
||||
private cb;
|
||||
private ui;
|
||||
constructor(ui: WebContents);
|
||||
/**
|
||||
*
|
||||
**/
|
||||
private init;
|
||||
/**
|
||||
*
|
||||
**/
|
||||
private listen;
|
||||
/**
|
||||
*
|
||||
**/
|
||||
private listener;
|
||||
/**
|
||||
*
|
||||
**/
|
||||
start(cmd: string): Promise<number>;
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Alert = void 0;
|
||||
const electron_1 = require("electron");
|
||||
const log_1 = require("log");
|
||||
/** @module lib/alert */
|
||||
/**
|
||||
* Class for pushing an alert to the UI from the backend.
|
||||
*/
|
||||
class Alert {
|
||||
constructor(ui) {
|
||||
this.ipc = electron_1.ipcMain;
|
||||
this.id = 'alert';
|
||||
this.cb = null;
|
||||
this.ui = ui;
|
||||
this.init();
|
||||
}
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async init() {
|
||||
this.log = await (0, log_1.Log)({ label: this.id });
|
||||
this.listen();
|
||||
}
|
||||
/**
|
||||
*
|
||||
**/
|
||||
listen() {
|
||||
this.ipc.on(this.id, this.listener.bind(this));
|
||||
}
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async listener(event, arg) {
|
||||
if (this.cb !== null) {
|
||||
try {
|
||||
await this.cb(arg.state, arg.id);
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(err);
|
||||
}
|
||||
}
|
||||
event.returnValue = true;
|
||||
}
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async start(cmd) {
|
||||
const start = +new Date();
|
||||
const msg = (cmd + '').replace('ALERT', '').replace('Alert', '').replace('alert', '').trim();
|
||||
this.ui.send(this.id, { msg });
|
||||
return new Promise(function (resolve, reject) {
|
||||
this.cb = function () {
|
||||
const ms = (+new Date()) - start;
|
||||
return resolve(ms);
|
||||
};
|
||||
}.bind(this));
|
||||
}
|
||||
}
|
||||
exports.Alert = Alert;
|
||||
module.exports = { Alert };
|
||||
//# sourceMappingURL=index.js.map
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/alert/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,uCAAmC;AAEnC,6BAA0B;AAI1B,wBAAwB;AAExB;;GAEG;AAEH,MAAa,KAAK;IAOjB,YAAc,EAAgB;QANtB,QAAG,GAAoB,kBAAO,CAAA;QAE9B,OAAE,GAAY,OAAO,CAAA;QACrB,OAAE,GAAc,IAAI,CAAA;QAI3B,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;QACZ,IAAI,CAAC,IAAI,EAAE,CAAA;IACZ,CAAC;IAED;;QAEI;IACI,KAAK,CAAC,IAAI;QACjB,IAAI,CAAC,GAAG,GAAG,MAAM,IAAA,SAAG,EAAC,EAAE,KAAK,EAAG,IAAI,CAAC,EAAE,EAAE,CAAC,CAAA;QACzC,IAAI,CAAC,MAAM,EAAE,CAAA;IACd,CAAC;IAED;;QAEI;IACI,MAAM;QACb,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IAC/C,CAAC;IAED;;QAEI;IACI,KAAK,CAAC,QAAQ,CAAE,KAAoB,EAAE,GAAS;QACtD,IAAI,IAAI,CAAC,EAAE,KAAK,IAAI,EAAE;YACrB,IAAI;gBACH,MAAM,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC,CAAA;aAChC;YAAC,OAAO,GAAG,EAAE;gBACb,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;aACnB;SACD;QACD,KAAK,CAAC,WAAW,GAAG,IAAI,CAAA;IACzB,CAAC;IAED;;QAEI;IACG,KAAK,CAAC,KAAK,CAAE,GAAY;QAC/B,MAAM,KAAK,GAAY,CAAC,IAAI,IAAI,EAAE,CAAC;QACnC,MAAM,GAAG,GAAY,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAA;QACrG,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,CAAA;QAC9B,OAAO,IAAI,OAAO,CAAC,UAAU,OAAkB,EAAE,MAAiB;YACjE,IAAI,CAAC,EAAE,GAAG;gBACT,MAAM,EAAE,GAAY,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC;gBAC1C,OAAO,OAAO,CAAC,EAAE,CAAC,CAAC;YACpB,CAAC,CAAA;QACF,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACf,CAAC;CACD;AAvDD,sBAuDC;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,KAAK,EAAE,CAAA"}
|
|
@ -1,43 +1,146 @@
|
|||
<a name="Arduino"></a>
|
||||
## Modules
|
||||
|
||||
## Arduino
|
||||
Class representing the arduino communication features
|
||||
<dl>
|
||||
<dt><a href="#module_lib/arduino">lib/arduino</a></dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
|
||||
**Kind**: global class
|
||||
## Constants
|
||||
|
||||
* [Arduino](#Arduino)
|
||||
* [.enumerate()](#Arduino+enumerate) ⇒ <code>Promise</code>
|
||||
* [.sendAsync(device, cmd)](#Arduino+sendAsync) ⇒ <code>Promise</code>
|
||||
* [.writeAsync(device, str)](#Arduino+writeAsync) ⇒ <code>Promise</code>
|
||||
* [.openArduino(device)](#Arduino+openArduino) ⇒ <code>Promise</code>
|
||||
* [.closeArduino(device)](#Arduino+closeArduino) ⇒ <code>Promise</code>
|
||||
<dl>
|
||||
<dt><a href="#delay_1">delay_1</a></dt>
|
||||
<dd><p>2023-07-16 Clarification</p>
|
||||
<p>Previous versions of this script intermingled and even
|
||||
swapped the usage of the terms 'serial' and 'device'.
|
||||
From here on out, the terms will be used as such:</p>
|
||||
<p>serial - a hardware address of a serial port
|
||||
device - common name of a type of mcopy device (eg. camera,
|
||||
projector, light) that is aliased to a serial port</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<a name="Arduino+enumerate"></a>
|
||||
<a name="module_lib/arduino"></a>
|
||||
|
||||
### arduino.enumerate() ⇒ <code>Promise</code>
|
||||
## lib/arduino
|
||||
|
||||
* [lib/arduino](#module_lib/arduino)
|
||||
* [~Arduino](#module_lib/arduino..Arduino)
|
||||
* [.enumerate()](#module_lib/arduino..Arduino+enumerate) ⇒ <code>Promise</code>
|
||||
* [.sendAsync(device, cmd)](#module_lib/arduino..Arduino+sendAsync) ⇒ <code>Promise</code>
|
||||
* [.send(device, cmd)](#module_lib/arduino..Arduino+send) ⇒ <code>Promise.<(boolean\|string)></code>
|
||||
* [.sendString(device, str)](#module_lib/arduino..Arduino+sendString) ⇒ <code>Promise.<(boolean\|string)></code>
|
||||
* [.stateAsync()](#module_lib/arduino..Arduino+stateAsync)
|
||||
* [.state()](#module_lib/arduino..Arduino+state)
|
||||
* [.writeAsync(device, str)](#module_lib/arduino..Arduino+writeAsync) ⇒ <code>Promise</code>
|
||||
* [.end(serial, data)](#module_lib/arduino..Arduino+end) ⇒ <code>any</code>
|
||||
* [.aliasSerial(device, serial)](#module_lib/arduino..Arduino+aliasSerial)
|
||||
* [.connect(device, serial, confirm)](#module_lib/arduino..Arduino+connect) ⇒ <code>Promise.<string></code>
|
||||
* [.confirmEnd(data)](#module_lib/arduino..Arduino+confirmEnd)
|
||||
* [.verify()](#module_lib/arduino..Arduino+verify) ⇒ <code>Promise.<boolean></code>
|
||||
* [.distinguish()](#module_lib/arduino..Arduino+distinguish) ⇒ <code>Promise.<string></code>
|
||||
* [.close()](#module_lib/arduino..Arduino+close) ⇒ <code>Promise.<boolean></code>
|
||||
* [.fakeConnect(serial)](#module_lib/arduino..Arduino+fakeConnect) ⇒ <code>Promise.<boolean></code>
|
||||
* [.openArduino(device)](#module_lib/arduino..Arduino+openArduino) ⇒ <code>Promise</code>
|
||||
* [.closeArduino(device)](#module_lib/arduino..Arduino+closeArduino) ⇒ <code>Promise</code>
|
||||
|
||||
<a name="module_lib/arduino..Arduino"></a>
|
||||
|
||||
### lib/arduino~Arduino
|
||||
Class representing the arduino communication features.
|
||||
|
||||
**Kind**: inner class of [<code>lib/arduino</code>](#module_lib/arduino)
|
||||
|
||||
* [~Arduino](#module_lib/arduino..Arduino)
|
||||
* [.enumerate()](#module_lib/arduino..Arduino+enumerate) ⇒ <code>Promise</code>
|
||||
* [.sendAsync(device, cmd)](#module_lib/arduino..Arduino+sendAsync) ⇒ <code>Promise</code>
|
||||
* [.send(device, cmd)](#module_lib/arduino..Arduino+send) ⇒ <code>Promise.<(boolean\|string)></code>
|
||||
* [.sendString(device, str)](#module_lib/arduino..Arduino+sendString) ⇒ <code>Promise.<(boolean\|string)></code>
|
||||
* [.stateAsync()](#module_lib/arduino..Arduino+stateAsync)
|
||||
* [.state()](#module_lib/arduino..Arduino+state)
|
||||
* [.writeAsync(device, str)](#module_lib/arduino..Arduino+writeAsync) ⇒ <code>Promise</code>
|
||||
* [.end(serial, data)](#module_lib/arduino..Arduino+end) ⇒ <code>any</code>
|
||||
* [.aliasSerial(device, serial)](#module_lib/arduino..Arduino+aliasSerial)
|
||||
* [.connect(device, serial, confirm)](#module_lib/arduino..Arduino+connect) ⇒ <code>Promise.<string></code>
|
||||
* [.confirmEnd(data)](#module_lib/arduino..Arduino+confirmEnd)
|
||||
* [.verify()](#module_lib/arduino..Arduino+verify) ⇒ <code>Promise.<boolean></code>
|
||||
* [.distinguish()](#module_lib/arduino..Arduino+distinguish) ⇒ <code>Promise.<string></code>
|
||||
* [.close()](#module_lib/arduino..Arduino+close) ⇒ <code>Promise.<boolean></code>
|
||||
* [.fakeConnect(serial)](#module_lib/arduino..Arduino+fakeConnect) ⇒ <code>Promise.<boolean></code>
|
||||
* [.openArduino(device)](#module_lib/arduino..Arduino+openArduino) ⇒ <code>Promise</code>
|
||||
* [.closeArduino(device)](#module_lib/arduino..Arduino+closeArduino) ⇒ <code>Promise</code>
|
||||
|
||||
<a name="module_lib/arduino..Arduino+enumerate"></a>
|
||||
|
||||
#### arduino.enumerate() ⇒ <code>Promise</code>
|
||||
Enumerate all connected devices that might be Arduinos
|
||||
|
||||
**Kind**: instance method of [<code>Arduino</code>](#Arduino)
|
||||
**Kind**: instance method of [<code>Arduino</code>](#module_lib/arduino..Arduino)
|
||||
**Returns**: <code>Promise</code> - Resolves after enumerating
|
||||
<a name="Arduino+sendAsync"></a>
|
||||
<a name="module_lib/arduino..Arduino+sendAsync"></a>
|
||||
|
||||
### arduino.sendAsync(device, cmd) ⇒ <code>Promise</code>
|
||||
#### arduino.sendAsync(device, cmd) ⇒ <code>Promise</code>
|
||||
Send a command to an Arduino using async/await
|
||||
|
||||
**Kind**: instance method of [<code>Arduino</code>](#Arduino)
|
||||
**Kind**: instance method of [<code>Arduino</code>](#module_lib/arduino..Arduino)
|
||||
**Returns**: <code>Promise</code> - Resolves after sending
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| device | <code>string</code> | Arduino identifier |
|
||||
| device | <code>string</code> | The Arduino device identifier |
|
||||
| cmd | <code>string</code> | Single character command to send |
|
||||
|
||||
<a name="Arduino+writeAsync"></a>
|
||||
<a name="module_lib/arduino..Arduino+send"></a>
|
||||
|
||||
### arduino.writeAsync(device, str) ⇒ <code>Promise</code>
|
||||
#### arduino.send(device, cmd) ⇒ <code>Promise.<(boolean\|string)></code>
|
||||
Sends a command to the specified Arduino and waits for a response.
|
||||
Handles the communication lock to prevent sending multiple commands simultaneously.
|
||||
Emits an 'arduino_send' event after successfully sending the command.
|
||||
|
||||
**Kind**: instance method of [<code>Arduino</code>](#module_lib/arduino..Arduino)
|
||||
**Returns**: <code>Promise.<(boolean\|string)></code> - Returns 'false' if the communication is locked, otherwise returns the response from the device.
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Throws an error if the sendAsync method encounters an error.
|
||||
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| device | <code>string</code> | The Arduino device identifier. |
|
||||
| cmd | <code>string</code> | The command to be sent to the Arduino. |
|
||||
|
||||
<a name="module_lib/arduino..Arduino+sendString"></a>
|
||||
|
||||
#### arduino.sendString(device, str) ⇒ <code>Promise.<(boolean\|string)></code>
|
||||
Sends a string to the specified Arduino.
|
||||
Handles different types of devices, including fake devices for testing purposes.
|
||||
Waits for a specified delay before sending the string.
|
||||
|
||||
**Kind**: instance method of [<code>Arduino</code>](#module_lib/arduino..Arduino)
|
||||
**Returns**: <code>Promise.<(boolean\|string)></code> - Returns 'true' if the string is sent successfully, otherwise returns an error message.
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Throws an error if the writeAsync method encounters an error.
|
||||
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| device | <code>string</code> | The Arduino device identifier. |
|
||||
| str | <code>string</code> | The string to be sent to the Arduino. |
|
||||
|
||||
<a name="module_lib/arduino..Arduino+stateAsync"></a>
|
||||
|
||||
#### arduino.stateAsync()
|
||||
**Kind**: instance method of [<code>Arduino</code>](#module_lib/arduino..Arduino)
|
||||
<a name="module_lib/arduino..Arduino+state"></a>
|
||||
|
||||
#### arduino.state()
|
||||
**Kind**: instance method of [<code>Arduino</code>](#module_lib/arduino..Arduino)
|
||||
<a name="module_lib/arduino..Arduino+writeAsync"></a>
|
||||
|
||||
#### arduino.writeAsync(device, str) ⇒ <code>Promise</code>
|
||||
Send a string to an Arduino using async/await
|
||||
|
||||
**Kind**: instance method of [<code>Arduino</code>](#Arduino)
|
||||
**Kind**: instance method of [<code>Arduino</code>](#module_lib/arduino..Arduino)
|
||||
**Returns**: <code>Promise</code> - Resolves after sending
|
||||
|
||||
| Param | Type | Description |
|
||||
|
@ -45,27 +148,149 @@ Send a string to an Arduino using async/await
|
|||
| device | <code>string</code> | Arduino identifier |
|
||||
| str | <code>string</code> | String to send |
|
||||
|
||||
<a name="Arduino+openArduino"></a>
|
||||
<a name="module_lib/arduino..Arduino+end"></a>
|
||||
|
||||
### arduino.openArduino(device) ⇒ <code>Promise</code>
|
||||
#### arduino.end(serial, data) ⇒ <code>any</code>
|
||||
Handles the end of communication with the Arduino.
|
||||
Calculates the time taken for the communication, executes the callback,
|
||||
and emits an 'arduino_end' event. Handles errors and stray data received.
|
||||
|
||||
**Kind**: instance method of [<code>Arduino</code>](#module_lib/arduino..Arduino)
|
||||
**Returns**: <code>any</code> - The time taken for the communication in milliseconds.
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| serial | <code>string</code> | The serial address of the Arduino device. |
|
||||
| data | <code>string</code> | The data received from the Arduino. |
|
||||
|
||||
<a name="module_lib/arduino..Arduino+aliasSerial"></a>
|
||||
|
||||
#### arduino.aliasSerial(device, serial)
|
||||
Associates an alias with an Arduinos serial address.
|
||||
Used to map multi-purpose devices onto the same serial connection.
|
||||
|
||||
**Kind**: instance method of [<code>Arduino</code>](#module_lib/arduino..Arduino)
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| device | <code>string</code> | The serial number of the target Arduino. |
|
||||
| serial | <code>string</code> | The alias to be associated with the target device. |
|
||||
|
||||
<a name="module_lib/arduino..Arduino+connect"></a>
|
||||
|
||||
#### arduino.connect(device, serial, confirm) ⇒ <code>Promise.<string></code>
|
||||
Connects to an Arduino using its serial number.
|
||||
Sets up the SerialPort instance and path for the device, and handles data communication.
|
||||
Handles opening the connection and emitting 'arduino_end' or 'confirmEnd' events upon receiving data.
|
||||
|
||||
**Kind**: instance method of [<code>Arduino</code>](#module_lib/arduino..Arduino)
|
||||
**Returns**: <code>Promise.<string></code> - Resolves with the device path if the connection is successful.
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Rejects with an error message if the connection fails.
|
||||
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| device | <code>string</code> | The device identifier (common name). |
|
||||
| serial | <code>string</code> | The serial address of the target Arduino (e.g., COM port on Windows). |
|
||||
| confirm | <code>function</code> | A callback function to be executed upon receiving confirmation data. |
|
||||
|
||||
<a name="module_lib/arduino..Arduino+confirmEnd"></a>
|
||||
|
||||
#### arduino.confirmEnd(data)
|
||||
Handles the confirmation data received from an Arduino.
|
||||
Executes the confirmation callback function if the received data is present in the list of expected values.
|
||||
|
||||
**Kind**: instance method of [<code>Arduino</code>](#module_lib/arduino..Arduino)
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| data | <code>string</code> | The data received from the Arduino. |
|
||||
|
||||
<a name="module_lib/arduino..Arduino+verify"></a>
|
||||
|
||||
#### arduino.verify() ⇒ <code>Promise.<boolean></code>
|
||||
Verifies the connection to an Arduino by sending a connect command.
|
||||
The confirmation callback checks if the received data matches the expected connect command.
|
||||
|
||||
**Kind**: instance method of [<code>Arduino</code>](#module_lib/arduino..Arduino)
|
||||
**Returns**: <code>Promise.<boolean></code> - Resolves with 'true' if the connection is verified successfully.
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Rejects with an error message if the connection verification fails.
|
||||
|
||||
<a name="module_lib/arduino..Arduino+distinguish"></a>
|
||||
|
||||
#### arduino.distinguish() ⇒ <code>Promise.<string></code>
|
||||
Distinguishes the type of Arduino connected.
|
||||
Sends a command to the device to identify its type and resolves the promise with the received type.
|
||||
|
||||
**Kind**: instance method of [<code>Arduino</code>](#module_lib/arduino..Arduino)
|
||||
**Returns**: <code>Promise.<string></code> - Resolves with the type of the connected Arduino-based device.
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Rejects with an error message if the distinguish operation fails.
|
||||
|
||||
<a name="module_lib/arduino..Arduino+close"></a>
|
||||
|
||||
#### arduino.close() ⇒ <code>Promise.<boolean></code>
|
||||
Closes the connection to an Arduino.
|
||||
|
||||
**Kind**: instance method of [<code>Arduino</code>](#module_lib/arduino..Arduino)
|
||||
**Returns**: <code>Promise.<boolean></code> - Resolves with 'true' if the connection is closed successfully.
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Throws an error if the closeArduino method encounters an error.
|
||||
|
||||
<a name="module_lib/arduino..Arduino+fakeConnect"></a>
|
||||
|
||||
#### arduino.fakeConnect(serial) ⇒ <code>Promise.<boolean></code>
|
||||
Establishes a fake connection to an Arduino for testing purposes.
|
||||
Creates a fake SerialPort instance with custom write and string methods.
|
||||
|
||||
**Kind**: instance method of [<code>Arduino</code>](#module_lib/arduino..Arduino)
|
||||
**Returns**: <code>Promise.<boolean></code> - Resolves with 'true' if the fake connection is established successfully.
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| serial | <code>string</code> | The device identifier of the fake Arduino. |
|
||||
|
||||
<a name="module_lib/arduino..Arduino+openArduino"></a>
|
||||
|
||||
#### arduino.openArduino(device) ⇒ <code>Promise</code>
|
||||
Connect to an Arduino using async/await
|
||||
|
||||
**Kind**: instance method of [<code>Arduino</code>](#Arduino)
|
||||
**Kind**: instance method of [<code>Arduino</code>](#module_lib/arduino..Arduino)
|
||||
**Returns**: <code>Promise</code> - Resolves after opening
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| device | <code>string</code> | Arduino identifier |
|
||||
|
||||
<a name="Arduino+closeArduino"></a>
|
||||
<a name="module_lib/arduino..Arduino+closeArduino"></a>
|
||||
|
||||
### arduino.closeArduino(device) ⇒ <code>Promise</code>
|
||||
#### arduino.closeArduino(device) ⇒ <code>Promise</code>
|
||||
Close a connection to an Arduino using async/await
|
||||
|
||||
**Kind**: instance method of [<code>Arduino</code>](#Arduino)
|
||||
**Kind**: instance method of [<code>Arduino</code>](#module_lib/arduino..Arduino)
|
||||
**Returns**: <code>Promise</code> - Resolves after closing
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| device | <code>string</code> | Arduino identifier |
|
||||
|
||||
<a name="delay_1"></a>
|
||||
|
||||
## delay\_1
|
||||
2023-07-16 Clarification
|
||||
|
||||
Previous versions of this script intermingled and even
|
||||
swapped the usage of the terms 'serial' and 'device'.
|
||||
From here on out, the terms will be used as such:
|
||||
|
||||
serial - a hardware address of a serial port
|
||||
device - common name of a type of mcopy device (eg. camera,
|
||||
projector, light) that is aliased to a serial port
|
||||
|
||||
**Kind**: global constant
|
||||
|
|
|
@ -0,0 +1,179 @@
|
|||
/// <reference types="node" />
|
||||
import type { EventEmitter } from 'events';
|
||||
import type { Config } from 'cfg';
|
||||
/** @module lib/arduino */
|
||||
/**
|
||||
* Class representing the arduino communication features.
|
||||
*/
|
||||
export declare class Arduino {
|
||||
private log;
|
||||
private eventEmitter;
|
||||
private cfg;
|
||||
private path;
|
||||
private known;
|
||||
private serial;
|
||||
private baud;
|
||||
private queue;
|
||||
private timer;
|
||||
private locks;
|
||||
private confirmExec;
|
||||
private errorState;
|
||||
private keys;
|
||||
private values;
|
||||
alias: any;
|
||||
stateStr: any;
|
||||
hasState: any;
|
||||
constructor(cfg: Config, ee: EventEmitter, errorState: Function);
|
||||
init(): Promise<void>;
|
||||
/**
|
||||
* Enumerate all connected devices that might be Arduinos
|
||||
*
|
||||
* @async
|
||||
* @returns {Promise} Resolves after enumerating
|
||||
**/
|
||||
enumerate(): Promise<string[]>;
|
||||
/**
|
||||
* Send a command to an Arduino using async/await
|
||||
*
|
||||
* @param {string} device The Arduino device identifier
|
||||
* @param {string} cmd Single character command to send
|
||||
*
|
||||
* @async
|
||||
* @returns {Promise} Resolves after sending
|
||||
**/
|
||||
private sendAsync;
|
||||
/**
|
||||
* Sends a command to the specified Arduino and waits for a response.
|
||||
* Handles the communication lock to prevent sending multiple commands simultaneously.
|
||||
* Emits an 'arduino_send' event after successfully sending the command.
|
||||
*
|
||||
* @async
|
||||
* @param {string} device - The Arduino device identifier.
|
||||
* @param {string} cmd - The command to be sent to the Arduino.
|
||||
* @returns {Promise<boolean|string>} Returns 'false' if the communication is locked, otherwise returns the response from the device.
|
||||
* @throws {Error} Throws an error if the sendAsync method encounters an error.
|
||||
**/
|
||||
send(device: string, cmd: string): Promise<number>;
|
||||
/**
|
||||
* Sends a string to the specified Arduino.
|
||||
* Handles different types of devices, including fake devices for testing purposes.
|
||||
* Waits for a specified delay before sending the string.
|
||||
*
|
||||
* @async
|
||||
* @param {string} device - The Arduino device identifier.
|
||||
* @param {string} str - The string to be sent to the Arduino.
|
||||
* @returns {Promise<boolean|string>} Returns 'true' if the string is sent successfully, otherwise returns an error message.
|
||||
* @throws {Error} Throws an error if the writeAsync method encounters an error.
|
||||
**/
|
||||
sendString(device: string, str: string): Promise<number>;
|
||||
/**
|
||||
*
|
||||
**/
|
||||
private stateAsync;
|
||||
/**
|
||||
*
|
||||
**/
|
||||
state(device: string, confirm?: boolean): Promise<string>;
|
||||
/**
|
||||
* Send a string to an Arduino using async/await
|
||||
*
|
||||
* @param {string} device Arduino identifier
|
||||
* @param {string} str String to send
|
||||
*
|
||||
* @returns {Promise} Resolves after sending
|
||||
**/
|
||||
private writeAsync;
|
||||
/**
|
||||
* Handles the end of communication with the Arduino.
|
||||
* Calculates the time taken for the communication, executes the callback,
|
||||
* and emits an 'arduino_end' event. Handles errors and stray data received.
|
||||
*
|
||||
* @param {string} serial - The serial address of the Arduino device.
|
||||
* @param {string} data - The data received from the Arduino.
|
||||
* @returns {any} The time taken for the communication in milliseconds.
|
||||
**/
|
||||
private end;
|
||||
private error;
|
||||
/**
|
||||
* Associates an alias with an Arduinos serial address.
|
||||
* Used to map multi-purpose devices onto the same serial connection.
|
||||
*
|
||||
* @param {string} device - The serial number of the target Arduino.
|
||||
* @param {string} serial - The alias to be associated with the target device.
|
||||
**/
|
||||
aliasSerial(device: string, serial: string): void;
|
||||
/**
|
||||
* Connects to an Arduino using its serial number.
|
||||
* Sets up the SerialPort instance and path for the device, and handles data communication.
|
||||
* Handles opening the connection and emitting 'arduino_end' or 'confirmEnd' events upon receiving data.
|
||||
*
|
||||
* @async
|
||||
* @param {string} device - The device identifier (common name).
|
||||
* @param {string} serial - The serial address of the target Arduino (e.g., COM port on Windows).
|
||||
* @param {function} confirm - A callback function to be executed upon receiving confirmation data.
|
||||
* @returns {Promise<string>} Resolves with the device path if the connection is successful.
|
||||
* @throws {Error} Rejects with an error message if the connection fails.
|
||||
**/
|
||||
connect(device: string, serial: string, confirm: any): Promise<any>;
|
||||
/**
|
||||
* Handles the confirmation data received from an Arduino.
|
||||
* Executes the confirmation callback function if the received data is present in the list of expected values.
|
||||
*
|
||||
* @param {string} data - The data received from the Arduino.
|
||||
**/
|
||||
private confirmEnd;
|
||||
/**
|
||||
* Verifies the connection to an Arduino by sending a connect command.
|
||||
* The confirmation callback checks if the received data matches the expected connect command.
|
||||
*
|
||||
* @async
|
||||
* @returns {Promise<boolean>} Resolves with 'true' if the connection is verified successfully.
|
||||
* @throws {Error} Rejects with an error message if the connection verification fails.
|
||||
**/
|
||||
verify(): Promise<unknown>;
|
||||
/**
|
||||
* Distinguishes the type of Arduino connected.
|
||||
* Sends a command to the device to identify its type and resolves the promise with the received type.
|
||||
*
|
||||
* @async
|
||||
* @returns {Promise<string>} Resolves with the type of the connected Arduino-based device.
|
||||
* @throws {Error} Rejects with an error message if the distinguish operation fails.
|
||||
**/
|
||||
distinguish(): Promise<string>;
|
||||
/**
|
||||
* Closes the connection to an Arduino.
|
||||
*
|
||||
* @async
|
||||
* @returns {Promise<boolean>} Resolves with 'true' if the connection is closed successfully.
|
||||
* @throws {Error} Throws an error if the closeArduino method encounters an error.
|
||||
**/
|
||||
close(): Promise<boolean>;
|
||||
/**
|
||||
* Establishes a fake connection to an Arduino for testing purposes.
|
||||
* Creates a fake SerialPort instance with custom write and string methods.
|
||||
*
|
||||
* @async
|
||||
* @param {string} serial - The device identifier of the fake Arduino.
|
||||
* @returns {Promise<boolean>} Resolves with 'true' if the fake connection is established successfully.
|
||||
**/
|
||||
fakeConnect(device: string): Promise<boolean>;
|
||||
/**
|
||||
* Connect to an Arduino using async/await
|
||||
*
|
||||
* @param {string} device Arduino identifier
|
||||
*
|
||||
* @returns {Promise} Resolves after opening
|
||||
**/
|
||||
private openArduino;
|
||||
/**
|
||||
* Close a connection to an Arduino using async/await
|
||||
*
|
||||
* @param {string} device Arduino identifier
|
||||
*
|
||||
* @returns {Promise} Resolves after closing
|
||||
**/
|
||||
private closeArduino;
|
||||
private lock;
|
||||
private unlock;
|
||||
private isLocked;
|
||||
}
|
|
@ -1,16 +1,25 @@
|
|||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//import Log = require('log');
|
||||
const delay = require("delay");
|
||||
const SerialPort = require('serialport');
|
||||
const Readline = SerialPort.parsers.Readline;
|
||||
const exec = require('child_process').exec;
|
||||
const parser = new Readline('');
|
||||
exports.Arduino = void 0;
|
||||
/**
|
||||
* 2023-07-16 Clarification
|
||||
*
|
||||
* Previous versions of this script intermingled and even
|
||||
* swapped the usage of the terms 'serial' and 'device'.
|
||||
* From here on out, the terms will be used as such:
|
||||
*
|
||||
* serial - a hardware address of a serial port
|
||||
* device - common name of a type of mcopy device (eg. camera,
|
||||
* projector, light) that is aliased to a serial port
|
||||
*
|
||||
**/
|
||||
const delay_1 = require("delay");
|
||||
const log_1 = require("log");
|
||||
const { SerialPort } = require('serialport');
|
||||
const { ReadlineParser } = require('@serialport/parser-readline');
|
||||
const parser = new ReadlineParser({ delimiter: '\r\n' });
|
||||
const newlineRe = new RegExp('\n', 'g');
|
||||
const returnRe = new RegExp('\r', 'g');
|
||||
let eventEmitter;
|
||||
let cfg;
|
||||
let arduino;
|
||||
const KNOWN = [
|
||||
'/dev/tty.usbmodem1a161',
|
||||
'/dev/tty.usbserial-A800f8dk',
|
||||
|
@ -21,118 +30,219 @@ const KNOWN = [
|
|||
'/dev/ttyACM0',
|
||||
'COM3'
|
||||
];
|
||||
/** @module lib/arduino */
|
||||
/**
|
||||
* Class representing the arduino communication features
|
||||
**/
|
||||
* Class representing the arduino communication features.
|
||||
*/
|
||||
class Arduino {
|
||||
constructor() {
|
||||
constructor(cfg, ee, errorState) {
|
||||
this.path = {};
|
||||
this.known = KNOWN;
|
||||
this.alias = {};
|
||||
this.serial = { connect: {}, projector: {}, camera: {}, light: {} };
|
||||
this.serial = {};
|
||||
this.baud = 57600;
|
||||
this.queue = {};
|
||||
this.timer = 0;
|
||||
this.lock = false;
|
||||
this.locks = {};
|
||||
this.alias = {};
|
||||
this.stateStr = {};
|
||||
this.hasState = {};
|
||||
this.cfg = cfg;
|
||||
this.eventEmitter = ee;
|
||||
this.errorState = errorState;
|
||||
this.init();
|
||||
}
|
||||
async init() {
|
||||
this.log = await (0, log_1.Log)({ label: 'arduino' });
|
||||
this.keys = Object.keys(this.cfg.arduino.cmd);
|
||||
this.values = this.keys.map((key) => this.cfg.arduino.cmd[key]);
|
||||
}
|
||||
/**
|
||||
* Enumerate all connected devices that might be Arduinos
|
||||
*
|
||||
* @async
|
||||
* @returns {Promise} Resolves after enumerating
|
||||
**/
|
||||
async enumerate() {
|
||||
let ports;
|
||||
let matches = [];
|
||||
try {
|
||||
ports = await SerialPort.list();
|
||||
}
|
||||
catch (err) {
|
||||
throw err;
|
||||
}
|
||||
this.log.info('Available ports:');
|
||||
this.log.info(ports.map((port) => { return port.path; }).join(','));
|
||||
ports.forEach((port) => {
|
||||
if (this.known.indexOf(port.path) !== -1) {
|
||||
matches.push(port.path);
|
||||
}
|
||||
else if ((port.manufacturer + '').toLowerCase().indexOf('arduino') !== -1) {
|
||||
matches.push(port.path);
|
||||
}
|
||||
else if ((port.path + '').toLowerCase().indexOf('usbserial') !== -1) {
|
||||
matches.push(port.path);
|
||||
}
|
||||
else if ((port.path + '').toLowerCase().indexOf('usbmodem') !== -1) {
|
||||
matches.push(port.path);
|
||||
}
|
||||
else if ((port.path + '').toLowerCase().indexOf('ttyusb') !== -1) {
|
||||
matches.push(port.path);
|
||||
}
|
||||
});
|
||||
if (matches.length === 0) {
|
||||
throw new Error('No USB devices found');
|
||||
}
|
||||
else if (matches.length > 0) {
|
||||
return matches;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Send a command to an Arduino using async/await
|
||||
*
|
||||
* @param {string} device The Arduino device identifier
|
||||
* @param {string} cmd Single character command to send
|
||||
*
|
||||
* @async
|
||||
* @returns {Promise} Resolves after sending
|
||||
**/
|
||||
async sendAsync(device, cmd) {
|
||||
return new Promise((resolve, reject) => {
|
||||
return SerialPort.list((err, ports) => {
|
||||
let matches = [];
|
||||
//this.log.info(`sendAsync ${cmd} -> ${device}`)
|
||||
this.queue[cmd] = (ms) => {
|
||||
return resolve(ms);
|
||||
};
|
||||
//this.log.info(`Device: ${device}`)
|
||||
return this.serial[this.alias[device]].write(cmd, (err, results) => {
|
||||
if (err) {
|
||||
//this.log.error(err)
|
||||
return reject(err);
|
||||
}
|
||||
ports.forEach((port) => {
|
||||
if (this.known.indexOf(port.comName) !== -1) {
|
||||
matches.push(port.comName);
|
||||
}
|
||||
else if ((port.manufacturer + '').toLowerCase().indexOf('arduino') !== -1) {
|
||||
matches.push(port.comName);
|
||||
}
|
||||
else if ((port.comName + '').toLowerCase().indexOf('usbserial') !== -1) {
|
||||
matches.push(port.comName);
|
||||
}
|
||||
else if ((port.comName + '').toLowerCase().indexOf('usbmodem') !== -1) {
|
||||
matches.push(port.comName);
|
||||
}
|
||||
else if ((port.comName + '').toLowerCase().indexOf('ttyusb') !== -1) {
|
||||
matches.push(port.comName);
|
||||
}
|
||||
});
|
||||
if (matches.length === 0) {
|
||||
return reject('No USB devices found');
|
||||
}
|
||||
else if (matches.length > 0) {
|
||||
return resolve(matches);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Send a command to an Arduino using async/await
|
||||
* Sends a command to the specified Arduino and waits for a response.
|
||||
* Handles the communication lock to prevent sending multiple commands simultaneously.
|
||||
* Emits an 'arduino_send' event after successfully sending the command.
|
||||
*
|
||||
* @param {string} device Arduino identifier
|
||||
* @param {string} cmd Single character command to send
|
||||
*
|
||||
* @returns {Promise} Resolves after sending
|
||||
* @async
|
||||
* @param {string} device - The Arduino device identifier.
|
||||
* @param {string} cmd - The command to be sent to the Arduino.
|
||||
* @returns {Promise<boolean|string>} Returns 'false' if the communication is locked, otherwise returns the response from the device.
|
||||
* @throws {Error} Throws an error if the sendAsync method encounters an error.
|
||||
**/
|
||||
async sendAsync(device, cmd) {
|
||||
async send(device, cmd) {
|
||||
const serial = this.alias[device];
|
||||
let ms;
|
||||
this.log.info(`send ${cmd} -> ${device}`);
|
||||
if (this.isLocked(serial)) {
|
||||
this.log.error(`send Serial ${serial} is locked`);
|
||||
return 0;
|
||||
}
|
||||
this.timer = new Date().getTime();
|
||||
this.lock(serial);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
try {
|
||||
ms = await this.sendAsync(device, cmd);
|
||||
}
|
||||
catch (e) {
|
||||
this.log.error(`Failed to send to ${device} @ ${serial}`, e);
|
||||
return 0;
|
||||
}
|
||||
this.unlock(serial);
|
||||
await this.eventEmitter.emit('arduino_send', cmd);
|
||||
return ms;
|
||||
}
|
||||
/**
|
||||
* Sends a string to the specified Arduino.
|
||||
* Handles different types of devices, including fake devices for testing purposes.
|
||||
* Waits for a specified delay before sending the string.
|
||||
*
|
||||
* @async
|
||||
* @param {string} device - The Arduino device identifier.
|
||||
* @param {string} str - The string to be sent to the Arduino.
|
||||
* @returns {Promise<boolean|string>} Returns 'true' if the string is sent successfully, otherwise returns an error message.
|
||||
* @throws {Error} Throws an error if the writeAsync method encounters an error.
|
||||
**/
|
||||
async sendString(device, str) {
|
||||
let ms;
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
if (typeof this.serial[this.alias[device]].fake !== 'undefined'
|
||||
&& this.serial[this.alias[device]].fake) {
|
||||
return this.serial[this.alias[device]].string(str);
|
||||
}
|
||||
else {
|
||||
this.log.info(`sendString ${str} -> ${device}`);
|
||||
try {
|
||||
ms = await this.writeAsync(device, str);
|
||||
}
|
||||
catch (e) {
|
||||
this.log.error(`Error sending string to ${device}`, e);
|
||||
return 0;
|
||||
}
|
||||
this.unlock(this.alias[device]);
|
||||
return ms;
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async stateAsync(device, confirm = false) {
|
||||
const cmd = this.cfg.arduino.cmd.state;
|
||||
const serial = confirm ? this.alias['connect'] : this.alias[device];
|
||||
return new Promise((resolve, reject) => {
|
||||
this.queue[cmd] = (ms) => {
|
||||
return resolve(ms);
|
||||
this.queue[cmd] = (state) => {
|
||||
this.stateStr[device] = state;
|
||||
if (confirm) {
|
||||
this.hasState[device] = true;
|
||||
this.log.info(`Device ${device} supports state [${state}]`);
|
||||
}
|
||||
return resolve(state);
|
||||
};
|
||||
return this.serial[device].write(cmd, (err, results) => {
|
||||
if (confirm) {
|
||||
setTimeout(function () {
|
||||
if (typeof this.queue[cmd] !== 'undefined') {
|
||||
delete this.queue[cmd];
|
||||
this.hasState[device] = false;
|
||||
this.log.info(`Device ${device} does not support state`);
|
||||
return resolve(null);
|
||||
}
|
||||
}.bind(this), 1000);
|
||||
}
|
||||
this.log.info(`stateAsync ${cmd} -> ${device}`);
|
||||
return this.serial[serial].write(cmd, (err, results) => {
|
||||
if (err) {
|
||||
//console.error(err)
|
||||
//this.log.error(err)
|
||||
return reject(err);
|
||||
}
|
||||
//
|
||||
});
|
||||
});
|
||||
}
|
||||
async send(serial, cmd) {
|
||||
const device = this.alias[serial];
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async state(device, confirm = false) {
|
||||
const serial = confirm ? this.alias['connect'] : this.alias[device];
|
||||
let results;
|
||||
if (this.locks[serial]) {
|
||||
return false;
|
||||
if (this.isLocked(serial)) {
|
||||
this.log.warn(`state Serial ${serial} is locked`);
|
||||
return null;
|
||||
}
|
||||
this.timer = new Date().getTime();
|
||||
this.locks[serial] = true;
|
||||
await delay(cfg.arduino.serialDelay);
|
||||
this.lock(serial);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
try {
|
||||
results = await this.sendAsync(device, cmd);
|
||||
results = await this.stateAsync(device, confirm);
|
||||
}
|
||||
catch (e) {
|
||||
return console.error(e);
|
||||
this.log.error(`Error getting state from ${device}`, e);
|
||||
return null;
|
||||
}
|
||||
this.locks[serial] = false;
|
||||
await eventEmitter.emit('arduino_send', cmd);
|
||||
this.unlock(serial);
|
||||
await this.eventEmitter.emit('arduino_state', this.cfg.arduino.cmd.state);
|
||||
return results;
|
||||
}
|
||||
async string(serial, str) {
|
||||
const device = this.alias[serial];
|
||||
let writeSuccess;
|
||||
await delay(cfg.arduino.serialDelay);
|
||||
if (typeof this.serial[device].fake !== 'undefined'
|
||||
&& this.serial[device].fake) {
|
||||
return this.serial[device].string(str);
|
||||
}
|
||||
else {
|
||||
try {
|
||||
writeSuccess = await this.writeAsync(device, str);
|
||||
}
|
||||
catch (e) {
|
||||
return console.error(e);
|
||||
}
|
||||
return writeSuccess;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Send a string to an Arduino using async/await
|
||||
*
|
||||
|
@ -143,7 +253,7 @@ class Arduino {
|
|||
**/
|
||||
async writeAsync(device, str) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.serial[device].write(str, function (err, results) {
|
||||
this.serial[this.alias[device]].write(str, function (err, results) {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
|
@ -151,53 +261,104 @@ class Arduino {
|
|||
});
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Handles the end of communication with the Arduino.
|
||||
* Calculates the time taken for the communication, executes the callback,
|
||||
* and emits an 'arduino_end' event. Handles errors and stray data received.
|
||||
*
|
||||
* @param {string} serial - The serial address of the Arduino device.
|
||||
* @param {string} data - The data received from the Arduino.
|
||||
* @returns {any} The time taken for the communication in milliseconds.
|
||||
**/
|
||||
end(serial, data) {
|
||||
const end = new Date().getTime();
|
||||
const ms = end - this.timer;
|
||||
let complete;
|
||||
//this.log.info(`end ${serial} -> ${data}`)
|
||||
if (this.queue[data] !== undefined) {
|
||||
this.locks[serial] = false;
|
||||
this.unlock(serial);
|
||||
complete = this.queue[data](ms); //execute callback
|
||||
eventEmitter.emit('arduino_end', data);
|
||||
this.eventEmitter.emit('arduino_end', data);
|
||||
delete this.queue[data];
|
||||
}
|
||||
else if (data[0] === this.cfg.arduino.cmd.state) {
|
||||
//this.log.info(`end serial -> ${serial}`)
|
||||
this.unlock(serial);
|
||||
complete = this.queue[this.cfg.arduino.cmd.state](data);
|
||||
this.eventEmitter.emit('arduino_end', data);
|
||||
delete this.queue[this.cfg.arduino.cmd.state];
|
||||
return data;
|
||||
}
|
||||
else if (data[0] === this.cfg.arduino.cmd.error) {
|
||||
this.log.error(`Received error from device ${serial}`);
|
||||
this.unlock(serial);
|
||||
this.error(serial, data);
|
||||
//error state
|
||||
//stop sequence
|
||||
//throw error in ui
|
||||
}
|
||||
else {
|
||||
//console.log('Received stray "' + data + '"'); //silent to user
|
||||
this.log.info('Received stray "' + data + '"'); //silent to user
|
||||
}
|
||||
return ms;
|
||||
}
|
||||
aliasSerial(serial, device) {
|
||||
//this.log.info(`Making "${serial}" an alias of ${device}`);
|
||||
this.alias[serial] = device;
|
||||
error(serial, data) {
|
||||
this.log.error("ERROR", data);
|
||||
}
|
||||
async connect(serial, device, confirm) {
|
||||
/**
|
||||
* Associates an alias with an Arduinos serial address.
|
||||
* Used to map multi-purpose devices onto the same serial connection.
|
||||
*
|
||||
* @param {string} device - The serial number of the target Arduino.
|
||||
* @param {string} serial - The alias to be associated with the target device.
|
||||
**/
|
||||
aliasSerial(device, serial) {
|
||||
//this.log.info(`Making "${serial}" an alias of ${device}`)
|
||||
this.alias[device] = serial;
|
||||
}
|
||||
/**
|
||||
* Connects to an Arduino using its serial number.
|
||||
* Sets up the SerialPort instance and path for the device, and handles data communication.
|
||||
* Handles opening the connection and emitting 'arduino_end' or 'confirmEnd' events upon receiving data.
|
||||
*
|
||||
* @async
|
||||
* @param {string} device - The device identifier (common name).
|
||||
* @param {string} serial - The serial address of the target Arduino (e.g., COM port on Windows).
|
||||
* @param {function} confirm - A callback function to be executed upon receiving confirmation data.
|
||||
* @returns {Promise<string>} Resolves with the device path if the connection is successful.
|
||||
* @throws {Error} Rejects with an error message if the connection fails.
|
||||
**/
|
||||
async connect(device, serial, confirm) {
|
||||
//this.log.info(`connect device ${device}`)
|
||||
//this.log.info(`connect serial ${serial}`)
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let connectSuccess;
|
||||
this.path[serial] = device;
|
||||
this.alias[serial] = device;
|
||||
this.serial[device] = new SerialPort(this.path[serial], {
|
||||
this.path[device] = serial;
|
||||
this.aliasSerial(device, serial);
|
||||
this.serial[serial] = new SerialPort({
|
||||
path: serial,
|
||||
autoOpen: false,
|
||||
baudRate: cfg.arduino.baud,
|
||||
parser: parser
|
||||
baudRate: this.cfg.arduino.baud,
|
||||
parser
|
||||
});
|
||||
this.locks[device] = false;
|
||||
this.unlock(serial);
|
||||
try {
|
||||
connectSuccess = await this.openArduino(device);
|
||||
}
|
||||
catch (e) {
|
||||
console.error('failed to open: ' + e);
|
||||
this.log.error(`Failed to open ${device} @ ${serial}: ` + e);
|
||||
return reject(e);
|
||||
}
|
||||
//console.log(`Opened connection with ${this.path[serial]} as ${serial}`);
|
||||
this.log.info(`Opened connection with ${this.path[device]} as ${device}`);
|
||||
if (!confirm) {
|
||||
this.serial[device].on('data', async (data) => {
|
||||
this.serial[this.alias[device]].on('data', async (data) => {
|
||||
let d = data.toString('utf8');
|
||||
d = d.replace(newlineRe, '').replace(returnRe, '');
|
||||
return this.end(serial, d);
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.serial[device].on('data', async (data) => {
|
||||
this.serial[this.alias[device]].on('data', async (data) => {
|
||||
let d = data.toString('utf8');
|
||||
d = d.replace(newlineRe, '').replace(returnRe, '');
|
||||
return await this.confirmEnd(d);
|
||||
|
@ -206,46 +367,47 @@ class Arduino {
|
|||
return resolve(this.path[serial]);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Handles the confirmation data received from an Arduino.
|
||||
* Executes the confirmation callback function if the received data is present in the list of expected values.
|
||||
*
|
||||
* @param {string} data - The data received from the Arduino.
|
||||
**/
|
||||
confirmEnd(data) {
|
||||
//console.dir(data)
|
||||
if (data === cfg.arduino.cmd.connect
|
||||
|| data === cfg.arduino.cmd.projector_identifier
|
||||
|| data === cfg.arduino.cmd.camera_identifier
|
||||
|| data === cfg.arduino.cmd.light_identifier
|
||||
|| data === cfg.arduino.cmd.projector_light_identifier
|
||||
|| data === cfg.arduino.cmd.projector_camera_light_identifier
|
||||
|| data === cfg.arduino.cmd.projector_camera_identifier
|
||||
|| data === cfg.arduino.cmd.projector_second_identifier
|
||||
|| data === cfg.arduino.cmd.projectors_identifier
|
||||
|| data === cfg.arduino.cmd.projector_second_forward
|
||||
|| data === cfg.arduino.cmd.projector_second_backward
|
||||
|| data === cfg.arduino.cmd.projector_second
|
||||
|| data === cfg.arduino.cmd.projectors
|
||||
|| data === cfg.arduino.cmd.camera_second_identifier
|
||||
|| data === cfg.arduino.cmd.cameras_identifier
|
||||
|| data === cfg.arduino.cmd.camera_second_forward
|
||||
|| data === cfg.arduino.cmd.camera_second_backward
|
||||
|| data === cfg.arduino.cmd.camera_second
|
||||
|| data === cfg.arduino.cmd.cameras) {
|
||||
if (this.values.indexOf(data) !== -1 && typeof this.confirmExec === 'function') {
|
||||
this.confirmExec(null, data);
|
||||
this.confirmExec = {};
|
||||
this.confirmExec = null;
|
||||
this.unlock(this.alias['connect']);
|
||||
}
|
||||
else if (data[0] === this.cfg.arduino.cmd.state) {
|
||||
this.queue[this.cfg.arduino.cmd.state](data);
|
||||
delete this.queue[this.cfg.arduino.cmd.state];
|
||||
this.unlock(this.alias['connect']);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Verifies the connection to an Arduino by sending a connect command.
|
||||
* The confirmation callback checks if the received data matches the expected connect command.
|
||||
*
|
||||
* @async
|
||||
* @returns {Promise<boolean>} Resolves with 'true' if the connection is verified successfully.
|
||||
* @throws {Error} Rejects with an error message if the connection verification fails.
|
||||
**/
|
||||
async verify() {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const device = this.alias['connect'];
|
||||
const device = 'connect';
|
||||
let writeSuccess;
|
||||
this.confirmExec = function (err, data) {
|
||||
if (data === cfg.arduino.cmd.connect) {
|
||||
if (data === this.cfg.arduino.cmd.connect) {
|
||||
return resolve(true);
|
||||
}
|
||||
else {
|
||||
return reject('Wrong data returned');
|
||||
}
|
||||
};
|
||||
await delay(cfg.arduino.serialDelay);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
try {
|
||||
writeSuccess = await this.sendAsync(device, cfg.arduino.cmd.connect);
|
||||
writeSuccess = await this.sendAsync(device, this.cfg.arduino.cmd.connect);
|
||||
}
|
||||
catch (e) {
|
||||
return reject(e);
|
||||
|
@ -253,64 +415,92 @@ class Arduino {
|
|||
return resolve(writeSuccess);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Distinguishes the type of Arduino connected.
|
||||
* Sends a command to the device to identify its type and resolves the promise with the received type.
|
||||
*
|
||||
* @async
|
||||
* @returns {Promise<string>} Resolves with the type of the connected Arduino-based device.
|
||||
* @throws {Error} Rejects with an error message if the distinguish operation fails.
|
||||
**/
|
||||
async distinguish() {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const device = this.alias['connect'];
|
||||
const device = 'connect';
|
||||
let writeSuccess;
|
||||
let type;
|
||||
this.confirmExec = function (err, data) {
|
||||
if (data === cfg.arduino.cmd.projector_identifier) {
|
||||
if (data === this.cfg.arduino.cmd.projector_identifier) {
|
||||
type = 'projector';
|
||||
}
|
||||
else if (data === cfg.arduino.cmd.camera_identifier) {
|
||||
else if (data === this.cfg.arduino.cmd.camera_identifier) {
|
||||
type = 'camera';
|
||||
}
|
||||
else if (data === cfg.arduino.cmd.light_identifier) {
|
||||
else if (data === this.cfg.arduino.cmd.light_identifier) {
|
||||
type = 'light';
|
||||
}
|
||||
else if (data === cfg.arduino.cmd.projector_light_identifier) {
|
||||
else if (data === this.cfg.arduino.cmd.projector_light_identifier) {
|
||||
type = 'projector,light';
|
||||
}
|
||||
else if (data === cfg.arduino.cmd.projector_camera_light_identifier) {
|
||||
else if (data === this.cfg.arduino.cmd.projector_camera_light_identifier) {
|
||||
type = 'projector,camera,light';
|
||||
}
|
||||
else if (data === cfg.arduino.cmd.projector_camera_identifier) {
|
||||
else if (data === this.cfg.arduino.cmd.projector_camera_identifier) {
|
||||
type = 'projector,camera';
|
||||
}
|
||||
else if (data === cfg.arduino.cmd.projector_second_identifier) {
|
||||
else if (data === this.cfg.arduino.cmd.projector_second_identifier) {
|
||||
type = 'projector_second';
|
||||
}
|
||||
else if (data === cfg.arduino.cmd.projectors_identifier) {
|
||||
else if (data === this.cfg.arduino.cmd.projectors_identifier) {
|
||||
type = 'projector,projector_second';
|
||||
}
|
||||
else if (data === cfg.arduino.cmd.camera_second_identifier) {
|
||||
else if (data === this.cfg.arduino.cmd.camera_second_identifier) {
|
||||
type = 'camera_second';
|
||||
}
|
||||
else if (data === cfg.arduino.cmd.cameras_identifier) {
|
||||
else if (data === this.cfg.arduino.cmd.cameras_identifier) {
|
||||
type = 'camera,camera_second';
|
||||
}
|
||||
else if (data === cfg.arduino.cmd.camera_projectors_identifier) {
|
||||
else if (data === this.cfg.arduino.cmd.camera_projectors_identifier) {
|
||||
type = 'camera,projector,projector_second';
|
||||
}
|
||||
else if (data === cfg.arduino.cmd.cameras_projector_identifier) {
|
||||
else if (data === this.cfg.arduino.cmd.cameras_projector_identifier) {
|
||||
type = 'camera,camera_second,projector';
|
||||
}
|
||||
else if (data === cfg.arduino.cmd.cameras_projectors_identifier) {
|
||||
else if (data === this.cfg.arduino.cmd.cameras_projectors_identifier) {
|
||||
type = 'camera,camera_second,projector,projector_second';
|
||||
}
|
||||
else if (data === this.cfg.arduino.cmd.capper_identifier) {
|
||||
type = 'capper';
|
||||
}
|
||||
else if (data === this.cfg.arduino.cmd.camera_capper_identifier) {
|
||||
type = 'camera,capper';
|
||||
}
|
||||
else if (data === this.cfg.arduino.cmd.camera_capper_projector_identifier) {
|
||||
type = 'camera,capper,projector';
|
||||
}
|
||||
else if (data === this.cfg.arduino.cmd.camera_capper_projectors_identifier) {
|
||||
type = 'camera,capper,projector,projector_second';
|
||||
}
|
||||
return resolve(type);
|
||||
};
|
||||
await delay(cfg.arduino.serialDelay);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
try {
|
||||
writeSuccess = await this.sendAsync(device, cfg.arduino.cmd.mcopy_identifier);
|
||||
writeSuccess = await this.sendAsync(device, this.cfg.arduino.cmd.mcopy_identifier);
|
||||
this.log.info(writeSuccess);
|
||||
}
|
||||
catch (e) {
|
||||
return reject(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Closes the connection to an Arduino.
|
||||
*
|
||||
* @async
|
||||
* @returns {Promise<boolean>} Resolves with 'true' if the connection is closed successfully.
|
||||
* @throws {Error} Throws an error if the closeArduino method encounters an error.
|
||||
**/
|
||||
async close() {
|
||||
const device = this.alias['connect'];
|
||||
const device = 'connect';
|
||||
let closeSuccess;
|
||||
try {
|
||||
closeSuccess = await this.closeArduino(device);
|
||||
|
@ -320,31 +510,40 @@ class Arduino {
|
|||
}
|
||||
return closeSuccess;
|
||||
}
|
||||
;
|
||||
async fakeConnect(serial) {
|
||||
const device = '/dev/fake';
|
||||
this.alias[serial] = device;
|
||||
this.serial[device] = {
|
||||
/**
|
||||
* Establishes a fake connection to an Arduino for testing purposes.
|
||||
* Creates a fake SerialPort instance with custom write and string methods.
|
||||
*
|
||||
* @async
|
||||
* @param {string} serial - The device identifier of the fake Arduino.
|
||||
* @returns {Promise<boolean>} Resolves with 'true' if the fake connection is established successfully.
|
||||
**/
|
||||
async fakeConnect(device) {
|
||||
const serial = '/dev/fake';
|
||||
this.aliasSerial(device, serial);
|
||||
this.serial[serial] = {
|
||||
write: async function (cmd, cb) {
|
||||
const t = {
|
||||
c: cfg.arduino.cam.time + cfg.arduino.cam.delay,
|
||||
p: cfg.arduino.proj.time + cfg.arduino.proj.delay
|
||||
c: this.cfg.arduino.cam.time + this.cfg.arduino.cam.delay,
|
||||
p: this.cfg.arduino.proj.time + this.cfg.arduino.proj.delay,
|
||||
A: 180,
|
||||
B: 180
|
||||
};
|
||||
let timeout = t[cmd];
|
||||
if (typeof timeout === 'undefined')
|
||||
timeout = 10;
|
||||
arduino.timer = +new Date();
|
||||
await delay(timeout);
|
||||
arduino.end(serial, cmd);
|
||||
this.timer = +new Date();
|
||||
await (0, delay_1.delay)(timeout);
|
||||
this.end(serial, cmd);
|
||||
return cb();
|
||||
},
|
||||
}.bind(this),
|
||||
string: async function (str) {
|
||||
//do nothing
|
||||
return true;
|
||||
},
|
||||
fake: true
|
||||
};
|
||||
//console.log('Connected to fake arduino! Not real! Does not exist!');
|
||||
//this.log.info('Connected to fake arduino! Not real! Does not exist!')
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
|
@ -356,7 +555,7 @@ class Arduino {
|
|||
**/
|
||||
async openArduino(device) {
|
||||
return new Promise((resolve, reject) => {
|
||||
return this.serial[device].open((err) => {
|
||||
return this.serial[this.alias[device]].open((err) => {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
|
@ -373,7 +572,7 @@ class Arduino {
|
|||
**/
|
||||
async closeArduino(device) {
|
||||
return new Promise((resolve, reject) => {
|
||||
return this.serial[device].close((err) => {
|
||||
return this.serial[this.alias[device]].close((err) => {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
|
@ -381,13 +580,18 @@ class Arduino {
|
|||
});
|
||||
});
|
||||
}
|
||||
lock(serial) {
|
||||
//this.log.info(`Locked serial ${serial}`)
|
||||
this.locks[serial] = true;
|
||||
}
|
||||
unlock(serial) {
|
||||
//this.log.info(`Unlocked serial ${serial}`)
|
||||
this.locks[serial] = false;
|
||||
}
|
||||
isLocked(serial) {
|
||||
return typeof this.locks[serial] !== 'undefined' && this.locks[serial] === true;
|
||||
}
|
||||
}
|
||||
if (typeof module !== 'undefined' && module.parent) {
|
||||
module.exports = function (c, ee) {
|
||||
eventEmitter = ee;
|
||||
cfg = c;
|
||||
arduino = new Arduino();
|
||||
return arduino;
|
||||
};
|
||||
}
|
||||
exports.Arduino = Arduino;
|
||||
module.exports = { Arduino };
|
||||
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,49 +1,76 @@
|
|||
<a name="Camera"></a>
|
||||
<a name="module_lib/cam"></a>
|
||||
|
||||
## Camera
|
||||
class representing camera functions
|
||||
## lib/cam
|
||||
|
||||
**Kind**: global class
|
||||
* [lib/cam](#module_lib/cam)
|
||||
* [~Camera](#module_lib/cam..Camera)
|
||||
* [.init()](#module_lib/cam..Camera+init)
|
||||
* [.listen()](#module_lib/cam..Camera+listen)
|
||||
* [.set()](#module_lib/cam..Camera+set)
|
||||
* [.cap()](#module_lib/cam..Camera+cap)
|
||||
* [.move()](#module_lib/cam..Camera+move)
|
||||
* [.exposure()](#module_lib/cam..Camera+exposure)
|
||||
* [.connectIntval()](#module_lib/cam..Camera+connectIntval)
|
||||
* [.connectProcessing()](#module_lib/cam..Camera+connectProcessing)
|
||||
* [.listener()](#module_lib/cam..Camera+listener)
|
||||
* [.end()](#module_lib/cam..Camera+end)
|
||||
|
||||
* [Camera](#Camera)
|
||||
* [.init()](#Camera+init)
|
||||
* [.listen()](#Camera+listen)
|
||||
* [.set()](#Camera+set)
|
||||
* [.move()](#Camera+move)
|
||||
* [.exposure()](#Camera+exposure)
|
||||
* [.connectIntval()](#Camera+connectIntval)
|
||||
* [.listener()](#Camera+listener)
|
||||
* [.end()](#Camera+end)
|
||||
<a name="module_lib/cam..Camera"></a>
|
||||
|
||||
<a name="Camera+init"></a>
|
||||
### lib/cam~Camera
|
||||
Class representing camera functions.
|
||||
|
||||
### camera.init()
|
||||
**Kind**: instance method of [<code>Camera</code>](#Camera)
|
||||
<a name="Camera+listen"></a>
|
||||
**Kind**: inner class of [<code>lib/cam</code>](#module_lib/cam)
|
||||
|
||||
### camera.listen()
|
||||
**Kind**: instance method of [<code>Camera</code>](#Camera)
|
||||
<a name="Camera+set"></a>
|
||||
* [~Camera](#module_lib/cam..Camera)
|
||||
* [.init()](#module_lib/cam..Camera+init)
|
||||
* [.listen()](#module_lib/cam..Camera+listen)
|
||||
* [.set()](#module_lib/cam..Camera+set)
|
||||
* [.cap()](#module_lib/cam..Camera+cap)
|
||||
* [.move()](#module_lib/cam..Camera+move)
|
||||
* [.exposure()](#module_lib/cam..Camera+exposure)
|
||||
* [.connectIntval()](#module_lib/cam..Camera+connectIntval)
|
||||
* [.connectProcessing()](#module_lib/cam..Camera+connectProcessing)
|
||||
* [.listener()](#module_lib/cam..Camera+listener)
|
||||
* [.end()](#module_lib/cam..Camera+end)
|
||||
|
||||
### camera.set()
|
||||
**Kind**: instance method of [<code>Camera</code>](#Camera)
|
||||
<a name="Camera+move"></a>
|
||||
<a name="module_lib/cam..Camera+init"></a>
|
||||
|
||||
### camera.move()
|
||||
**Kind**: instance method of [<code>Camera</code>](#Camera)
|
||||
<a name="Camera+exposure"></a>
|
||||
#### camera.init()
|
||||
**Kind**: instance method of [<code>Camera</code>](#module_lib/cam..Camera)
|
||||
<a name="module_lib/cam..Camera+listen"></a>
|
||||
|
||||
### camera.exposure()
|
||||
**Kind**: instance method of [<code>Camera</code>](#Camera)
|
||||
<a name="Camera+connectIntval"></a>
|
||||
#### camera.listen()
|
||||
**Kind**: instance method of [<code>Camera</code>](#module_lib/cam..Camera)
|
||||
<a name="module_lib/cam..Camera+set"></a>
|
||||
|
||||
### camera.connectIntval()
|
||||
**Kind**: instance method of [<code>Camera</code>](#Camera)
|
||||
<a name="Camera+listener"></a>
|
||||
#### camera.set()
|
||||
**Kind**: instance method of [<code>Camera</code>](#module_lib/cam..Camera)
|
||||
<a name="module_lib/cam..Camera+cap"></a>
|
||||
|
||||
### camera.listener()
|
||||
**Kind**: instance method of [<code>Camera</code>](#Camera)
|
||||
<a name="Camera+end"></a>
|
||||
#### camera.cap()
|
||||
**Kind**: instance method of [<code>Camera</code>](#module_lib/cam..Camera)
|
||||
<a name="module_lib/cam..Camera+move"></a>
|
||||
|
||||
### camera.end()
|
||||
**Kind**: instance method of [<code>Camera</code>](#Camera)
|
||||
#### camera.move()
|
||||
**Kind**: instance method of [<code>Camera</code>](#module_lib/cam..Camera)
|
||||
<a name="module_lib/cam..Camera+exposure"></a>
|
||||
|
||||
#### camera.exposure()
|
||||
**Kind**: instance method of [<code>Camera</code>](#module_lib/cam..Camera)
|
||||
<a name="module_lib/cam..Camera+connectIntval"></a>
|
||||
|
||||
#### camera.connectIntval()
|
||||
**Kind**: instance method of [<code>Camera</code>](#module_lib/cam..Camera)
|
||||
<a name="module_lib/cam..Camera+connectProcessing"></a>
|
||||
|
||||
#### camera.connectProcessing()
|
||||
**Kind**: instance method of [<code>Camera</code>](#module_lib/cam..Camera)
|
||||
<a name="module_lib/cam..Camera+listener"></a>
|
||||
|
||||
#### camera.listener()
|
||||
**Kind**: instance method of [<code>Camera</code>](#module_lib/cam..Camera)
|
||||
<a name="module_lib/cam..Camera+end"></a>
|
||||
|
||||
#### camera.end()
|
||||
**Kind**: instance method of [<code>Camera</code>](#module_lib/cam..Camera)
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
import type { Arduino } from 'arduino';
|
||||
import type { FilmOut } from 'filmout';
|
||||
import type { Config } from 'cfg';
|
||||
import type { WebContents } from 'electron';
|
||||
interface CameraState {
|
||||
pos: number;
|
||||
dir: boolean;
|
||||
capper: boolean;
|
||||
}
|
||||
/** @module lib/cam */
|
||||
/**
|
||||
* Class representing camera functions.
|
||||
*/
|
||||
export declare class Camera {
|
||||
state: CameraState;
|
||||
arduino: Arduino;
|
||||
private intval;
|
||||
private processing;
|
||||
private log;
|
||||
private cfg;
|
||||
private filmout;
|
||||
private ui;
|
||||
private ipc;
|
||||
private id;
|
||||
/**
|
||||
*
|
||||
**/
|
||||
constructor(arduino: Arduino, cfg: Config, ui: WebContents, filmout: FilmOut, second?: boolean);
|
||||
/**
|
||||
*
|
||||
**/
|
||||
private init;
|
||||
/**
|
||||
*
|
||||
**/
|
||||
private listen;
|
||||
/**
|
||||
*
|
||||
**/
|
||||
set(dir: boolean, id: string): Promise<number>;
|
||||
/**
|
||||
*
|
||||
**/
|
||||
cap(state: boolean, id: string): Promise<number>;
|
||||
/**
|
||||
*
|
||||
**/
|
||||
move(id: string): Promise<number>;
|
||||
both(id: string): Promise<number>;
|
||||
/**
|
||||
*
|
||||
**/
|
||||
exposure(exposure: number, id: string): Promise<number>;
|
||||
/**
|
||||
*
|
||||
**/
|
||||
private connectIntval;
|
||||
/**
|
||||
*
|
||||
**/
|
||||
private connectProcessing;
|
||||
/**
|
||||
*
|
||||
**/
|
||||
private listener;
|
||||
/**
|
||||
*
|
||||
**/
|
||||
private end;
|
||||
}
|
||||
export {};
|
|
@ -1,25 +1,34 @@
|
|||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const Intval = require("intval");
|
||||
const Log = require("log");
|
||||
/** class representing camera functions **/
|
||||
exports.Camera = void 0;
|
||||
const electron_1 = require("electron");
|
||||
const intval_1 = require("intval");
|
||||
const processing_1 = require("processing");
|
||||
const delay_1 = require("delay");
|
||||
const log_1 = require("log");
|
||||
/** @module lib/cam */
|
||||
/**
|
||||
* Class representing camera functions.
|
||||
*/
|
||||
class Camera {
|
||||
/**
|
||||
*
|
||||
**/
|
||||
constructor(arduino, cfg, ui, dig, second = false) {
|
||||
constructor(arduino, cfg, ui, filmout, second = false) {
|
||||
this.state = {
|
||||
pos: 0,
|
||||
dir: true,
|
||||
digital: false
|
||||
capper: false
|
||||
};
|
||||
this.arduino = null;
|
||||
this.intval = null;
|
||||
this.processing = null;
|
||||
this.ipc = electron_1.ipcMain;
|
||||
this.id = 'camera';
|
||||
this.arduino = arduino;
|
||||
this.cfg = cfg;
|
||||
this.ui = ui;
|
||||
this.dig = dig;
|
||||
this.filmout = filmout;
|
||||
if (second)
|
||||
this.id += '_second';
|
||||
this.init();
|
||||
|
@ -28,8 +37,7 @@ class Camera {
|
|||
*
|
||||
**/
|
||||
async init() {
|
||||
this.log = await Log({ label: this.id });
|
||||
this.ipc = require('electron').ipcMain;
|
||||
this.log = await (0, log_1.Log)({ label: this.id });
|
||||
this.listen();
|
||||
}
|
||||
/**
|
||||
|
@ -38,6 +46,7 @@ class Camera {
|
|||
listen() {
|
||||
this.ipc.on(this.id, this.listener.bind(this));
|
||||
this.ipc.on('intval', this.connectIntval.bind(this));
|
||||
this.ipc.on('processing', this.connectProcessing.bind(this));
|
||||
}
|
||||
/**
|
||||
*
|
||||
|
@ -52,7 +61,15 @@ class Camera {
|
|||
cmd = this.cfg.arduino.cmd[`${this.id}_backward`];
|
||||
}
|
||||
this.state.dir = dir;
|
||||
if (this.intval) {
|
||||
if (this.processing) {
|
||||
try {
|
||||
ms = await this.processing.setDir(dir);
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(err);
|
||||
}
|
||||
}
|
||||
else if (this.intval) {
|
||||
try {
|
||||
ms = await this.intval.setDir(dir);
|
||||
}
|
||||
|
@ -73,18 +90,47 @@ class Camera {
|
|||
/**
|
||||
*
|
||||
**/
|
||||
async move(frame, id) {
|
||||
async cap(state, id) {
|
||||
let cmd;
|
||||
let ms;
|
||||
if (state) {
|
||||
cmd = this.cfg.arduino.cmd[`${this.id}_forward`];
|
||||
}
|
||||
else {
|
||||
cmd = this.cfg.arduino.cmd[`${this.id}_backward`];
|
||||
}
|
||||
this.state.capper = state;
|
||||
try {
|
||||
ms = await this.arduino.send(this.id, cmd);
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(err);
|
||||
}
|
||||
return await this.end(cmd, id, ms);
|
||||
}
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async move(id) {
|
||||
const cmd = this.cfg.arduino.cmd[this.id];
|
||||
let ms;
|
||||
if (this.dig.state.enabled) {
|
||||
await this.dig.start();
|
||||
if (this.filmout.state.enabled) {
|
||||
await this.filmout.start();
|
||||
}
|
||||
if (this.intval) {
|
||||
if (this.processing) {
|
||||
try {
|
||||
ms = await this.processing.move();
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(err);
|
||||
}
|
||||
}
|
||||
else if (this.intval) {
|
||||
try {
|
||||
ms = await this.intval.move();
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(err);
|
||||
this.log.error(`Error moving intval ${this.id}: ${id}`, err);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -95,21 +141,21 @@ class Camera {
|
|||
this.log.error(err);
|
||||
}
|
||||
}
|
||||
if (this.dig.state.enabled) {
|
||||
if (this.filmout.state.enabled) {
|
||||
//await delay(100 * 1000);
|
||||
await this.dig.end();
|
||||
await this.filmout.end();
|
||||
}
|
||||
//this.log.info('Camera move time', { ms });
|
||||
return this.end(cmd, id, ms);
|
||||
}
|
||||
async both(frame, id) {
|
||||
async both(id) {
|
||||
const cmd = this.cfg.arduino.cmd[id];
|
||||
let ms;
|
||||
try {
|
||||
ms = await this.arduino.send(this.id, cmd);
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(`Error moving ${this.id}`, err);
|
||||
this.log.error(`Error moving both ${this.id}: ${id}`, err);
|
||||
}
|
||||
//this.log.info('Cameras move time', { ms });
|
||||
return await this.end(cmd, id, ms);
|
||||
|
@ -117,11 +163,55 @@ class Camera {
|
|||
/**
|
||||
*
|
||||
**/
|
||||
exposure(exposure, id) {
|
||||
let cmd = 'E';
|
||||
this.intval.setExposure(this.id, exposure, (ms) => {
|
||||
this.end(cmd, id, ms);
|
||||
});
|
||||
async exposure(exposure, id) {
|
||||
const cmd = this.cfg.arduino.cmd.camera_exposure;
|
||||
const str = `${exposure}`;
|
||||
const started = +new Date();
|
||||
let ms;
|
||||
let confirmState;
|
||||
let parts;
|
||||
let confirmExposure;
|
||||
if (this.intval) {
|
||||
return this.intval.setExposure(exposure, (ms) => {
|
||||
this.ui.send('timing', { c: 'c', ms: exposure });
|
||||
return this.end(cmd, id, ms);
|
||||
});
|
||||
}
|
||||
else if (this.arduino.hasState[this.id]) {
|
||||
try {
|
||||
ms = this.arduino.send(this.id, cmd);
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error('Error sending camera exposure command', err);
|
||||
}
|
||||
await (0, delay_1.delay)(1);
|
||||
try {
|
||||
ms = await this.arduino.sendString(this.id, str);
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error('Error sending camera exposure string', err);
|
||||
}
|
||||
await ms;
|
||||
await (0, delay_1.delay)(1);
|
||||
try {
|
||||
confirmState = await this.arduino.state(this.id, false);
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(`Error confirming set state`, err);
|
||||
}
|
||||
parts = this.arduino.stateStr[this.id].split('G');
|
||||
if (parts.length > 1) {
|
||||
parts = parts[1].split('H');
|
||||
confirmExposure = parseInt(parts[0]);
|
||||
if (!isNaN(confirmExposure)) {
|
||||
this.log.info(`Exposure successfully set to ${confirmExposure}ms`);
|
||||
this.ui.send('timing', { c: 'c', ms: exposure });
|
||||
}
|
||||
}
|
||||
ms = (+new Date()) - started;
|
||||
return await this.end(cmd, id, ms);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
*
|
||||
|
@ -129,7 +219,8 @@ class Camera {
|
|||
async connectIntval(event, arg) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (arg.connect) {
|
||||
this.intval = new Intval(arg.url);
|
||||
this.intval = new intval_1.Intval(arg.url);
|
||||
this.processing = null;
|
||||
this.intval.connect((err, ms, state) => {
|
||||
if (err) {
|
||||
this.ui.send('intval', { connected: false });
|
||||
|
@ -149,6 +240,17 @@ class Camera {
|
|||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async connectProcessing(event, arg) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.processing = new processing_1.Processing(arg.url);
|
||||
this.intval = null;
|
||||
this.ui.send('processing', { connected: true, url: arg.url });
|
||||
return resolve(true);
|
||||
});
|
||||
}
|
||||
/**
|
||||
*
|
||||
**/
|
||||
|
@ -161,9 +263,9 @@ class Camera {
|
|||
this.log.error(err);
|
||||
}
|
||||
}
|
||||
else if (typeof arg.frame !== 'undefined') {
|
||||
else if (typeof arg.move !== 'undefined') {
|
||||
try {
|
||||
await this.move(arg.frame, arg.id);
|
||||
await this.move(arg.id);
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(err);
|
||||
|
@ -172,6 +274,22 @@ class Camera {
|
|||
else if (typeof arg.val !== 'undefined') {
|
||||
this.state.pos = arg.val;
|
||||
}
|
||||
else if (typeof arg.capper !== 'undefined') {
|
||||
try {
|
||||
await this.cap(arg.capper, arg.id);
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(err);
|
||||
}
|
||||
}
|
||||
else if (typeof arg.exposure !== 'undefined') {
|
||||
try {
|
||||
await this.exposure(arg.exposure, arg.id);
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(err);
|
||||
}
|
||||
}
|
||||
event.returnValue = true;
|
||||
}
|
||||
/**
|
||||
|
@ -214,12 +332,15 @@ class Camera {
|
|||
else if (cmd === this.cfg.arduino.cmd.camerass) {
|
||||
message += 'Cameras both MOVED 1 frame each';
|
||||
}
|
||||
else if (cmd === this.cfg.arduino.camera_exposure) {
|
||||
message += 'Camera set exposure';
|
||||
}
|
||||
message += ` ${ms}ms`;
|
||||
this.log.info(message);
|
||||
this.ui.send(this.id, { cmd: cmd, id: id, ms: ms });
|
||||
await this.ui.send(this.id, { cmd: cmd, id: id, ms: ms });
|
||||
return ms;
|
||||
}
|
||||
}
|
||||
module.exports = function (arduino, cfg, ui, dig, second) {
|
||||
return new Camera(arduino, cfg, ui, dig, second);
|
||||
};
|
||||
exports.Camera = Camera;
|
||||
module.exports = { Camera };
|
||||
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,46 @@
|
|||
<a name="module_lib/capper"></a>
|
||||
|
||||
## lib/capper
|
||||
|
||||
* [lib/capper](#module_lib/capper)
|
||||
* [~Capper](#module_lib/capper..Capper)
|
||||
* [.init()](#module_lib/capper..Capper+init)
|
||||
* [.listen()](#module_lib/capper..Capper+listen)
|
||||
* [.capper()](#module_lib/capper..Capper+capper)
|
||||
* [.listener()](#module_lib/capper..Capper+listener)
|
||||
* [.end()](#module_lib/capper..Capper+end)
|
||||
|
||||
<a name="module_lib/capper..Capper"></a>
|
||||
|
||||
### lib/capper~Capper
|
||||
Class representing capper functions.
|
||||
|
||||
**Kind**: inner class of [<code>lib/capper</code>](#module_lib/capper)
|
||||
|
||||
* [~Capper](#module_lib/capper..Capper)
|
||||
* [.init()](#module_lib/capper..Capper+init)
|
||||
* [.listen()](#module_lib/capper..Capper+listen)
|
||||
* [.capper()](#module_lib/capper..Capper+capper)
|
||||
* [.listener()](#module_lib/capper..Capper+listener)
|
||||
* [.end()](#module_lib/capper..Capper+end)
|
||||
|
||||
<a name="module_lib/capper..Capper+init"></a>
|
||||
|
||||
#### capper.init()
|
||||
**Kind**: instance method of [<code>Capper</code>](#module_lib/capper..Capper)
|
||||
<a name="module_lib/capper..Capper+listen"></a>
|
||||
|
||||
#### capper.listen()
|
||||
**Kind**: instance method of [<code>Capper</code>](#module_lib/capper..Capper)
|
||||
<a name="module_lib/capper..Capper+capper"></a>
|
||||
|
||||
#### capper.capper()
|
||||
**Kind**: instance method of [<code>Capper</code>](#module_lib/capper..Capper)
|
||||
<a name="module_lib/capper..Capper+listener"></a>
|
||||
|
||||
#### capper.listener()
|
||||
**Kind**: instance method of [<code>Capper</code>](#module_lib/capper..Capper)
|
||||
<a name="module_lib/capper..Capper+end"></a>
|
||||
|
||||
#### capper.end()
|
||||
**Kind**: instance method of [<code>Capper</code>](#module_lib/capper..Capper)
|
|
@ -0,0 +1,45 @@
|
|||
import type { FilmOut } from 'filmout';
|
||||
import type { Arduino } from 'arduino';
|
||||
import type { WebContents } from 'electron';
|
||||
interface CapperState {
|
||||
capper: boolean;
|
||||
}
|
||||
/** @module lib/capper */
|
||||
/**
|
||||
* Class representing capper functions.
|
||||
*/
|
||||
export declare class Capper {
|
||||
private state;
|
||||
private arduino;
|
||||
private log;
|
||||
private cfg;
|
||||
private filmout;
|
||||
private ui;
|
||||
private ipc;
|
||||
private id;
|
||||
/**
|
||||
*
|
||||
**/
|
||||
constructor(arduino: Arduino, cfg: any, ui: WebContents, filmout: FilmOut);
|
||||
/**
|
||||
*
|
||||
**/
|
||||
private init;
|
||||
/**
|
||||
*
|
||||
**/
|
||||
private listen;
|
||||
/**
|
||||
*
|
||||
**/
|
||||
capper(state: boolean, id: string): Promise<number>;
|
||||
/**
|
||||
*
|
||||
**/
|
||||
private listener;
|
||||
/**
|
||||
*
|
||||
**/
|
||||
private end;
|
||||
}
|
||||
export type { CapperState };
|
|
@ -0,0 +1,94 @@
|
|||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Capper = void 0;
|
||||
const electron_1 = require("electron");
|
||||
const log_1 = require("log");
|
||||
/** @module lib/capper */
|
||||
/**
|
||||
* Class representing capper functions.
|
||||
*/
|
||||
class Capper {
|
||||
/**
|
||||
*
|
||||
**/
|
||||
constructor(arduino, cfg, ui, filmout) {
|
||||
this.state = {
|
||||
capper: false
|
||||
};
|
||||
this.arduino = null;
|
||||
this.ipc = electron_1.ipcMain;
|
||||
this.id = 'capper';
|
||||
this.arduino = arduino;
|
||||
this.cfg = cfg;
|
||||
this.ui = ui;
|
||||
this.filmout = filmout;
|
||||
this.init();
|
||||
}
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async init() {
|
||||
this.log = await (0, log_1.Log)({ label: this.id });
|
||||
this.listen();
|
||||
}
|
||||
/**
|
||||
*
|
||||
**/
|
||||
listen() {
|
||||
this.ipc.on(this.id, this.listener.bind(this));
|
||||
}
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async capper(state, id) {
|
||||
let cmd;
|
||||
let ms;
|
||||
if (state) {
|
||||
cmd = this.cfg.arduino.cmd[`${this.id}_on`];
|
||||
}
|
||||
else {
|
||||
cmd = this.cfg.arduino.cmd[`${this.id}_off`];
|
||||
}
|
||||
this.state.capper = state;
|
||||
try {
|
||||
ms = await this.arduino.send(this.id, cmd);
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(err);
|
||||
}
|
||||
return await this.end(cmd, id, ms);
|
||||
}
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async listener(event, arg) {
|
||||
if (typeof arg.state !== 'undefined') {
|
||||
try {
|
||||
await this.capper(arg.state, arg.id);
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(err);
|
||||
}
|
||||
}
|
||||
event.returnValue = true;
|
||||
}
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async end(cmd, id, ms) {
|
||||
let message = '';
|
||||
if (cmd === this.cfg.arduino.cmd.capper_on) {
|
||||
message = 'Capper set to ON';
|
||||
}
|
||||
else if (cmd === this.cfg.arduino.cmd.capper_off) {
|
||||
message = 'Capper set to OFF';
|
||||
}
|
||||
message += ` ${ms}ms`;
|
||||
this.log.info(message);
|
||||
await this.ui.send(this.id, { cmd: cmd, id: id, ms: ms });
|
||||
return ms;
|
||||
}
|
||||
}
|
||||
exports.Capper = Capper;
|
||||
module.exports = { Capper };
|
||||
//# sourceMappingURL=index.js.map
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/capper/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,uCAAmC;AAInC,6BAA0B;AAW1B,yBAAyB;AAEzB;;GAEG;AAEH,MAAa,MAAM;IAWlB;;QAEI;IACJ,YAAa,OAAiB,EAAE,GAAS,EAAE,EAAgB,EAAE,OAAiB;QAbtE,UAAK,GAAiB;YAC7B,MAAM,EAAG,KAAK;SACd,CAAC;QACM,YAAO,GAAa,IAAI,CAAC;QAKzB,QAAG,GAAoB,kBAAO,CAAC;QAC/B,OAAE,GAAY,QAAQ,CAAC;QAK9B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,EAAE,CAAC;IACb,CAAC;IAED;;QAEI;IACI,KAAK,CAAC,IAAI;QACjB,IAAI,CAAC,GAAG,GAAG,MAAM,IAAA,SAAG,EAAC,EAAE,KAAK,EAAG,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QAC1C,IAAI,CAAC,MAAM,EAAE,CAAC;IACf,CAAC;IAED;;QAEI;IACI,MAAM;QACb,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAChD,CAAC;IAED;;QAEI;IACI,KAAK,CAAC,MAAM,CAAE,KAAe,EAAE,EAAW;QACjD,IAAI,GAAY,CAAC;QACjB,IAAI,EAAW,CAAC;QAEhB,IAAI,KAAK,EAAE;YACV,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;SAC5C;aAAM;YACN,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;SAC7C;QAED,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC;QAE1B,IAAI;YACH,EAAE,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;SAC3C;QAAC,OAAO,GAAG,EAAE;YACb,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACpB;QAED,OAAO,MAAM,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IACpC,CAAC;IAED;;QAEI;IACI,KAAK,CAAC,QAAQ,CAAE,KAAoB,EAAE,GAAS;QACtD,IAAI,OAAO,GAAG,CAAC,KAAK,KAAK,WAAW,EAAE;YACrC,IAAI;gBACH,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;aACrC;YAAC,OAAO,GAAG,EAAE;gBACb,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;aACpB;SACD;QACD,KAAK,CAAC,WAAW,GAAG,IAAI,CAAA;IACzB,CAAC;IAED;;QAEI;IACI,KAAK,CAAC,GAAG,CAAE,GAAY,EAAE,EAAW,EAAE,EAAW;QACxD,IAAI,OAAO,GAAY,EAAE,CAAC;QAE1B,IAAI,GAAG,KAAK,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE;YAC3C,OAAO,GAAG,kBAAkB,CAAC;SAC7B;aAAM,IAAI,GAAG,KAAK,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE;YACnD,OAAO,GAAG,mBAAmB,CAAC;SAC9B;QAED,OAAO,IAAI,IAAI,EAAE,IAAI,CAAC;QAEtB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,MAAM,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAC,CAAC,CAAC;QACzD,OAAO,EAAE,CAAC;IACX,CAAC;CACD;AA7FD,wBA6FC;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,MAAM,EAAE,CAAA"}
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "cam",
|
||||
"name": "capper",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
|
@ -8,4 +8,4 @@
|
|||
},
|
||||
"author": "",
|
||||
"license": "ISC"
|
||||
}
|
||||
}
|
|
@ -8,8 +8,8 @@ const parser = new Readline('');
|
|||
const newlineRe = new RegExp('\n', 'g');
|
||||
const returnRe = new RegExp('\r', 'g');
|
||||
|
||||
const exec = require('exec');
|
||||
const delay = require('delay');
|
||||
const { exec } = require('exec');
|
||||
const { delay } = require('delay');
|
||||
|
||||
let system = {};
|
||||
let INTVAL;
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
interface ConfigCommands {
|
||||
[key: string]: string;
|
||||
}
|
||||
interface ConfigDeviceProfile {
|
||||
time: number;
|
||||
delay: number;
|
||||
momentary: number;
|
||||
}
|
||||
interface ConfigBlackProfile {
|
||||
before: number;
|
||||
after: number;
|
||||
}
|
||||
interface ConfigProfile {
|
||||
label: string;
|
||||
cam: ConfigDeviceProfile;
|
||||
proj?: ConfigDeviceProfile;
|
||||
black?: ConfigBlackProfile;
|
||||
light: boolean;
|
||||
}
|
||||
interface ConfigProfiles {
|
||||
[key: string]: ConfigProfile;
|
||||
}
|
||||
interface Config {
|
||||
version: string;
|
||||
ext_port: number;
|
||||
profiles: ConfigProfiles;
|
||||
cmd: ConfigCommands;
|
||||
arduino: any;
|
||||
}
|
||||
export type { Config };
|
|
@ -0,0 +1,3 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=index.js.map
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cfg/index.ts"],"names":[],"mappings":""}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,267 @@
|
|||
<a name="module_lib/cmd"></a>
|
||||
|
||||
## lib/cmd
|
||||
|
||||
* [lib/cmd](#module_lib/cmd)
|
||||
* [~Assign all connected devices and mock devices as private classes.](#module_lib/cmd..Assign all connected devices and mock devices as private classes.)
|
||||
* [new Assign all connected devices and mock devices as private classes.(cfg, proj, cam, light, alert, cam2, proj2, capper)](#new_module_lib/cmd..Assign all connected devices and mock devices as private classes._new)
|
||||
* [~Commands](#module_lib/cmd..Commands)
|
||||
* [.projector_forward()](#module_lib/cmd..Commands+projector_forward) ⇒ <code>integer</code>
|
||||
* [.projector_backward()](#module_lib/cmd..Commands+projector_backward) ⇒ <code>integer</code>
|
||||
* [.camera_forward(cmd)](#module_lib/cmd..Commands+camera_forward) ⇒ <code>integer</code>
|
||||
* [.black_forward()](#module_lib/cmd..Commands+black_forward) ⇒ <code>integer</code>
|
||||
* [.camera_backward(cmd)](#module_lib/cmd..Commands+camera_backward) ⇒ <code>integer</code>
|
||||
* [.black_backward()](#module_lib/cmd..Commands+black_backward) ⇒ <code>integer</code>
|
||||
* [.camera_second_forward(cmd)](#module_lib/cmd..Commands+camera_second_forward) ⇒ <code>integer</code>
|
||||
* [.camera_second_backward(cmd)](#module_lib/cmd..Commands+camera_second_backward) ⇒ <code>integer</code>
|
||||
* [.cameras_forward(cmd)](#module_lib/cmd..Commands+cameras_forward) ⇒ <code>integer</code>
|
||||
* [.cameras_backward(cmd)](#module_lib/cmd..Commands+cameras_backward) ⇒ <code>integer</code>
|
||||
* [.camera_forward_camera_second_backward(cmd)](#module_lib/cmd..Commands+camera_forward_camera_second_backward) ⇒ <code>integer</code>
|
||||
* [.camera_backward_camera_second_forward(cmd)](#module_lib/cmd..Commands+camera_backward_camera_second_forward) ⇒ <code>integer</code>
|
||||
* [.projector_second_forward()](#module_lib/cmd..Commands+projector_second_forward) ⇒ <code>integer</code>
|
||||
* [.projector_second_backward()](#module_lib/cmd..Commands+projector_second_backward) ⇒ <code>integer</code>
|
||||
* [.projectors_forward()](#module_lib/cmd..Commands+projectors_forward) ⇒ <code>integer</code>
|
||||
* [.projectors_backward()](#module_lib/cmd..Commands+projectors_backward) ⇒ <code>integer</code>
|
||||
* [.projector_forward_projector_second_backward()](#module_lib/cmd..Commands+projector_forward_projector_second_backward) ⇒ <code>integer</code>
|
||||
* [.projector_backward_projector_second_forward()](#module_lib/cmd..Commands+projector_backward_projector_second_forward) ⇒ <code>integer</code>
|
||||
* [.alert()](#module_lib/cmd..Commands+alert) ⇒ <code>integer</code>
|
||||
* [.pause()](#module_lib/cmd..Commands+pause) ⇒ <code>integer</code>
|
||||
* [.camera_exposure()](#module_lib/cmd..Commands+camera_exposure)
|
||||
|
||||
<a name="module_lib/cmd..Assign all connected devices and mock devices as private classes."></a>
|
||||
|
||||
### lib/cmd~Assign all connected devices and mock devices as private classes.
|
||||
**Kind**: inner class of [<code>lib/cmd</code>](#module_lib/cmd)
|
||||
<a name="new_module_lib/cmd..Assign all connected devices and mock devices as private classes._new"></a>
|
||||
|
||||
#### new Assign all connected devices and mock devices as private classes.(cfg, proj, cam, light, alert, cam2, proj2, capper)
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| cfg | <code>object</code> | Configuration object |
|
||||
| proj | <code>object</code> | Projector 1 |
|
||||
| cam | <code>object</code> | Camera 1 |
|
||||
| light | <code>object</code> | Light source |
|
||||
| alert | <code>object</code> | Alert object |
|
||||
| cam2 | <code>object</code> | (optional) Camera 2 |
|
||||
| proj2 | <code>object</code> | (optional) Projector 2 |
|
||||
| capper | <code>object</code> | Capper object |
|
||||
|
||||
<a name="module_lib/cmd..Commands"></a>
|
||||
|
||||
### lib/cmd~Commands
|
||||
Class representing all commands bundled into methods.
|
||||
|
||||
**Kind**: inner class of [<code>lib/cmd</code>](#module_lib/cmd)
|
||||
|
||||
* [~Commands](#module_lib/cmd..Commands)
|
||||
* [.projector_forward()](#module_lib/cmd..Commands+projector_forward) ⇒ <code>integer</code>
|
||||
* [.projector_backward()](#module_lib/cmd..Commands+projector_backward) ⇒ <code>integer</code>
|
||||
* [.camera_forward(cmd)](#module_lib/cmd..Commands+camera_forward) ⇒ <code>integer</code>
|
||||
* [.black_forward()](#module_lib/cmd..Commands+black_forward) ⇒ <code>integer</code>
|
||||
* [.camera_backward(cmd)](#module_lib/cmd..Commands+camera_backward) ⇒ <code>integer</code>
|
||||
* [.black_backward()](#module_lib/cmd..Commands+black_backward) ⇒ <code>integer</code>
|
||||
* [.camera_second_forward(cmd)](#module_lib/cmd..Commands+camera_second_forward) ⇒ <code>integer</code>
|
||||
* [.camera_second_backward(cmd)](#module_lib/cmd..Commands+camera_second_backward) ⇒ <code>integer</code>
|
||||
* [.cameras_forward(cmd)](#module_lib/cmd..Commands+cameras_forward) ⇒ <code>integer</code>
|
||||
* [.cameras_backward(cmd)](#module_lib/cmd..Commands+cameras_backward) ⇒ <code>integer</code>
|
||||
* [.camera_forward_camera_second_backward(cmd)](#module_lib/cmd..Commands+camera_forward_camera_second_backward) ⇒ <code>integer</code>
|
||||
* [.camera_backward_camera_second_forward(cmd)](#module_lib/cmd..Commands+camera_backward_camera_second_forward) ⇒ <code>integer</code>
|
||||
* [.projector_second_forward()](#module_lib/cmd..Commands+projector_second_forward) ⇒ <code>integer</code>
|
||||
* [.projector_second_backward()](#module_lib/cmd..Commands+projector_second_backward) ⇒ <code>integer</code>
|
||||
* [.projectors_forward()](#module_lib/cmd..Commands+projectors_forward) ⇒ <code>integer</code>
|
||||
* [.projectors_backward()](#module_lib/cmd..Commands+projectors_backward) ⇒ <code>integer</code>
|
||||
* [.projector_forward_projector_second_backward()](#module_lib/cmd..Commands+projector_forward_projector_second_backward) ⇒ <code>integer</code>
|
||||
* [.projector_backward_projector_second_forward()](#module_lib/cmd..Commands+projector_backward_projector_second_forward) ⇒ <code>integer</code>
|
||||
* [.alert()](#module_lib/cmd..Commands+alert) ⇒ <code>integer</code>
|
||||
* [.pause()](#module_lib/cmd..Commands+pause) ⇒ <code>integer</code>
|
||||
* [.camera_exposure()](#module_lib/cmd..Commands+camera_exposure)
|
||||
|
||||
<a name="module_lib/cmd..Commands+projector_forward"></a>
|
||||
|
||||
#### commands.projector\_forward() ⇒ <code>integer</code>
|
||||
Move the projector one frame forward
|
||||
|
||||
**Kind**: instance method of [<code>Commands</code>](#module_lib/cmd..Commands)
|
||||
**Returns**: <code>integer</code> - Length of action in ms
|
||||
<a name="module_lib/cmd..Commands+projector_backward"></a>
|
||||
|
||||
#### commands.projector\_backward() ⇒ <code>integer</code>
|
||||
Move the projector one frame backward
|
||||
|
||||
**Kind**: instance method of [<code>Commands</code>](#module_lib/cmd..Commands)
|
||||
**Returns**: <code>integer</code> - Length of action in ms
|
||||
<a name="module_lib/cmd..Commands+camera_forward"></a>
|
||||
|
||||
#### commands.camera\_forward(cmd) ⇒ <code>integer</code>
|
||||
Move the camera one frame forward
|
||||
|
||||
**Kind**: instance method of [<code>Commands</code>](#module_lib/cmd..Commands)
|
||||
**Returns**: <code>integer</code> - Length of action in ms
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| cmd | <code>object</code> | Full cmd object |
|
||||
|
||||
<a name="module_lib/cmd..Commands+black_forward"></a>
|
||||
|
||||
#### commands.black\_forward() ⇒ <code>integer</code>
|
||||
Move the camera one frame forward with light off
|
||||
|
||||
**Kind**: instance method of [<code>Commands</code>](#module_lib/cmd..Commands)
|
||||
**Returns**: <code>integer</code> - Length of action in ms
|
||||
<a name="module_lib/cmd..Commands+camera_backward"></a>
|
||||
|
||||
#### commands.camera\_backward(cmd) ⇒ <code>integer</code>
|
||||
Move the camera one frame backward
|
||||
|
||||
**Kind**: instance method of [<code>Commands</code>](#module_lib/cmd..Commands)
|
||||
**Returns**: <code>integer</code> - Length of action in ms
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| cmd | <code>object</code> | Full cmd object |
|
||||
|
||||
<a name="module_lib/cmd..Commands+black_backward"></a>
|
||||
|
||||
#### commands.black\_backward() ⇒ <code>integer</code>
|
||||
Move the camera one frame forward, light set to black or off
|
||||
|
||||
**Kind**: instance method of [<code>Commands</code>](#module_lib/cmd..Commands)
|
||||
**Returns**: <code>integer</code> - Length of action in ms
|
||||
<a name="module_lib/cmd..Commands+camera_second_forward"></a>
|
||||
|
||||
#### commands.camera\_second\_forward(cmd) ⇒ <code>integer</code>
|
||||
Move the second camera one frame forward
|
||||
|
||||
**Kind**: instance method of [<code>Commands</code>](#module_lib/cmd..Commands)
|
||||
**Returns**: <code>integer</code> - Length of action in ms
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| cmd | <code>object</code> | Full cmd object |
|
||||
|
||||
<a name="module_lib/cmd..Commands+camera_second_backward"></a>
|
||||
|
||||
#### commands.camera\_second\_backward(cmd) ⇒ <code>integer</code>
|
||||
Move the second camera one frame backward
|
||||
|
||||
**Kind**: instance method of [<code>Commands</code>](#module_lib/cmd..Commands)
|
||||
**Returns**: <code>integer</code> - Length of action in ms
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| cmd | <code>object</code> | Full cmd object |
|
||||
|
||||
<a name="module_lib/cmd..Commands+cameras_forward"></a>
|
||||
|
||||
#### commands.cameras\_forward(cmd) ⇒ <code>integer</code>
|
||||
Move the both cameras one frame forward
|
||||
|
||||
**Kind**: instance method of [<code>Commands</code>](#module_lib/cmd..Commands)
|
||||
**Returns**: <code>integer</code> - Length of action in ms
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| cmd | <code>object</code> | Full cmd object |
|
||||
|
||||
<a name="module_lib/cmd..Commands+cameras_backward"></a>
|
||||
|
||||
#### commands.cameras\_backward(cmd) ⇒ <code>integer</code>
|
||||
Move the both cameras one frame backward
|
||||
|
||||
**Kind**: instance method of [<code>Commands</code>](#module_lib/cmd..Commands)
|
||||
**Returns**: <code>integer</code> - Length of action in ms
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| cmd | <code>object</code> | Full cmd object |
|
||||
|
||||
<a name="module_lib/cmd..Commands+camera_forward_camera_second_backward"></a>
|
||||
|
||||
#### commands.camera\_forward\_camera\_second\_backward(cmd) ⇒ <code>integer</code>
|
||||
Move first camera one frame forward and rewind secondary camera one frame backward
|
||||
|
||||
**Kind**: instance method of [<code>Commands</code>](#module_lib/cmd..Commands)
|
||||
**Returns**: <code>integer</code> - Length of action in ms
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| cmd | <code>object</code> | Full cmd object |
|
||||
|
||||
<a name="module_lib/cmd..Commands+camera_backward_camera_second_forward"></a>
|
||||
|
||||
#### commands.camera\_backward\_camera\_second\_forward(cmd) ⇒ <code>integer</code>
|
||||
Rewind first camera one frame backward and move secondary camera one frame forward
|
||||
|
||||
**Kind**: instance method of [<code>Commands</code>](#module_lib/cmd..Commands)
|
||||
**Returns**: <code>integer</code> - Length of action in ms
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| cmd | <code>object</code> | Full cmd object |
|
||||
|
||||
<a name="module_lib/cmd..Commands+projector_second_forward"></a>
|
||||
|
||||
#### commands.projector\_second\_forward() ⇒ <code>integer</code>
|
||||
Move the secondary projector forward one frame
|
||||
|
||||
**Kind**: instance method of [<code>Commands</code>](#module_lib/cmd..Commands)
|
||||
**Returns**: <code>integer</code> - Length of action in ms
|
||||
<a name="module_lib/cmd..Commands+projector_second_backward"></a>
|
||||
|
||||
#### commands.projector\_second\_backward() ⇒ <code>integer</code>
|
||||
Rewind the secondary projector backward one frame
|
||||
|
||||
**Kind**: instance method of [<code>Commands</code>](#module_lib/cmd..Commands)
|
||||
**Returns**: <code>integer</code> - Length of action in ms
|
||||
<a name="module_lib/cmd..Commands+projectors_forward"></a>
|
||||
|
||||
#### commands.projectors\_forward() ⇒ <code>integer</code>
|
||||
Move the both projectors forward one frame
|
||||
|
||||
**Kind**: instance method of [<code>Commands</code>](#module_lib/cmd..Commands)
|
||||
**Returns**: <code>integer</code> - Length of action in ms
|
||||
<a name="module_lib/cmd..Commands+projectors_backward"></a>
|
||||
|
||||
#### commands.projectors\_backward() ⇒ <code>integer</code>
|
||||
Rewind both projectors backwards one frame
|
||||
|
||||
**Kind**: instance method of [<code>Commands</code>](#module_lib/cmd..Commands)
|
||||
**Returns**: <code>integer</code> - Length of action in ms
|
||||
<a name="module_lib/cmd..Commands+projector_forward_projector_second_backward"></a>
|
||||
|
||||
#### commands.projector\_forward\_projector\_second\_backward() ⇒ <code>integer</code>
|
||||
Move the primary projector forward one frame and rewind the secondary projector
|
||||
one frame backwards.
|
||||
|
||||
**Kind**: instance method of [<code>Commands</code>](#module_lib/cmd..Commands)
|
||||
**Returns**: <code>integer</code> - Length of action in ms
|
||||
<a name="module_lib/cmd..Commands+projector_backward_projector_second_forward"></a>
|
||||
|
||||
#### commands.projector\_backward\_projector\_second\_forward() ⇒ <code>integer</code>
|
||||
Rewind the primary projector backwards one frame and move the secondary
|
||||
projector forward one frame.
|
||||
|
||||
**Kind**: instance method of [<code>Commands</code>](#module_lib/cmd..Commands)
|
||||
**Returns**: <code>integer</code> - Length of action in ms
|
||||
<a name="module_lib/cmd..Commands+alert"></a>
|
||||
|
||||
#### commands.alert() ⇒ <code>integer</code>
|
||||
Throws an alert to pause a sequence
|
||||
|
||||
**Kind**: instance method of [<code>Commands</code>](#module_lib/cmd..Commands)
|
||||
**Returns**: <code>integer</code> - Length of action in ms
|
||||
<a name="module_lib/cmd..Commands+pause"></a>
|
||||
|
||||
#### commands.pause() ⇒ <code>integer</code>
|
||||
Pauses a sequence for a length of time
|
||||
|
||||
**Kind**: instance method of [<code>Commands</code>](#module_lib/cmd..Commands)
|
||||
**Returns**: <code>integer</code> - Length of action in ms
|
||||
<a name="module_lib/cmd..Commands+camera_exposure"></a>
|
||||
|
||||
#### commands.camera\_exposure()
|
||||
Sets the camera exposure (if supported).
|
||||
|
||||
**Kind**: instance method of [<code>Commands</code>](#module_lib/cmd..Commands)
|
|
@ -0,0 +1,179 @@
|
|||
import type { Projector } from 'proj';
|
||||
import type { Camera } from 'cam';
|
||||
import type { Light } from 'light';
|
||||
import type { Capper } from 'capper';
|
||||
import type { Alert } from 'alert';
|
||||
import type { Config } from 'cfg';
|
||||
/** @module lib/cmd */
|
||||
/**
|
||||
* Class representing all commands bundled into methods.
|
||||
*/
|
||||
export declare class Commands {
|
||||
proj: Projector;
|
||||
cam: Camera;
|
||||
light: Light;
|
||||
cam2: Camera;
|
||||
proj2: Projector;
|
||||
capper: Capper;
|
||||
alertObj: Alert;
|
||||
private cfg;
|
||||
private ipc;
|
||||
/**
|
||||
* @constructor
|
||||
* Assign all connected devices and mock devices as private classes.
|
||||
*
|
||||
* @param {object} cfg Configuration object
|
||||
* @param {object} proj Projector 1
|
||||
* @param {object} cam Camera 1
|
||||
* @param {object} light Light source
|
||||
* @param {object} alert Alert object
|
||||
* @param {object} cam2 (optional) Camera 2
|
||||
* @param {object} proj2 (optional) Projector 2
|
||||
* @param {object} capper Capper object
|
||||
*
|
||||
**/
|
||||
constructor(cfg: Config, proj: Projector, cam: Camera, light: Light, alert: Alert, cam2?: Camera, proj2?: Projector, capper?: Capper);
|
||||
/**
|
||||
* Move the projector one frame forward
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
projector_forward(): Promise<number>;
|
||||
/**
|
||||
* Move the projector one frame backward
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
projector_backward(): Promise<number>;
|
||||
/**
|
||||
* Move the camera one frame forward
|
||||
*
|
||||
* @param {object} cmd Full cmd object
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
camera_forward(): Promise<number>;
|
||||
/**
|
||||
* Move the camera one frame forward with light off
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
black_forward(): Promise<number>;
|
||||
/**
|
||||
* Move the camera one frame backward
|
||||
*
|
||||
* @param {object} cmd Full cmd object
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
camera_backward(): Promise<number>;
|
||||
/**
|
||||
* Move the camera one frame forward, light set to black or off
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
black_backward(): Promise<number>;
|
||||
/**
|
||||
* Move the second camera one frame forward
|
||||
*
|
||||
* @param {object} cmd Full cmd object
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
camera_second_forward(): Promise<number>;
|
||||
/**
|
||||
* Move the second camera one frame backward
|
||||
*
|
||||
* @param {object} cmd Full cmd object
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
camera_second_backward(): Promise<number>;
|
||||
/**
|
||||
* Move the both cameras one frame forward
|
||||
*
|
||||
* @param {object} cmd Full cmd object
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
cameras_forward(): Promise<number>;
|
||||
/**
|
||||
* Move the both cameras one frame backward
|
||||
*
|
||||
* @param {object} cmd Full cmd object
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
cameras_backward(): Promise<number>;
|
||||
/**
|
||||
* Move first camera one frame forward and rewind secondary camera one frame backward
|
||||
*
|
||||
* @param {object} cmd Full cmd object
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
camera_forward_camera_second_backward(): Promise<number>;
|
||||
/**
|
||||
* Rewind first camera one frame backward and move secondary camera one frame forward
|
||||
*
|
||||
* @param {object} cmd Full cmd object
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
camera_backward_camera_second_forward(): Promise<number>;
|
||||
/**
|
||||
* Move the secondary projector forward one frame
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
projector_second_forward(): Promise<number>;
|
||||
/**
|
||||
* Rewind the secondary projector backward one frame
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
projector_second_backward(): Promise<number>;
|
||||
/**
|
||||
* Move the both projectors forward one frame
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
projectors_forward(): Promise<number>;
|
||||
/**
|
||||
* Rewind both projectors backwards one frame
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
projectors_backward(): Promise<number>;
|
||||
/**
|
||||
* Move the primary projector forward one frame and rewind the secondary projector
|
||||
* one frame backwards.
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
projector_forward_projector_second_backward(): Promise<number>;
|
||||
/**
|
||||
* Rewind the primary projector backwards one frame and move the secondary
|
||||
* projector forward one frame.
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
projector_backward_projector_second_forward(): Promise<number>;
|
||||
/**
|
||||
* Throws an alert to pause a sequence
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
alert(cmd: any): Promise<number>;
|
||||
/**
|
||||
* Pauses a sequence for a length of time
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
pause(cmd: any): Promise<number>;
|
||||
/**
|
||||
* Sets the camera exposure (if supported).
|
||||
*
|
||||
**/
|
||||
camera_exposure(cmd: any): Promise<number>;
|
||||
}
|
|
@ -1,30 +1,57 @@
|
|||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const delay = require("delay");
|
||||
exports.Commands = void 0;
|
||||
const electron_1 = require("electron");
|
||||
const uuid_1 = require("uuid");
|
||||
const delay_1 = require("delay");
|
||||
/** @module lib/cmd */
|
||||
/**
|
||||
* Class representing all commands bundled into methods.
|
||||
*/
|
||||
class Commands {
|
||||
constructor(cfg, proj, cam, light, cam2 = null, proj2 = null) {
|
||||
/**
|
||||
* @constructor
|
||||
* Assign all connected devices and mock devices as private classes.
|
||||
*
|
||||
* @param {object} cfg Configuration object
|
||||
* @param {object} proj Projector 1
|
||||
* @param {object} cam Camera 1
|
||||
* @param {object} light Light source
|
||||
* @param {object} alert Alert object
|
||||
* @param {object} cam2 (optional) Camera 2
|
||||
* @param {object} proj2 (optional) Projector 2
|
||||
* @param {object} capper Capper object
|
||||
*
|
||||
**/
|
||||
constructor(cfg, proj, cam, light, alert, cam2 = null, proj2 = null, capper = null) {
|
||||
this.ipc = electron_1.ipcMain;
|
||||
this.cfg = cfg;
|
||||
this.proj = proj;
|
||||
this.cam = cam;
|
||||
this.light = light;
|
||||
if (cam2)
|
||||
this.alertObj = alert;
|
||||
if (cam2 !== null)
|
||||
this.cam2 = cam2;
|
||||
if (proj2)
|
||||
if (proj2 !== null)
|
||||
this.proj2 = proj2;
|
||||
this.ipc = require('electron').ipcMain;
|
||||
if (capper !== null)
|
||||
this.capper = capper;
|
||||
}
|
||||
/**
|
||||
* Move the projector one frame forward
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
async projector_forward() {
|
||||
const id = (0, uuid_1.v4)();
|
||||
let ms;
|
||||
try {
|
||||
if (!this.proj.state.dir) {
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.proj.set(true);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.proj.set(true, id);
|
||||
}
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
ms = await this.proj.move();
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
ms = await this.proj.move(id);
|
||||
}
|
||||
catch (err) {
|
||||
throw err;
|
||||
|
@ -33,16 +60,19 @@ class Commands {
|
|||
}
|
||||
/**
|
||||
* Move the projector one frame backward
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
async projector_backward() {
|
||||
const id = (0, uuid_1.v4)();
|
||||
let ms;
|
||||
try {
|
||||
if (this.proj.state.dir) {
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.proj.set(false);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.proj.set(false, id);
|
||||
}
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
ms = await this.proj.move();
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
ms = await this.proj.move(id);
|
||||
}
|
||||
catch (err) {
|
||||
throw err;
|
||||
|
@ -52,22 +82,26 @@ class Commands {
|
|||
/**
|
||||
* Move the camera one frame forward
|
||||
*
|
||||
* @param {array} rgb Color to set light for frame
|
||||
* @param {object} cmd Full cmd object
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
async camera_forward(rgb = [255, 255, 255]) {
|
||||
async camera_forward() {
|
||||
const id = (0, uuid_1.v4)();
|
||||
const off = [0, 0, 0];
|
||||
let rgb = [255, 255, 255];
|
||||
let ms;
|
||||
try {
|
||||
if (!this.cam.state.dir) {
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.cam.set(true);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.cam.set(true, id);
|
||||
}
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(rgb);
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
ms = await this.cam.move();
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(off);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(rgb, id);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
ms = await this.cam.move(id);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(off, id);
|
||||
}
|
||||
catch (err) {
|
||||
throw err;
|
||||
|
@ -75,22 +109,32 @@ class Commands {
|
|||
return ms;
|
||||
}
|
||||
/**
|
||||
* Move the camera one frame forwardwith light off
|
||||
* Move the camera one frame forward with light off
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
async black_forward() {
|
||||
const id = (0, uuid_1.v4)();
|
||||
const off = [0, 0, 0];
|
||||
let ms;
|
||||
let ms = 0;
|
||||
try {
|
||||
if (!this.cam.state.dir) {
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.cam.set(true);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.cam.set(true, id);
|
||||
}
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
if (this.capper) {
|
||||
ms += await this.capper.capper(true, id);
|
||||
}
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(off, id); //make sure set to off
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
ms += await this.cam.move(id);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(off, id);
|
||||
if (this.capper) {
|
||||
ms += await this.capper.capper(false, id);
|
||||
}
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(off); //make sure set to off
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
ms = await this.cam.move();
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(off);
|
||||
}
|
||||
catch (err) {
|
||||
throw err;
|
||||
|
@ -100,22 +144,26 @@ class Commands {
|
|||
/**
|
||||
* Move the camera one frame backward
|
||||
*
|
||||
* @param {array} rgb Color to set light for frame
|
||||
* @param {object} cmd Full cmd object
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
async camera_backward(rgb = [255, 255, 255]) {
|
||||
async camera_backward() {
|
||||
const id = (0, uuid_1.v4)();
|
||||
const off = [0, 0, 0];
|
||||
let rgb = [255, 255, 255];
|
||||
let ms;
|
||||
try {
|
||||
if (this.cam.state.dir) {
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.cam.set(false);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.cam.set(false, id);
|
||||
}
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(rgb);
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
ms = await this.cam.move();
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(off);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(rgb, id);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
ms = await this.cam.move(id);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(off, id);
|
||||
}
|
||||
catch (err) {
|
||||
throw err;
|
||||
|
@ -125,21 +173,29 @@ class Commands {
|
|||
/**
|
||||
* Move the camera one frame forward, light set to black or off
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
async black_backward() {
|
||||
const id = (0, uuid_1.v4)();
|
||||
const off = [0, 0, 0];
|
||||
let ms;
|
||||
let ms = 0;
|
||||
try {
|
||||
if (this.cam.state.dir) {
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.cam.set(false);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.cam.set(false, id);
|
||||
}
|
||||
if (this.capper) {
|
||||
ms += await this.capper.capper(true, id);
|
||||
}
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(off, id); //make sure set to off
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
ms += await this.cam.move(id);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(off, id);
|
||||
if (this.capper) {
|
||||
ms += await this.capper.capper(false, id);
|
||||
}
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(off); //make sure set to off
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
ms = await this.cam.move();
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(off);
|
||||
}
|
||||
catch (err) {
|
||||
throw err;
|
||||
|
@ -149,22 +205,26 @@ class Commands {
|
|||
/**
|
||||
* Move the second camera one frame forward
|
||||
*
|
||||
* @param {array} rgb Color to set light for frame
|
||||
* @param {object} cmd Full cmd object
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
async camera_second_forward(rgb = [255, 255, 255]) {
|
||||
async camera_second_forward() {
|
||||
const id = (0, uuid_1.v4)();
|
||||
const off = [0, 0, 0];
|
||||
let rgb = [255, 255, 255];
|
||||
let ms;
|
||||
try {
|
||||
if (!this.cam2.state.dir) {
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.cam2.set(true);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.cam2.set(true, id);
|
||||
}
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(rgb);
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
ms = await this.cam2.move();
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(off);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(rgb, id);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
ms = await this.cam2.move(id);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(off, id);
|
||||
}
|
||||
catch (err) {
|
||||
throw err;
|
||||
|
@ -174,22 +234,26 @@ class Commands {
|
|||
/**
|
||||
* Move the second camera one frame backward
|
||||
*
|
||||
* @param {array} rgb Color to set light for frame
|
||||
* @param {object} cmd Full cmd object
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
async camera_second_backward(rgb = [255, 255, 255]) {
|
||||
async camera_second_backward() {
|
||||
const id = (0, uuid_1.v4)();
|
||||
const off = [0, 0, 0];
|
||||
let rgb = [255, 255, 255];
|
||||
let ms;
|
||||
try {
|
||||
if (this.cam2.state.dir) {
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.cam2.set(false);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.cam2.set(false, id);
|
||||
}
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(rgb);
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
ms = await this.cam2.move();
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(off);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(rgb, id);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
ms = await this.cam2.move(id);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(off, id);
|
||||
}
|
||||
catch (err) {
|
||||
throw err;
|
||||
|
@ -199,35 +263,37 @@ class Commands {
|
|||
/**
|
||||
* Move the both cameras one frame forward
|
||||
*
|
||||
* @param {array} rgb Color to set light for frame
|
||||
* @param {object} cmd Full cmd object
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
async cameras_forward(rgb = [255, 255, 255]) {
|
||||
async cameras_forward() {
|
||||
const id = (0, uuid_1.v4)();
|
||||
const off = [0, 0, 0];
|
||||
let rgb = [255, 255, 255];
|
||||
let both;
|
||||
let ms;
|
||||
try {
|
||||
if (!this.cam.state.dir) {
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.cam.set(true);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.cam.set(true, id);
|
||||
}
|
||||
if (!this.cam2.state.dir) {
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.cam2.set(true);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.cam2.set(true, id);
|
||||
}
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(rgb);
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(rgb, id);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
if (this.cam && this.cam2 && this.cam.arduino.alias.camera === this.cam.arduino.alias.camera_second) {
|
||||
ms = await this.cam.both();
|
||||
ms = await this.cam.both(id);
|
||||
}
|
||||
else {
|
||||
this.cam.move();
|
||||
this.cam2.move();
|
||||
both = [await this.cam.move, await this.cam2.move];
|
||||
both = await Promise.all([this.cam.move(id), this.cam2.move(id)]);
|
||||
ms = Math.max(...both);
|
||||
}
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(off);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(off, id);
|
||||
}
|
||||
catch (err) {
|
||||
throw err;
|
||||
|
@ -237,101 +303,117 @@ class Commands {
|
|||
/**
|
||||
* Move the both cameras one frame backward
|
||||
*
|
||||
* @param {array} rgb Color to set light for frame
|
||||
* @param {object} cmd Full cmd object
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
async cameras_backward(rgb = [255, 255, 255]) {
|
||||
async cameras_backward() {
|
||||
const id = (0, uuid_1.v4)();
|
||||
const off = [0, 0, 0];
|
||||
let rgb = [255, 255, 255];
|
||||
let both;
|
||||
let ms;
|
||||
try {
|
||||
if (this.cam.state.dir) {
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.cam.set(false);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.cam.set(false, id);
|
||||
}
|
||||
if (this.cam2.state.dir) {
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.cam2.set(false);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.cam2.set(false, id);
|
||||
}
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(rgb);
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(rgb, id);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
if (this.cam && this.cam2 && this.cam.arduino.alias.camera === this.cam.arduino.alias.camera_second) {
|
||||
ms = await this.cam.both();
|
||||
ms = await this.cam.both(id);
|
||||
}
|
||||
else {
|
||||
this.cam.move();
|
||||
this.cam2.move();
|
||||
both = [await this.cam.move, await this.cam2.move];
|
||||
both = await Promise.all([this.cam.move(id), this.cam2.move(id)]);
|
||||
ms = Math.max(...both);
|
||||
}
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(off);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(off, id);
|
||||
}
|
||||
catch (err) {
|
||||
throw err;
|
||||
}
|
||||
return ms;
|
||||
}
|
||||
async camera_forward_camera_second_backward(rgb = [255, 255, 255]) {
|
||||
/**
|
||||
* Move first camera one frame forward and rewind secondary camera one frame backward
|
||||
*
|
||||
* @param {object} cmd Full cmd object
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
async camera_forward_camera_second_backward() {
|
||||
const id = (0, uuid_1.v4)();
|
||||
const off = [0, 0, 0];
|
||||
let rgb = [255, 255, 255];
|
||||
let both;
|
||||
let ms;
|
||||
try {
|
||||
if (!this.cam.state.dir) {
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.cam.set(true);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.cam.set(true, id);
|
||||
}
|
||||
if (this.cam2.state.dir) {
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.cam2.set(false);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.cam2.set(false, id);
|
||||
}
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(rgb);
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(rgb, id);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
if (this.cam && this.cam2 && this.cam.arduino.alias.camera === this.cam.arduino.alias.camera_second) {
|
||||
ms = await this.cam.both();
|
||||
ms = await this.cam.both(id);
|
||||
}
|
||||
else {
|
||||
this.cam.move();
|
||||
this.cam2.move();
|
||||
both = [await this.cam.move, await this.cam2.move];
|
||||
both = await Promise.all([this.cam.move(id), this.cam2.move(id)]);
|
||||
ms = Math.max(...both);
|
||||
}
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(off);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(off, id);
|
||||
}
|
||||
catch (err) {
|
||||
throw err;
|
||||
}
|
||||
return ms;
|
||||
}
|
||||
async camera_backward_camera_second_forward(rgb = [255, 255, 255]) {
|
||||
/**
|
||||
* Rewind first camera one frame backward and move secondary camera one frame forward
|
||||
*
|
||||
* @param {object} cmd Full cmd object
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
async camera_backward_camera_second_forward() {
|
||||
const id = (0, uuid_1.v4)();
|
||||
const off = [0, 0, 0];
|
||||
let rgb = [255, 255, 255];
|
||||
let both;
|
||||
let ms;
|
||||
try {
|
||||
if (this.cam.state.dir) {
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.cam.set(false);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.cam.set(false, id);
|
||||
}
|
||||
if (!this.cam2.state.dir) {
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.cam2.set(true);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.cam2.set(true, id);
|
||||
}
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(rgb);
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(rgb, id);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
if (this.cam && this.cam2 && this.cam.arduino.alias.camera === this.cam.arduino.alias.camera_second) {
|
||||
ms = await this.cam.both();
|
||||
ms = await this.cam.both(id);
|
||||
}
|
||||
else {
|
||||
this.cam.move();
|
||||
this.cam.move();
|
||||
both = [await this.cam.move, await this.proj2.move];
|
||||
both = await Promise.all([this.cam.move(id), this.cam2.move(id)]);
|
||||
ms = Math.max(...both);
|
||||
}
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(off);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.light.set(off, id);
|
||||
}
|
||||
catch (err) {
|
||||
throw err;
|
||||
|
@ -341,57 +423,69 @@ class Commands {
|
|||
/**
|
||||
* Move the secondary projector forward one frame
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
async projector_second_forward() {
|
||||
const id = (0, uuid_1.v4)();
|
||||
let ms;
|
||||
try {
|
||||
if (!this.proj2.state.dir) {
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.proj2.set(true);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.proj2.set(true, id);
|
||||
}
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
ms = await this.proj2.move();
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
ms = await this.proj2.move(id);
|
||||
}
|
||||
catch (err) {
|
||||
throw err;
|
||||
}
|
||||
return ms;
|
||||
}
|
||||
/**
|
||||
* Rewind the secondary projector backward one frame
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
async projector_second_backward() {
|
||||
const id = (0, uuid_1.v4)();
|
||||
let ms;
|
||||
try {
|
||||
if (this.proj2.state.dir) {
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.proj2.set(false);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.proj2.set(false, id);
|
||||
}
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
ms = await this.proj2.move();
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
ms = await this.proj2.move(id);
|
||||
}
|
||||
catch (err) {
|
||||
throw err;
|
||||
}
|
||||
return ms;
|
||||
}
|
||||
/**
|
||||
* Move the both projectors forward one frame
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
async projectors_forward() {
|
||||
const id = (0, uuid_1.v4)();
|
||||
let both;
|
||||
let ms;
|
||||
try {
|
||||
if (!this.proj.state.dir) {
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.proj.set(true);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.proj.set(true, id);
|
||||
}
|
||||
if (!this.proj2.state.dir) {
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.proj2.set(true);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.proj2.set(true, id);
|
||||
}
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
if (this.proj && this.proj2 && this.proj.arduino.alias.projector === this.proj.arduino.alias.projector_second) {
|
||||
ms = await this.proj.both();
|
||||
ms = await this.proj.both(id);
|
||||
}
|
||||
else {
|
||||
this.proj.move();
|
||||
this.proj2.move();
|
||||
both = [await this.proj.move, await this.proj2.move];
|
||||
both = await Promise.all([this.proj.move(id), this.proj2.move(id)]);
|
||||
ms = Math.max(...both);
|
||||
}
|
||||
}
|
||||
|
@ -400,27 +494,30 @@ class Commands {
|
|||
}
|
||||
return ms;
|
||||
}
|
||||
/**
|
||||
* Rewind both projectors backwards one frame
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
async projectors_backward() {
|
||||
const id = (0, uuid_1.v4)();
|
||||
let both;
|
||||
let ms;
|
||||
try {
|
||||
if (this.proj.state.dir) {
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.proj.set(false);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.proj.set(false, id);
|
||||
}
|
||||
if (this.proj2.state.dir) {
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.proj2.set(false);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.proj2.set(false, id);
|
||||
}
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
//run one projector without await?
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
if (this.proj && this.proj2 && this.proj.arduino.alias.projector === this.proj.arduino.alias.projector_second) {
|
||||
ms = await this.proj.both();
|
||||
ms = await this.proj.both(id);
|
||||
}
|
||||
else {
|
||||
this.proj.move();
|
||||
this.proj2.move();
|
||||
both = [await this.proj.move, await this.proj2.move];
|
||||
both = await Promise.all([this.proj.move(id), this.proj2.move(id)]);
|
||||
ms = Math.max(...both);
|
||||
}
|
||||
}
|
||||
|
@ -429,27 +526,31 @@ class Commands {
|
|||
}
|
||||
return ms;
|
||||
}
|
||||
/**
|
||||
* Move the primary projector forward one frame and rewind the secondary projector
|
||||
* one frame backwards.
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
async projector_forward_projector_second_backward() {
|
||||
const id = (0, uuid_1.v4)();
|
||||
let both;
|
||||
let ms;
|
||||
try {
|
||||
if (!this.proj.state.dir) {
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.proj.set(true);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.proj.set(true, id);
|
||||
}
|
||||
if (this.proj2.state.dir) {
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.proj2.set(false);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.proj2.set(false, id);
|
||||
}
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
//run one projector without await?
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
if (this.proj && this.proj2 && this.proj.arduino.alias.projector === this.proj.arduino.alias.projector_second) {
|
||||
ms = await this.proj.both();
|
||||
ms = await this.proj.both(id);
|
||||
}
|
||||
else {
|
||||
this.proj.move();
|
||||
this.proj2.move();
|
||||
both = [await this.proj.move, await this.proj2.move];
|
||||
both = await Promise.all([this.proj.move(id), this.proj2.move(id)]);
|
||||
ms = Math.max(...both);
|
||||
}
|
||||
}
|
||||
|
@ -458,27 +559,31 @@ class Commands {
|
|||
}
|
||||
return ms;
|
||||
}
|
||||
/**
|
||||
* Rewind the primary projector backwards one frame and move the secondary
|
||||
* projector forward one frame.
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
async projector_backward_projector_second_forward() {
|
||||
const id = (0, uuid_1.v4)();
|
||||
let both;
|
||||
let ms;
|
||||
try {
|
||||
if (this.proj.state.dir) {
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.proj.set(false);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.proj.set(false, id);
|
||||
}
|
||||
if (!this.proj2.state.dir) {
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
await this.proj2.set(true);
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
await this.proj2.set(true, id);
|
||||
}
|
||||
await delay(this.cfg.arduino.serialDelay);
|
||||
//run one projector without await?
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
if (this.proj && this.proj2 && this.proj.arduino.alias.projector === this.proj.arduino.alias.projector_second) {
|
||||
ms = await this.proj.both();
|
||||
ms = await this.proj.both(id);
|
||||
}
|
||||
else {
|
||||
this.proj.move();
|
||||
this.proj2.move();
|
||||
both = [await this.proj.move, await this.proj2.move];
|
||||
both = await Promise.all([this.proj.move(id), this.proj2.move(id)]);
|
||||
ms = Math.max(...both);
|
||||
}
|
||||
}
|
||||
|
@ -487,8 +592,54 @@ class Commands {
|
|||
}
|
||||
return ms;
|
||||
}
|
||||
/**
|
||||
* Throws an alert to pause a sequence
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
async alert(cmd) {
|
||||
const id = (0, uuid_1.v4)();
|
||||
let ms;
|
||||
try {
|
||||
ms = await this.alertObj.start(cmd.light); //change this meta
|
||||
}
|
||||
catch (err) {
|
||||
throw err;
|
||||
}
|
||||
return ms;
|
||||
}
|
||||
/**
|
||||
* Pauses a sequence for a length of time
|
||||
*
|
||||
* @returns {integer} Length of action in ms
|
||||
**/
|
||||
async pause(cmd) {
|
||||
const id = (0, uuid_1.v4)();
|
||||
let ms;
|
||||
try {
|
||||
ms = await (0, delay_1.delay)(cmd.light * 1000); //delay is in seconds
|
||||
}
|
||||
catch (err) {
|
||||
throw err;
|
||||
}
|
||||
return ms;
|
||||
}
|
||||
/**
|
||||
* Sets the camera exposure (if supported).
|
||||
*
|
||||
**/
|
||||
async camera_exposure(cmd) {
|
||||
const id = (0, uuid_1.v4)();
|
||||
let ms;
|
||||
try {
|
||||
ms = await this.cam.exposure(cmd.light, id);
|
||||
}
|
||||
catch (err) {
|
||||
throw err;
|
||||
}
|
||||
return ms;
|
||||
}
|
||||
}
|
||||
module.exports = function (cfg, proj, cam, light, cam2, proj2) {
|
||||
return new Commands(cfg, proj, cam, light, cam2, proj2);
|
||||
};
|
||||
exports.Commands = Commands;
|
||||
module.exports = { Commands };
|
||||
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* Delay in an async/await function
|
||||
*
|
||||
* @param {integer} ms Milliseconds to delay for
|
||||
*
|
||||
* @returns {Promise} Promise to resolve after timeout
|
||||
**/
|
||||
export declare function delay(ms: number): Promise<number>;
|
|
@ -1,4 +1,6 @@
|
|||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.delay = void 0;
|
||||
/**
|
||||
* Delay in an async/await function
|
||||
*
|
||||
|
@ -8,8 +10,9 @@
|
|||
**/
|
||||
function delay(ms) {
|
||||
return new Promise((resolve) => {
|
||||
return setTimeout(resolve, ms);
|
||||
return setTimeout(() => { resolve(ms); }, ms);
|
||||
});
|
||||
}
|
||||
module.exports = delay;
|
||||
exports.delay = delay;
|
||||
module.exports = { delay };
|
||||
//# sourceMappingURL=index.js.map
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/delay/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb;;;;;;IAMI;AAEJ,SAAS,KAAK,CAAE,EAAW;IAC1B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAa,EAAE,EAAE;QACpC,OAAO,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC"}
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/delay/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb;;;;;;IAMI;AAEJ,SAAgB,KAAK,CAAE,EAAW;IACjC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAa,EAAE,EAAE;QACpC,OAAO,UAAU,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACJ,CAAC;AAJD,sBAIC;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,KAAK,EAAE,CAAC"}
|
|
@ -1,74 +1,116 @@
|
|||
<a name="Devices"></a>
|
||||
<a name="module_lib/devices"></a>
|
||||
|
||||
## Devices
|
||||
class representing the device discovery features
|
||||
## lib/devices
|
||||
|
||||
**Kind**: global class
|
||||
* [lib/devices](#module_lib/devices)
|
||||
* [~Devices](#module_lib/devices..Devices)
|
||||
* [new Devices()](#new_module_lib/devices..Devices_new)
|
||||
* [.init()](#module_lib/devices..Devices+init)
|
||||
* [.listen()](#module_lib/devices..Devices+listen)
|
||||
* [.listener()](#module_lib/devices..Devices+listener)
|
||||
* [.enumerate()](#module_lib/devices..Devices+enumerate)
|
||||
* [.favor()](#module_lib/devices..Devices+favor)
|
||||
* [.distinguish()](#module_lib/devices..Devices+distinguish)
|
||||
* [.fakeProjector()](#module_lib/devices..Devices+fakeProjector)
|
||||
* [.fakeCamera()](#module_lib/devices..Devices+fakeCamera)
|
||||
* [.fakeLight()](#module_lib/devices..Devices+fakeLight)
|
||||
* [.fakeCapper()](#module_lib/devices..Devices+fakeCapper)
|
||||
* [.connectDevice()](#module_lib/devices..Devices+connectDevice)
|
||||
* [.all()](#module_lib/devices..Devices+all)
|
||||
* [.remember()](#module_lib/devices..Devices+remember)
|
||||
* [.ready()](#module_lib/devices..Devices+ready)
|
||||
|
||||
* [Devices](#Devices)
|
||||
* [.init()](#Devices+init)
|
||||
* [.listen()](#Devices+listen)
|
||||
* [.listener()](#Devices+listener)
|
||||
* [.enumerate()](#Devices+enumerate)
|
||||
* [.favor()](#Devices+favor)
|
||||
* [.distinguish()](#Devices+distinguish)
|
||||
* [.fakeProjector()](#Devices+fakeProjector)
|
||||
* [.fakeCamera()](#Devices+fakeCamera)
|
||||
* [.fakeLight()](#Devices+fakeLight)
|
||||
* [.connectDevice()](#Devices+connectDevice)
|
||||
* [.all()](#Devices+all)
|
||||
* [.remember()](#Devices+remember)
|
||||
* [.ready()](#Devices+ready)
|
||||
<a name="module_lib/devices..Devices"></a>
|
||||
|
||||
<a name="Devices+init"></a>
|
||||
### lib/devices~Devices
|
||||
Class representing the device discovery features.
|
||||
|
||||
### devices.init()
|
||||
**Kind**: instance method of [<code>Devices</code>](#Devices)
|
||||
<a name="Devices+listen"></a>
|
||||
**Kind**: inner class of [<code>lib/devices</code>](#module_lib/devices)
|
||||
|
||||
### devices.listen()
|
||||
**Kind**: instance method of [<code>Devices</code>](#Devices)
|
||||
<a name="Devices+listener"></a>
|
||||
* [~Devices](#module_lib/devices..Devices)
|
||||
* [new Devices()](#new_module_lib/devices..Devices_new)
|
||||
* [.init()](#module_lib/devices..Devices+init)
|
||||
* [.listen()](#module_lib/devices..Devices+listen)
|
||||
* [.listener()](#module_lib/devices..Devices+listener)
|
||||
* [.enumerate()](#module_lib/devices..Devices+enumerate)
|
||||
* [.favor()](#module_lib/devices..Devices+favor)
|
||||
* [.distinguish()](#module_lib/devices..Devices+distinguish)
|
||||
* [.fakeProjector()](#module_lib/devices..Devices+fakeProjector)
|
||||
* [.fakeCamera()](#module_lib/devices..Devices+fakeCamera)
|
||||
* [.fakeLight()](#module_lib/devices..Devices+fakeLight)
|
||||
* [.fakeCapper()](#module_lib/devices..Devices+fakeCapper)
|
||||
* [.connectDevice()](#module_lib/devices..Devices+connectDevice)
|
||||
* [.all()](#module_lib/devices..Devices+all)
|
||||
* [.remember()](#module_lib/devices..Devices+remember)
|
||||
* [.ready()](#module_lib/devices..Devices+ready)
|
||||
|
||||
### devices.listener()
|
||||
**Kind**: instance method of [<code>Devices</code>](#Devices)
|
||||
<a name="Devices+enumerate"></a>
|
||||
<a name="new_module_lib/devices..Devices_new"></a>
|
||||
|
||||
### devices.enumerate()
|
||||
**Kind**: instance method of [<code>Devices</code>](#Devices)
|
||||
<a name="Devices+favor"></a>
|
||||
#### new Devices()
|
||||
Constructor assigns arduino, settings, UI browser window and cam objects
|
||||
locally to this class for reference.
|
||||
|
||||
### devices.favor()
|
||||
**Kind**: instance method of [<code>Devices</code>](#Devices)
|
||||
<a name="Devices+distinguish"></a>
|
||||
<a name="module_lib/devices..Devices+init"></a>
|
||||
|
||||
### devices.distinguish()
|
||||
**Kind**: instance method of [<code>Devices</code>](#Devices)
|
||||
<a name="Devices+fakeProjector"></a>
|
||||
#### devices.init()
|
||||
Initialize the log for "devices". Establish an ipc connection to the UI.
|
||||
Start listening on that ipc connection.
|
||||
|
||||