Skip to content

Commit ab573d9

Browse files
committed
don't require default options
1 parent c8ed78a commit ab573d9

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/defaultoptions.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"telloIP": "192.168.10.1",
3+
"telloPort": 8889,
4+
"webserver": 3000,
5+
"telloStatePort": 8890,
6+
"telloVideoPort": 8890,
7+
"enhancedLogging": false
8+
}

src/mod.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
} from "./cmds/mod.ts";
1616
import { dgram } from "./deps.ts";
1717
import { decode, encode } from "./lib/text.ts";
18+
import defaultOptions from "./defaultOptions.json" assert { type: "json" };
1819

1920
export default class DroneController {
2021
public takeOff = takeOff;
@@ -40,8 +41,8 @@ export default class DroneController {
4041
private resolveQueue: (() => void)[] = [];
4142
private allowWait = false;
4243

43-
constructor(options: Options) {
44-
this.options = options;
44+
constructor(options?: Options) {
45+
this.options = options || defaultOptions;
4546
this.state = "";
4647
}
4748

0 commit comments

Comments
 (0)