node-mavlink 1.5.0 → 1.5.1

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/README.md CHANGED
@@ -68,15 +68,22 @@ Sending messages is also very easy. One example that is very useful is to send t
68
68
  ```javascript
69
69
  import { MavLinkProtocolV2, send } from 'node-mavlink'
70
70
 
71
- // Create an instance of of the `CommandInt` class that will be the vessel
72
- // for containing the command data
73
- const msg = new common.CommandInt()
74
- msg.command = common.MavCmd.REQUEST_PROTOCOL_VERSION
75
- msg.param1 = 1
71
+ // Create an instance of of the `RequestProtocolVersionCommand`
72
+ // class that will be the vessel for containing the command data.
73
+ // Underneath the cover it uses CommandLong to convert the data.
74
+ //
75
+ // By convention the intermediate fields that are then serialized
76
+ // are named with `_` (underscore) prefix and should not be used
77
+ // directly. That doesn't mean you can't use them, but if there
78
+ // is a equivalend Command class it is just a lot easier and every
79
+ // parameter not only has a more descriptive names but also in-line
80
+ // documentation.
81
+ const command = new common.RequestProtocolVersionCommand()
82
+ command.confirmation = 1
76
83
 
77
84
  port.on('open', async () => {
78
85
  // the port is open - we're ready to send data
79
- await send(port, msg, new MavLinkProtocolV2())
86
+ await send(port, command, new MavLinkProtocolV2())
80
87
  })
81
88
  ```
82
89
 
@@ -37,13 +37,20 @@ async function main() {
37
37
  }
38
38
  })
39
39
 
40
- // You're now ready to send messages to the controller using the socket
41
- // let's request the list of parameters
42
- const cmdSetMode = new common.DoSetModeCommand()
43
- cmdSetMode.mode = 1
44
- cmdSetMode.customMode = ardupilotmega.CopterMode.DRIFT
45
-
46
- await port.send(cmdSetMode)
40
+ // Create an instance of of the `RequestProtocolVersionCommand`
41
+ // class that will be the vessel for containing the command data.
42
+ // Underneath the cover it uses CommandLong to convert the data.
43
+ //
44
+ // By convention the intermediate fields that are then serialized
45
+ // are named with `_` (underscore) prefix and should not be used
46
+ // directly. That doesn't mean you can't use them, but if there
47
+ // is a equivalend Command class it is just a lot easier and every
48
+ // parameter not only has a more descriptive names but also in-line
49
+ // documentation.
50
+ const command = new common.RequestProtocolVersionCommand()
51
+ command.confirmation = 1
52
+
53
+ await port.send(command)
47
54
 
48
55
  // Give the system time to process any incoming acknowledges
49
56
  const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-mavlink",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "author": "Matthias Hryniszak <padcom@gmail.com>",
5
5
  "license": "LGPL",
6
6
  "description": "MavLink definitions and parsing library",