fnogatz / dgtchess Goto Github PK
View Code? Open in Web Editor NEWAn event-driven JavaScript connector for electronic DGT chess boards
License: GNU General Public License v3.0
An event-driven JavaScript connector for electronic DGT chess boards
License: GNU General Public License v3.0
serialport@6
does not seem to be working with latest node.js version, so an update is required.
> npm outdated
Package Current Wanted Latest Location
serialport MISSING 6.2.2 8.0.7 dgtchess
chess.js 0.1.0 0.1.0 0.10.3 dgtchess
It crashes quite often for me with "RangeError: offset is out of bounds
here
message.set(value, pos)
This works as a quick fix, can't see what the proper fix is though sorry
const message = new Uint8Array(cmd.length + 100 /* + 100 is quick hack to avoid "RangeError: offset is out of bounds" error */)
I couldn't get this to work in Chrome 114 so I simplified everything until I got it to work for me:
https://github.com/murkle/dgtchess/blob/main/README.md
Working example https://test.geogebra.org/~mike/DGT/example/index.html
I'm trying to get up and running with dgtchess now that I've got it installed. I'm working on testing it with the dgtnix virtual board mentioned in #1. First of all, the example code in the readme has the wrong require.
var DGT = require('..');
may work inside the example folder but it should be:
var DGT = require('dgtchess');
to work outside of it.
After fixing that, dgtchess will then attempt to open the socket I give it:
var board = new DGT.Board('/tmp/dgtnixBoard');
where /tmp/dgtnixBoard is the socket created by the dgtnix python virtual board script (these are the only two lines I've changed in your example).
Here's a snipper of shell transcript that shows the problem:
→ node server.js
events.js:72
throw er; // Unhandled 'error' event
^
Error: Cannot open /tmp/dgtnixBoard
→ ls /tmp | grep dgt
dgtnixBoard
So, dgtchess cannot open the socket even though it is clearly there. If I do something as simple as "cat /tmp/dgtnixBoard" the dgt server reports "Connected".
Hello,
I'm an MIT Media Lab Researcher in the Playful Systems Group. I'm working on integrating some work we've been doing with algorithmic analysis of chess matches into a live setup for an upcoming tournament. To that end I need to be able to take in live data from DGT boards. I'd love to use this library.
However, I don't currently have access to a DGT board to test it out and I was wondering if you have a suggestion for software that emulates a DGT board, including communicating on a serial port for testing with this package (and other DGT client implementations).
Thanks in advance for your time and this software.
I'm seeing what I think is this error: serialport/node-serialport#135 when trying to install node-dgtchess. I'm on OSX running 10.9.4. It seems like that error was fixed in serialport last year. Is node-dgtchess's npm package including an old version somehow?
The full error message:
> [email protected] install /Users/greg/Documents/mit/playful_systems/chess/chesscomputer/dgt- integration/node_modules/dgtchess/node_modules/serialport
> node-gyp rebuild
CXX(target) Release/obj.target/serialport/src/serialport.o
../src/serialport.cpp:51:3: error: no matching function for call to 'uv_queue_work'
uv_queue_work(uv_default_loop(), req, EIO_Open, EIO_AfterOpen);
^~~~~~~~~~~~~
/Users/greg/.node-gyp/0.10.18/deps/uv/include/uv.h:1432:15: note: candidate function not viable: no known conversion from 'void (uv_work_t *)' to
'uv_after_work_cb' (aka 'void (*)(uv_work_t *, int)') for 4th argument
UV_EXTERN int uv_queue_work(uv_loop_t* loop, uv_work_t* req,
^
../src/serialport.cpp:118:5: error: no matching function for call to 'uv_queue_work'
uv_queue_work(uv_default_loop(), &queuedWrite->req, EIO_Write, EIO_AfterWrite);
^~~~~~~~~~~~~
/Users/greg/.node-gyp/0.10.18/deps/uv/include/uv.h:1432:15: note: candidate function not viable: no known conversion from 'void (uv_work_t *)' to
'uv_after_work_cb' (aka 'void (*)(uv_work_t *, int)') for 4th argument
UV_EXTERN int uv_queue_work(uv_loop_t* loop, uv_work_t* req,
^
../src/serialport.cpp:146:5: error: no matching function for call to 'uv_queue_work'
uv_queue_work(uv_default_loop(), &nextQueuedWrite->req, EIO_Write, EIO_AfterWrite);
^~~~~~~~~~~~~
/Users/greg/.node-gyp/0.10.18/deps/uv/include/uv.h:1432:15: note: candidate function not viable: no known conversion from 'void (uv_work_t *)' to
'uv_after_work_cb' (aka 'void (*)(uv_work_t *, int)') for 4th argument
UV_EXTERN int uv_queue_work(uv_loop_t* loop, uv_work_t* req,
^
../src/serialport.cpp:178:3: error: no matching function for call to 'uv_queue_work'
uv_queue_work(uv_default_loop(), req, EIO_Close, EIO_AfterClose);
^~~~~~~~~~~~~
/Users/greg/.node-gyp/0.10.18/deps/uv/include/uv.h:1432:15: note: candidate function not viable: no known conversion from 'void (uv_work_t *)' to
'uv_after_work_cb' (aka 'void (*)(uv_work_t *, int)') for 4th argument
UV_EXTERN int uv_queue_work(uv_loop_t* loop, uv_work_t* req,
^
../src/serialport.cpp:214:3: error: no matching function for call to 'uv_queue_work'
uv_queue_work(uv_default_loop(), req, EIO_List, EIO_AfterList);
^~~~~~~~~~~~~
/Users/greg/.node-gyp/0.10.18/deps/uv/include/uv.h:1432:15: note: candidate function not viable: no known conversion from 'void (uv_work_t *)' to
'uv_after_work_cb' (aka 'void (*)(uv_work_t *, int)') for 4th argument
UV_EXTERN int uv_queue_work(uv_loop_t* loop, uv_work_t* req,
^
../src/serialport.cpp:271:3: error: no matching function for call to 'uv_queue_work'
uv_queue_work(uv_default_loop(), req, EIO_Flush, EIO_AfterFlush);
^~~~~~~~~~~~~
/Users/greg/.node-gyp/0.10.18/deps/uv/include/uv.h:1432:15: note: candidate function not viable: no known conversion from 'void (uv_work_t *)' to
'uv_after_work_cb' (aka 'void (*)(uv_work_t *, int)') for 4th argument
UV_EXTERN int uv_queue_work(uv_loop_t* loop, uv_work_t* req,
^
6 errors generated.
make: *** [Release/obj.target/serialport/src/serialport.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build. js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Darwin 13.3.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/greg/Documents/mit/playful_systems/chess/chesscomputer/dgt- integration/node_modules/dgtchess/node_modules/serialport
gyp ERR! node -v v0.10.18
gyp ERR! node-gyp -v v0.10.9
gyp ERR! not ok
npm ERR! weird error 1
npm ERR! not ok code 0
This works for me:
static FILTERS = [
{ usbVendorId: 0x045b, usbProductId: 0x8111 }
]
(using Node 16)
When using with node an the supplied example
import Board from 'dgtchess'
const board = new Board('/dev/ttyUSB0')
we get the error: SyntaxError: Cannot use import statement outside a module
If we add "type": "module"
to our package.json, we then get the error: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module:
How can we fix this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.