@thi.ng/axidraw 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -1
- package/README.md +3 -3
- package/api.d.ts +8 -2
- package/axidraw.d.ts +6 -0
- package/axidraw.js +12 -3
- package/package.json +15 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**:
|
|
3
|
+
- **Last updated**: 2023-02-05T14:42:21Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,23 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
## [0.5.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/axidraw@0.5.0) (2023-02-05)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- add speedUp config, rename speed => speedDown ([197d610](https://github.com/thi-ng/umbrella/commit/197d610))
|
|
17
|
+
|
|
18
|
+
#### 🩹 Bug fixes
|
|
19
|
+
|
|
20
|
+
- add [@thi.ng/date](https://github.com/thi-ng/umbrella/tree/main/packages/date) dependency ([bd35a9e](https://github.com/thi-ng/umbrella/commit/bd35a9e))
|
|
21
|
+
required by axidraw.ts
|
|
22
|
+
|
|
23
|
+
## [0.4.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/axidraw@0.4.0) (2023-01-10)
|
|
24
|
+
|
|
25
|
+
#### 🚀 Features
|
|
26
|
+
|
|
27
|
+
- also send "reset" cmd in .reset() ([30fe365](https://github.com/thi-ng/umbrella/commit/30fe365))
|
|
28
|
+
|
|
12
29
|
## [0.3.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/axidraw@0.3.0) (2022-12-29)
|
|
13
30
|
|
|
14
31
|
#### 🚀 Features
|
package/README.md
CHANGED
|
@@ -164,7 +164,7 @@ For Node.js REPL:
|
|
|
164
164
|
const axidraw = await import("@thi.ng/axidraw");
|
|
165
165
|
```
|
|
166
166
|
|
|
167
|
-
Package sizes (brotli'd, pre-treeshake): ESM: 3.
|
|
167
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 3.97 KB
|
|
168
168
|
|
|
169
169
|
## Dependencies
|
|
170
170
|
|
|
@@ -174,7 +174,7 @@ Package sizes (brotli'd, pre-treeshake): ESM: 3.96 KB
|
|
|
174
174
|
- [@thi.ng/errors](https://github.com/thi-ng/umbrella/tree/develop/packages/errors)
|
|
175
175
|
- [@thi.ng/logger](https://github.com/thi-ng/umbrella/tree/develop/packages/logger)
|
|
176
176
|
- [@thi.ng/vectors](https://github.com/thi-ng/umbrella/tree/develop/packages/vectors)
|
|
177
|
-
- [serialport](
|
|
177
|
+
- [serialport](git://github.com/serialport/node-serialport.git)
|
|
178
178
|
|
|
179
179
|
## API
|
|
180
180
|
|
|
@@ -282,4 +282,4 @@ If this project contributes to an academic publication, please cite it as:
|
|
|
282
282
|
|
|
283
283
|
## License
|
|
284
284
|
|
|
285
|
-
© 2022 Karsten Schmidt // Apache License 2.0
|
|
285
|
+
© 2022 - 2023 Karsten Schmidt // Apache License 2.0
|
package/api.d.ts
CHANGED
|
@@ -72,11 +72,17 @@ export interface AxiDrawOpts {
|
|
|
72
72
|
*/
|
|
73
73
|
stepsPerInch: number;
|
|
74
74
|
/**
|
|
75
|
-
* Steps per second
|
|
75
|
+
* Steps per second for XY movements whilst pen down
|
|
76
76
|
*
|
|
77
77
|
* @defaultValue 4000
|
|
78
78
|
*/
|
|
79
|
-
|
|
79
|
+
speedDown: number;
|
|
80
|
+
/**
|
|
81
|
+
* Steps per second for XY movements whilst pen up
|
|
82
|
+
*
|
|
83
|
+
* @defaultValue 4000
|
|
84
|
+
*/
|
|
85
|
+
speedUp: number;
|
|
80
86
|
/**
|
|
81
87
|
* Up position (%)
|
|
82
88
|
*
|
package/axidraw.d.ts
CHANGED
|
@@ -75,6 +75,12 @@ export declare class AxiDraw implements IReset {
|
|
|
75
75
|
* Sends a "moveto" command (absolute coords). Returns tuple of `[duration,
|
|
76
76
|
* distance]` (distance in original/configured units)
|
|
77
77
|
*
|
|
78
|
+
* @remarks
|
|
79
|
+
* Even though this method accepts absolute coords, all AxiDraw movements
|
|
80
|
+
* are relative. Depending on pen up/down state, movement speed will be
|
|
81
|
+
* either the configured {@link AxiDrawOpts.speedDown} or
|
|
82
|
+
* {@link AxiDrawOpts.speedUp}.
|
|
83
|
+
*
|
|
78
84
|
* @param p
|
|
79
85
|
* @param tempo
|
|
80
86
|
*/
|
package/axidraw.js
CHANGED
|
@@ -15,7 +15,8 @@ export const DEFAULT_OPTS = {
|
|
|
15
15
|
refresh: 1000,
|
|
16
16
|
unitsPerInch: 25.4,
|
|
17
17
|
stepsPerInch: 2032,
|
|
18
|
-
|
|
18
|
+
speedDown: 4000,
|
|
19
|
+
speedUp: 4000,
|
|
19
20
|
up: 60,
|
|
20
21
|
down: 30,
|
|
21
22
|
delayUp: 150,
|
|
@@ -37,6 +38,7 @@ export class AxiDraw {
|
|
|
37
38
|
reset() {
|
|
38
39
|
zero(this.pos);
|
|
39
40
|
zero(this.targetPos);
|
|
41
|
+
this.send("R\r");
|
|
40
42
|
return this;
|
|
41
43
|
}
|
|
42
44
|
/**
|
|
@@ -247,17 +249,24 @@ export class AxiDraw {
|
|
|
247
249
|
* Sends a "moveto" command (absolute coords). Returns tuple of `[duration,
|
|
248
250
|
* distance]` (distance in original/configured units)
|
|
249
251
|
*
|
|
252
|
+
* @remarks
|
|
253
|
+
* Even though this method accepts absolute coords, all AxiDraw movements
|
|
254
|
+
* are relative. Depending on pen up/down state, movement speed will be
|
|
255
|
+
* either the configured {@link AxiDrawOpts.speedDown} or
|
|
256
|
+
* {@link AxiDrawOpts.speedUp}.
|
|
257
|
+
*
|
|
250
258
|
* @param p
|
|
251
259
|
* @param tempo
|
|
252
260
|
*/
|
|
253
261
|
moveTo(p, tempo = 1) {
|
|
254
|
-
const { pos, targetPos, opts } = this;
|
|
262
|
+
const { pos, targetPos, opts, isPenDown } = this;
|
|
255
263
|
// apply scale factor: worldspace units -> motor steps
|
|
256
264
|
mulN2(targetPos, p, opts.stepsPerInch / opts.unitsPerInch);
|
|
257
265
|
const delta = sub2([], targetPos, pos);
|
|
258
266
|
set2(pos, targetPos);
|
|
259
267
|
const maxAxis = Math.max(...abs2([], delta));
|
|
260
|
-
const duration = (1000 * maxAxis) /
|
|
268
|
+
const duration = (1000 * maxAxis) /
|
|
269
|
+
((isPenDown ? opts.speedDown : opts.speedUp) * tempo);
|
|
261
270
|
this.send(`XM,${duration | 0},${delta[0] | 0},${delta[1] | 0}\r`);
|
|
262
271
|
return [duration, (mag(delta) * opts.unitsPerInch) / opts.stepsPerInch];
|
|
263
272
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/axidraw",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Minimal AxiDraw plotter/drawing machine controller for Node.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -34,21 +34,23 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@thi.ng/api": "^8.
|
|
38
|
-
"@thi.ng/checks": "^3.3.
|
|
39
|
-
"@thi.ng/compose": "^2.1.
|
|
40
|
-
"@thi.ng/
|
|
41
|
-
"@thi.ng/
|
|
42
|
-
"@thi.ng/
|
|
37
|
+
"@thi.ng/api": "^8.7.0",
|
|
38
|
+
"@thi.ng/checks": "^3.3.8",
|
|
39
|
+
"@thi.ng/compose": "^2.1.25",
|
|
40
|
+
"@thi.ng/date": "^2.4.2",
|
|
41
|
+
"@thi.ng/errors": "^2.2.9",
|
|
42
|
+
"@thi.ng/logger": "^1.4.8",
|
|
43
|
+
"@thi.ng/transducers": "^8.3.31",
|
|
44
|
+
"@thi.ng/vectors": "^7.6.0",
|
|
43
45
|
"serialport": "^10.5.0"
|
|
44
46
|
},
|
|
45
47
|
"devDependencies": {
|
|
46
|
-
"@microsoft/api-extractor": "^7.
|
|
47
|
-
"@thi.ng/testament": "^0.3.
|
|
48
|
-
"rimraf": "^
|
|
48
|
+
"@microsoft/api-extractor": "^7.34.2",
|
|
49
|
+
"@thi.ng/testament": "^0.3.10",
|
|
50
|
+
"rimraf": "^4.1.2",
|
|
49
51
|
"tools": "^0.0.1",
|
|
50
|
-
"typedoc": "^0.23.
|
|
51
|
-
"typescript": "^4.9.
|
|
52
|
+
"typedoc": "^0.23.24",
|
|
53
|
+
"typescript": "^4.9.5"
|
|
52
54
|
},
|
|
53
55
|
"keywords": [
|
|
54
56
|
"2d",
|
|
@@ -102,5 +104,5 @@
|
|
|
102
104
|
"status": "alpha",
|
|
103
105
|
"year": 2022
|
|
104
106
|
},
|
|
105
|
-
"gitHead": "
|
|
107
|
+
"gitHead": "50ba9c87676fac60c46d2bc0e4d2c7711a374a68\n"
|
|
106
108
|
}
|