Skip to content

Commit

Permalink
core: frontend: utils: mavlink_prettier: Add COMMAND_LONG
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick José Pereira <[email protected]>
  • Loading branch information
patrickelectric committed Feb 18, 2022
1 parent 474d06a commit 4923657
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions core/frontend/src/utils/mavlink_prettifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ const formatters = {
return `COMMAND_ACK - ${message.command.type.replace('MAV_CMD_', '')}`
+ ` - ${message.result.type.replace('MAV_RESULT_', '')}`
},
COMMAND_LONG(message: any) {
function getParameters(): string {
return Object.getOwnPropertyNames(message)
.filter((name) => name.includes('param'))
.map((name) => `${name}: ${message[name]}`)
.join(', ')
}
return `COMMAND_LONG - ${message.command.type.replace('MAV_CMD_', '')}`
+ ` - ${getParameters()}`
},
GLOBAL_POSITION_INT(message: any) {
return `GLOBAL_POSITION_INT - Lat: ${message.lat.toFixed(5)} Lon: ${message.lon.toFixed(5)}`
},
Expand Down

0 comments on commit 4923657

Please sign in to comment.