Skip to content

Commit a60171a

Browse files
committed
Fix the issue that fallback data is not used
1 parent ac50096 commit a60171a

File tree

7 files changed

+23
-7
lines changed

7 files changed

+23
-7
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
Starting from v2.2.5, all notable changes to this project will be documented in this file.
44

5+
## v3.0.3
6+
7+
### Bug Fixes
8+
9+
- Fixed an issue on the frontend where the CPU and memory usage percentages were not displayed correctly.
10+
- Resolved a backend issue where the timestamp, latitude, longitude, and elevation values were always 0 when fallback values were expected.
11+
512
## v3.0.2
613

714
### New Features

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v3.0.2
1+
v3.0.3

drivers/dao/tables/adc_count.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77

88
type AdcCount struct {
99
dao.BaseModel
10-
Timestamp int64 `gorm:"column:timestamp;not null;index"`
10+
Timestamp int64 `gorm:"column:timestamp;index;not null;unique"`
1111
Z_Axis array.Int32Array `gorm:"column:z_axis;type:text"`
1212
E_Axis array.Int32Array `gorm:"column:e_axis;type:text"`
1313
N_Axis array.Int32Array `gorm:"column:n_axis;type:text"`

drivers/explorer/impl.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,8 @@ func (e *ExplorerDriverImpl) handleReadLegacyPacket(deps *ExplorerDependency) {
230230
return
231231
case <-ticker.C:
232232
if len(dataBuffer) > 0 {
233-
deps.Health.Received++
234233
deps.Health.UpdatedAt = time.Now()
234+
deps.Health.Received++
235235

236236
// Fix jitter in the timestamp
237237
t, _ := deps.FallbackTime.GetTime()
@@ -308,7 +308,7 @@ func (e *ExplorerDriverImpl) handleReadMainlinePacket(deps *ExplorerDependency)
308308
deps.Health.Errors++
309309
continue
310310
}
311-
if deps.Config.Latitude != 0 && deps.Config.Longitude != 0 && deps.Config.Elevation != 0 {
311+
if e.mainlinePacketHeader.latitude != 0 && e.mainlinePacketHeader.longitude != 0 && e.mainlinePacketHeader.elevation != 0 {
312312
deps.Config.Latitude = float64(e.mainlinePacketHeader.latitude)
313313
deps.Config.Longitude = float64(e.mainlinePacketHeader.longitude)
314314
deps.Config.Elevation = float64(e.mainlinePacketHeader.elevation)
@@ -360,6 +360,7 @@ func (e *ExplorerDriverImpl) handleReadMainlinePacket(deps *ExplorerDependency)
360360
if time.Duration(math.Abs(float64(t.Sub(prevTime).Milliseconds()))) <= EXPLORER_GENERAL_JITTER {
361361
t = deps.FallbackTime.Fix(t, prevTime, time.Second)
362362
}
363+
finalPacket.Timestamp = t.UnixMilli()
363364
prevTime = t
364365
}
365366
deps.messageBus.Publish("explorer", &finalPacket)

drivers/explorer/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
messagebus "github.com/vardius/message-bus"
1111
)
1212

13-
const EXPLORER_GENERAL_JITTER = 2 * time.Millisecond
13+
const EXPLORER_GENERAL_JITTER = 10 * time.Millisecond
1414

1515
const (
1616
EXPLORER_CHANNEL_CODE_Z = "Z"

frontend/src/.env

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
REACT_APP_VERSION=v3.0.2
2-
REACT_APP_RELEASE=732d9df6-20240808110748
1+
REACT_APP_VERSION=v3.0.3
2+
REACT_APP_RELEASE=ac50096d-20240808200400

frontend/src/src/views/Home/handleSetCharts.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ export const handleSetCharts = (
4040
timestamp - initTimestamp >= RETENTION_THRESHOLD_MS
4141
);
4242
}
43+
prev.cpu.holder.values = {
44+
...prev.cpu.holder.values,
45+
usage: cpuPercent.toFixed(2)
46+
};
4347

4448
// Set memory usage chart
4549
const { percent: memoryPercent } = res.data.memory;
@@ -54,6 +58,10 @@ export const handleSetCharts = (
5458
timestamp - initTimestamp >= RETENTION_THRESHOLD_MS
5559
);
5660
}
61+
prev.memory.holder.values = {
62+
...prev.memory.holder.values,
63+
usage: memoryPercent.toFixed(2)
64+
};
5765

5866
return prev;
5967
});

0 commit comments

Comments
 (0)