aboutsummaryrefslogtreecommitdiff
path: root/hsm-web/Client/src/INA226.vue
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2026-01-03 00:26:51 +0000
committerPaul Oliver <contact@pauloliver.dev>2026-01-03 03:42:43 +0000
commit864a1d2a22580a33b5e928734fd256c2133fb672 (patch)
treef164047133c293ae768112a6aad7eaab5df53401 /hsm-web/Client/src/INA226.vue
parentf7f11acafe0a404fa218c13832e32fce574ae0f6 (diff)
Adds camera streaming to frontend
Diffstat (limited to 'hsm-web/Client/src/INA226.vue')
-rw-r--r--hsm-web/Client/src/INA226.vue31
1 files changed, 16 insertions, 15 deletions
diff --git a/hsm-web/Client/src/INA226.vue b/hsm-web/Client/src/INA226.vue
index bf0141f..a827b0b 100644
--- a/hsm-web/Client/src/INA226.vue
+++ b/hsm-web/Client/src/INA226.vue
@@ -1,41 +1,42 @@
<template>
- <h3>Battery Status</h3>
+ <h2>Battery Status</h2>
<table>
<tbody>
<tr>
- <td>{{ ina226Reading.voltage.toFixed(2) }}V</td>
- <td>{{ ina226Reading.current.toFixed(2) }}A</td>
- <td>{{ ina226Reading.power.toFixed(2) }}W</td>
+ <td>{{ fmt(reading.voltage, 'V') }}</td>
+ <td>{{ fmt(reading.current, 'A') }}</td>
+ <td>{{ fmt(reading.power, 'W') }}</td>
</tr>
</tbody>
</table>
</template>
<script>
-import axios from 'axios'
+import axios from 'axios'
import config from './config'
export default {
data() {
return {
- ina226Reading: {
+ reading: {
voltage: 0,
current: 0,
- power: 0
+ power: 0
}
}
},
mounted() {
- this.getINA226Reading()
+ this.getReading()
},
methods: {
- getINA226Reading() {
- axios
- .get(`${config.api}/ina226`)
- .then(res => {
- this.ina226Reading = res.data
- setTimeout(this.getINA226Reading, 1000)
- })
+ async getReading() {
+ const res = await axios.get(config.api + '/ina226')
+ this.reading = res.data
+
+ setTimeout(this.getReading, 1000)
+ },
+ fmt(val, sfx) {
+ return val.toFixed(2) + sfx
}
}
}