Skip to content

Commit 0af6b6c

Browse files
committed
writing settings works
1 parent 677fea9 commit 0af6b6c

13 files changed

+432
-322
lines changed

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v20.10.0
1+
v20.11.1

app.vue

-13
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,6 @@
77
<div v-else>
88
No WebSerial
99
</div>
10-
<footer class="absolute bottom-0 w-full bg-gray-800">
11-
<div class="grid grid-cols-3 leading-loose">
12-
<div class="text-center">
13-
AM32 Configurator
14-
</div>
15-
<div class="text-center">
16-
powered by Nuxt and Netlify
17-
</div>
18-
<div class="text-center">
19-
v0.0.1
20-
</div>
21-
</div>
22-
</footer>
2310
<UNotifications />
2411
</div>
2512
</template>

bun.lockb

37.6 KB
Binary file not shown.

components/SerialDevice.vue

+12-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<UButton size="xs" @click="connectToEsc">
4141
<UIcon name="i-material-symbols-find-in-page-outline" />
4242
</UButton>
43-
<UButton color="blue" size="xs" :disabled="!isAnySettingsDirty">
43+
<UButton color="blue" size="xs" :disabled="!isAnySettingsDirty" @click="writeConfig">
4444
<UIcon name="i-material-symbols-save" />
4545
</UButton>
4646
</div>
@@ -233,6 +233,17 @@ const connectToEsc = async () => {
233233
}
234234
};
235235
236+
const writeConfig = async () => {
237+
if (!serialStore.isFourWay) {
238+
throw new Error('No 4way connection found');
239+
}
240+
241+
for (let i = 0; i < escStore.count; ++i) {
242+
const result = await FourWay.getInstance().writeSettings(i, escStore.escInfo[i]);
243+
console.log(result);
244+
}
245+
};
246+
236247
const disconnectFromDevice = async () => {
237248
if (serialStore.deviceHandles.port) {
238249
if (serialStore.isFourWay) {

components/SettingField.vue

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<template>
2-
<div class="relative">
2+
<div class="relative" :class="{
3+
'before:content-[\'\'] before:absolute before:inset-0 blur-[2px]': isDisabled
4+
}">
35
<UFormGroup>
46
<template #label>
57
<div class="flex items-center gap-1 mb-1">

components/SettingFieldGroup.vue

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
<div class="flex">
77
<div v-if="switches.length > 0" class="p-4">
88
<div v-for="{ field, name } of switches" :key="field">
9-
<UCheckbox :label="name" :value="model(field).value" @update:model-value="model(field).value = $event" />
9+
<UCheckbox :label="name" v-model="model(field).value"/>
1010
</div>
1111
</div>
1212
<div class="flex-grow grid gap-4 p-4" :class="`grid-cols-${cols}`">
13-
<slot />
13+
<slot></slot>
1414
</div>
1515
</div>
1616
</div>
@@ -41,7 +41,8 @@ withDefaults(defineProps<SettingFieldGroupProps>(), {
4141
4242
const model = (field: EepromLayoutKeys) => computed({
4343
get: () => {
44-
return escStore.escInfo[0].settings[field];
44+
console.log(field, escStore.escInfo[0].settings[field] === 1);
45+
return escStore.escInfo[0].settings[field] === 1;
4546
},
4647
set: (_val) => {
4748
emits('change', {

layouts/default.vue

+36-17
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,43 @@
11
<template>
2-
<div class="grid grid-cols-12 text-white ">
3-
<div class="col-span-2 flex justify-center items-center">
4-
<svgo-logo-full class="text-white text-[150px]" />
5-
</div>
6-
<div class="col-span-8 h-[200px] max-h-[200px]">
7-
<div class="h-full font-bold text-3xl text-red-800 flex flex-col">
8-
<div v-if="logStore.entries.length === 0">
9-
AlkaMotors
2+
<DashboardLayout>
3+
<UDashboardPanel>
4+
<UDashboardNavbar class="grid grid-cols-12 text-white ">
5+
<div class="col-span-2 flex justify-center items-center">
6+
<svgo-logo-full class="text-white text-[150px]" />
107
</div>
8+
<div class="col-span-8 h-[200px] max-h-[200px]">
9+
<div class="h-full font-bold text-3xl text-red-800 flex flex-col">
10+
<div v-if="logStore.entries.length === 0">
11+
AlkaMotors
12+
</div>
1113

12-
<Log v-else class="h-full overflow-auto" />
13-
</div>
14-
</div>
15-
<div v-if="serialStore.hasSerial" class="col-span-2">
16-
<SerialDevice />
17-
</div>
18-
</div>
19-
<div class="h-full">
14+
<Log v-else class="h-full overflow-auto" />
15+
</div>
16+
</div>
17+
<div v-if="serialStore.hasSerial" class="col-span-2">
18+
<SerialDevice />
19+
</div>
20+
</UDashboardNavbar>
21+
<UFooter class="bg-gray-800">
22+
<template #left>
23+
<div class="text-center">
24+
AM32 Configurator
25+
</div>
26+
</template>
27+
<template>
28+
<div class="text-center">
29+
powered by Nuxt and Netlify
30+
</div>
31+
</template>
32+
<template #right>
33+
<div class="text-center">
34+
v0.0.1
35+
</div>
36+
</template>
37+
</UFooter>
38+
</UDashboardPanel>
2039
<slot />
21-
</div>
40+
</DashboardLayout>
2241
</template>
2342
<script setup lang="ts">
2443
const serialStore = useSerialStore();

0 commit comments

Comments
 (0)