Show average period of beacons
This commit is contained in:
parent
185e07e580
commit
f5b9057186
@ -4,6 +4,7 @@
|
||||
<template v-if="status.lastHeard">
|
||||
<td>{{ formatTime(status.lastHeard) }}</td>
|
||||
<td>{{ formatTime(now - status.lastHeard, true) }}</td>
|
||||
<td>{{ formatTime(Math.round(status.avgDelta), true) }}</td>
|
||||
<td>{{ status.lastVoltage || "" }}</td>
|
||||
<td>{{ status.lastTemperature || "" }}</td>
|
||||
</template>
|
||||
@ -12,6 +13,7 @@
|
||||
<td>Never Heard</td>
|
||||
<td>Never Heard</td>
|
||||
<td>Never Heard</td>
|
||||
<td>Never Heard</td>
|
||||
</template>
|
||||
</tr>
|
||||
</template>
|
||||
@ -66,9 +68,14 @@ export default {
|
||||
messages() {
|
||||
Object.assign(
|
||||
this.status,
|
||||
this.messages.reduce((acc, message) => {
|
||||
this.messages.reduce((acc, message, idx, arr) => {
|
||||
acc.lastHeard = message.date.getTime();
|
||||
acc.delta = message.date - acc.lastHeard;
|
||||
if (idx === 0) {
|
||||
acc.avgDelta = 0;
|
||||
} else {
|
||||
let delta = message.date.getTime() - arr[idx - 1].date.getTime();
|
||||
acc.avgDelta = (acc.avgDelta * (idx - 1) + delta) / idx;
|
||||
}
|
||||
if ("data" in message && "analog" in message.data) {
|
||||
acc.lastVoltage = message.data.analog[0] / 10;
|
||||
acc.lastTemperature = message.data.analog[1];
|
||||
|
@ -5,6 +5,7 @@
|
||||
<th>Callsign</th>
|
||||
<th>Last Heard</th>
|
||||
<th>Time since Last Heard</th>
|
||||
<th>Avg. Period</th>
|
||||
<th>Last Voltage</th>
|
||||
<th>Last Temperature</th>
|
||||
</tr>
|
||||
|
Loading…
Reference in New Issue
Block a user