Added page to test encoding of proto

This commit is contained in:
Niklas Jensen
2025-12-28 22:27:15 +01:00
committed by nikguin04
parent 7a21580569
commit 2a25851fb6
4 changed files with 328 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
<script lang="ts">
import { IMUReport, IMUType } from '$lib/platform_shared/example';
const imu_report: IMUReport = {type: IMUType.IMU_ACCEL, xVal: 4}
const writer = IMUReport.encode(imu_report);
const bytes = writer.finish();
// Convert bytes to hex
const hex = Array.from(bytes)
.map((b) => b.toString(16).padStart(2, '0'))
.join(' ');
</script>
<h1>Hexadecimal Output</h1>
<p><strong>Hex output:</strong> {hex}</p>