-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
96f5b2c
commit fa5107f
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Print window.exposed_interface</title> | ||
</head> | ||
<body> | ||
<h1>window.exposed_interface Content:</h1> | ||
Pitch: <div id="output"></div> | ||
|
||
<script> | ||
let registered = false; | ||
const outputDiv = document.getElementById('output'); | ||
function printExposedInterface() { | ||
const decoder = new TextDecoder() | ||
if (window.MavlinkSignal && !registered) { | ||
registered = true; | ||
window.MavlinkSignal.add((message) => { | ||
const msg = JSON.parse(decoder.decode(message))['message'] | ||
if (msg.type !== 'ATTITUDE') { | ||
return | ||
} | ||
outputDiv.innerHTML = `<pre>${msg.pitch}</pre>`; | ||
}) | ||
} | ||
} | ||
// Initial print | ||
printExposedInterface(); | ||
|
||
// Set interval to print every 5 seconds | ||
setInterval(printExposedInterface, 1000); | ||
</script> | ||
</body> | ||
</html> |