diff --git a/src/StationRow.vue b/src/StationRow.vue
index 91b5b6f..484de28 100644
--- a/src/StationRow.vue
+++ b/src/StationRow.vue
@@ -4,6 +4,7 @@
{{ formatTime(status.lastHeard) }} |
{{ formatTime(now - status.lastHeard, true) }} |
+ {{ formatTime(Math.round(status.avgDelta), true) }} |
{{ status.lastVoltage || "" }} |
{{ status.lastTemperature || "" }} |
@@ -12,6 +13,7 @@
Never Heard |
Never Heard |
Never Heard |
+ Never Heard |
@@ -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];
diff --git a/src/StatusScreen.vue b/src/StatusScreen.vue
index 70b326f..ae3363c 100644
--- a/src/StatusScreen.vue
+++ b/src/StatusScreen.vue
@@ -5,6 +5,7 @@
Callsign |
Last Heard |
Time since Last Heard |
+ Avg. Period |
Last Voltage |
Last Temperature |