firmware update implemented and checked
This commit is contained in:
parent
8c9c8478d5
commit
9391785df3
|
|
@ -11,10 +11,9 @@
|
||||||
<q-input v-model="data.ota_url" label="OTA firmware file URL" />
|
<q-input v-model="data.ota_url" label="OTA firmware file URL" />
|
||||||
<q-input type="number" v-model="data.ota_auto_int" label="New firmware check interval, sec" />
|
<q-input type="number" v-model="data.ota_auto_int" label="New firmware check interval, sec" />
|
||||||
<div>Current firmware version: {{ data.fw_rev }}</div>
|
<div>Current firmware version: {{ data.fw_rev }}</div>
|
||||||
<div>Available firmware version: {{ data.fw_rev }}</div>
|
<div>Available firmware version: {{ data.ota_newver }}</div>
|
||||||
<div>Firmware status: <div v-html="data.ota_state"></div>
|
<div>Firmware status: <span v-html="data.ota_state"></span></div>
|
||||||
</div>
|
<q-btn color="primary" label="Check firmware" @click="CheckFirmware"></q-btn>
|
||||||
<q-btn color="primary" label="Check firmware" @click="PostData({ ota_start: 1 }, 2, 0, null)"></q-btn>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
|
|
@ -23,7 +22,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive } from "vue";
|
import { reactive, onUnmounted } from "vue";
|
||||||
import { PostData } from "components/webguicomp/network";
|
import { PostData } from "components/webguicomp/network";
|
||||||
import CardActions from "components/webguicomp/CardActions.vue"
|
import CardActions from "components/webguicomp/CardActions.vue"
|
||||||
|
|
||||||
|
|
@ -36,6 +35,14 @@ const init = {
|
||||||
ota_auto_int: 0, fw_rev: '', ota_newver: '', ota_state: ''
|
ota_auto_int: 0, fw_rev: '', ota_newver: '', ota_state: ''
|
||||||
}
|
}
|
||||||
const data = reactive(init);
|
const data = reactive(init);
|
||||||
PostData(data, 2, 0, null);
|
|
||||||
|
|
||||||
|
let intervalId;
|
||||||
|
function CheckFirmware() {
|
||||||
|
PostData({ ota_start: 1 }, 2, 0, null);
|
||||||
|
intervalId = setInterval(() => {
|
||||||
|
PostData(data, 2, 0, null);
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
onUnmounted(() => clearInterval(intervalId));
|
||||||
|
PostData(data, 2, 0, null);
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,7 @@ defineOptions({
|
||||||
})
|
})
|
||||||
|
|
||||||
const init = {
|
const init = {
|
||||||
time: 0,
|
time: 0, uptime: 0,
|
||||||
uptime: 0,
|
|
||||||
wifi_level: "",
|
wifi_level: "",
|
||||||
eth_stat: "",
|
eth_stat: "",
|
||||||
wifi_stat: "",
|
wifi_stat: "",
|
||||||
|
|
@ -50,8 +49,6 @@ const init = {
|
||||||
free_ram_min: 0
|
free_ram_min: 0
|
||||||
}
|
}
|
||||||
const data = reactive(init);
|
const data = reactive(init);
|
||||||
PostData(data, 2, 0, null);
|
|
||||||
|
|
||||||
let intervalId
|
let intervalId
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
intervalId = setInterval(() => {
|
intervalId = setInterval(() => {
|
||||||
|
|
@ -61,5 +58,5 @@ onMounted(() => {
|
||||||
onUnmounted(() => clearInterval(intervalId))
|
onUnmounted(() => clearInterval(intervalId))
|
||||||
const timestr = computed({ get() { return (new Date(data.time * 1000).toISOString()) } })
|
const timestr = computed({ get() { return (new Date(data.time * 1000).toISOString()) } })
|
||||||
const uptimestr = computed({ get() { return (secondsToHms(data.uptime)) } })
|
const uptimestr = computed({ get() { return (secondsToHms(data.uptime)) } })
|
||||||
|
PostData(data, 2, 0, null);
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user