@thi.ng/axidraw 0.4.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 +12 -1
- package/api.d.ts +8 -2
- package/axidraw.d.ts +6 -0
- package/axidraw.js +11 -3
- package/package.json +15 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2023-
|
|
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,17 @@ 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
|
+
|
|
12
23
|
## [0.4.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/axidraw@0.4.0) (2023-01-10)
|
|
13
24
|
|
|
14
25
|
#### 🚀 Features
|
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,
|
|
@@ -248,17 +249,24 @@ export class AxiDraw {
|
|
|
248
249
|
* Sends a "moveto" command (absolute coords). Returns tuple of `[duration,
|
|
249
250
|
* distance]` (distance in original/configured units)
|
|
250
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
|
+
*
|
|
251
258
|
* @param p
|
|
252
259
|
* @param tempo
|
|
253
260
|
*/
|
|
254
261
|
moveTo(p, tempo = 1) {
|
|
255
|
-
const { pos, targetPos, opts } = this;
|
|
262
|
+
const { pos, targetPos, opts, isPenDown } = this;
|
|
256
263
|
// apply scale factor: worldspace units -> motor steps
|
|
257
264
|
mulN2(targetPos, p, opts.stepsPerInch / opts.unitsPerInch);
|
|
258
265
|
const delta = sub2([], targetPos, pos);
|
|
259
266
|
set2(pos, targetPos);
|
|
260
267
|
const maxAxis = Math.max(...abs2([], delta));
|
|
261
|
-
const duration = (1000 * maxAxis) /
|
|
268
|
+
const duration = (1000 * maxAxis) /
|
|
269
|
+
((isPenDown ? opts.speedDown : opts.speedUp) * tempo);
|
|
262
270
|
this.send(`XM,${duration | 0},${delta[0] | 0},${delta[1] | 0}\r`);
|
|
263
271
|
return [duration, (mag(delta) * opts.unitsPerInch) / opts.stepsPerInch];
|
|
264
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
|
}
|