🛸 Adds servo config

This commit is contained in:
Rune Harlyk
2024-06-06 21:53:41 +02:00
committed by Rune Harlyk
parent f5d9cea236
commit e81beeb36b
4 changed files with 70 additions and 17 deletions
+5 -5
View File
@@ -173,11 +173,11 @@ export type CameraSettings = {
export type servo = {
channel: number;
name: string;
direction: number;
inverted: boolean;
angle: number;
min_pwm: number;
max_pwm: number;
min_angle: number;
max_angle: number;
center_angle: number;
// min_pwm: number;
// max_pwm: number;
// min_angle: number;
// max_angle: number;
};
@@ -8,13 +8,16 @@
<div class="flex gap-2 items-center">
Is inverted <input type="checkbox" checked={servo.inverted} class="checkbox"/>
</div>
<div>
Middle position <input type="number" bind:value={servo.center_angle} class="input input-bordered input-sm max-w-xs"/>
</div>
<div class="relative mb-6">
<label for="labels-range-input" class="sr-only">Labels range</label>
<input id="labels-range-input" type="range" value="1000" min="100" max="1500" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700">
<span class="text-sm text-gray-500 dark:text-gray-400 absolute start-0 -bottom-6">Min ($100)</span>
<span class="text-sm text-gray-500 dark:text-gray-400 absolute start-1/3 -translate-x-1/2 rtl:translate-x-1/2 -bottom-6">$500</span>
<span class="text-sm text-gray-500 dark:text-gray-400 absolute start-2/3 -translate-x-1/2 rtl:translate-x-1/2 -bottom-6">$1000</span>
<span class="text-sm text-gray-500 dark:text-gray-400 absolute end-0 -bottom-6">Max ($1500)</span>
<input id="labels-range-input" type="range" bind:value={servo.angle} min="0" max="180" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700">
<span class="text-sm text-gray-500 dark:text-gray-400 absolute start-0 -bottom-6">0</span>
<span class="text-sm text-gray-500 dark:text-gray-400 absolute start-1/2 -translate-x-1/2 rtl:translate-x-1/2 -bottom-6">90</span>
<span class="text-sm text-gray-500 dark:text-gray-400 absolute end-0 -bottom-6">180</span>
</div>
<button class="btn btn-ghost rounded-btn">Sweep range</button>
<button class="btn btn-neutral btn-sm">Sweep range</button>
</div>
@@ -16,7 +16,7 @@
{
channel: 0,
name: "Front right hip",
direction: direction,
inverted: false,
angle: angle,
min_pwm: min_pwm,
max_pwm: max_pwm,