Namespaces
Members
(static) machineReady :Promise
A promise that resolves when the machine is ready, works similarly to
gerbil.onMachineReady
. If the machine is in a ready state and
subsequently becomes unready this value is overwritten with a new promise
that resolves the next time the machine is ready.
Type:
-
Promise
Example
let ready = await gerbil.machineReady
console.log(ready)
> {connected: true, version: '1.1h', ttyPath: '/dev/ttyACM0'}
(static) onEveryLine
Set callback to execute on every line received from the serialport. This is called with the trimmed string (no trailing newline) each time Grbl spits out a new line.
Example
gerbil.onEveryLine = console.log
> ok
> ok
(static) onMachineReady
Set callback to execute when GRBL trasmits it's version string. This happens on initial connection or reset. The callback is passed the status object.
Example
gerbil.onMachineReady = console.log
> {connected: true, version: '1.1h', ttyPath: '/dev/ttyACM0'}
Methods
(static) driverStatus() → {object}
Returns:
- Type:
-
object
immediately returns the inner status object
{
connected: true, //always present, true if serialport link established
ttyPort: '/dev/ttyACM0', //present if link established
version: '1.1h', //GRBL version, present once initial handshake received
}
(static) writeLine(message) → {Promise(string)|Promise(errorObj)}
write a single line to Grbl, this will throw if you try to use it to send
multiple lines, or a line longer than 128 bytes, returns a Promise that
resolves to be either a string containing any output Grbl sent between invocation
and the first ok
(inclusive). Makes sure that whatever you sent is terminated
with a newline.
writeLine('$I').then(console.log)
> [VER:1.1h.20190724:]
[OPT:VC,15,128]
ok
or an error object looking something like this:
{
error: "error:2"
message: "Numeric value format is not valid or missing an expected value."
}
Parameters:
Name | Type | Description |
---|---|---|
message |
string
|
a line to send to Grbl |
Returns:
- Type:
-
Promise(string)
|Promise(errorObj)
Grbl data until ok
(static) writeRaw(data) → {void}
Write raw data to Grbl, can be a buffer or a string and is not validated
in any way. This is for internal use and probably shouldn't be used
externally unless you're just using this and gerbil.onEveryLine
Parameters:
Name | Type | Description |
---|---|---|
data |
string
|
buffer
|
Returns:
- Type:
-
void