Skip to content

Commit

Permalink
Fix device reset error
Browse files Browse the repository at this point in the history
  • Loading branch information
bclswl0827 committed Dec 7, 2023
1 parent 0b82716 commit c59c540
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 25 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.2.1p
v2.2.2p
1 change: 1 addition & 0 deletions app/mseed/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

func getMiniSEEDBytes(conf *config.Conf, fileName string) ([]byte, error) {
// Remove slash in file name to avoid path traversal
fileName = strings.ReplaceAll(fileName, "\\", "")
fileName = strings.ReplaceAll(fileName, "/", "")
basePath := conf.MiniSEED.Path

Expand Down
2 changes: 1 addition & 1 deletion build/assets/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
}
},
"adc_settings": {
"resolution": 24,
"resolution": 32,
"fullscale": 5.0
},
"serial_settings": {
Expand Down
15 changes: 13 additions & 2 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,8 @@ const docTemplate = `{
"distance": {
"type": "number"
},
"estimated": {
"type": "number"
"estimation": {
"$ref": "#/definitions/trace.estimation"
},
"event": {
"type": "string"
Expand All @@ -514,6 +514,17 @@ const docTemplate = `{
"type": "boolean"
}
}
},
"trace.estimation": {
"type": "object",
"properties": {
"p": {
"type": "number"
},
"s": {
"type": "number"
}
}
}
}
}`
Expand Down
15 changes: 13 additions & 2 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,8 @@
"distance": {
"type": "number"
},
"estimated": {
"type": "number"
"estimation": {
"$ref": "#/definitions/trace.estimation"
},
"event": {
"type": "string"
Expand All @@ -506,6 +506,17 @@
"type": "boolean"
}
}
},
"trace.estimation": {
"type": "object",
"properties": {
"p": {
"type": "number"
},
"s": {
"type": "number"
}
}
}
}
}
11 changes: 9 additions & 2 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ definitions:
type: number
distance:
type: number
estimated:
type: number
estimation:
$ref: '#/definitions/trace.estimation'
event:
type: string
latitude:
Expand All @@ -170,6 +170,13 @@ definitions:
verfied:
type: boolean
type: object
trace.estimation:
properties:
p:
type: number
s:
type: number
type: object
info:
contact: {}
description: This is Observer RESTful API documentation, please set `server_settings.debug`
Expand Down
2 changes: 1 addition & 1 deletion feature/geophone/counts.go → feature/geophone/offset.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package geophone

import "sort"

func (g *Geophone) getCounts(data []int32) []int32 {
func (g *Geophone) getOffsetCounts(data []int32) []int32 {
sortedData := make([]int32, len(data))
copy(sortedData, data)
sort.Slice(sortedData, func(i, j int) bool {
Expand Down
6 changes: 3 additions & 3 deletions feature/geophone/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ func (g *Geophone) Read(port io.ReadWriteCloser, conf *config.Conf, packet *Pack
}

// Get channel counts by offsetting
packet.EHZ = g.getCounts(packet.EHZ)
packet.EHE = g.getCounts(packet.EHE)
packet.EHN = g.getCounts(packet.EHN)
packet.EHZ = g.getOffsetCounts(packet.EHZ)
packet.EHE = g.getOffsetCounts(packet.EHE)
packet.EHN = g.getOffsetCounts(packet.EHN)

return nil
}
6 changes: 1 addition & 5 deletions feature/geophone/reset.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package geophone

import (
"fmt"
"io"

"github.com/bclswl0827/observer/driver/serial"
Expand All @@ -13,9 +12,6 @@ func (g *Geophone) Reset(port io.ReadWriteCloser) error {
return err
}

_, err = serial.Filter(port, ACK_WORD[:], 64)
if err != nil {
return fmt.Errorf("failed to reset geophone")
}
serial.Filter(port, ACK_WORD[:], 128)
return nil
}
2 changes: 1 addition & 1 deletion feature/miniseed/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ func (m *MiniSEED) handleCleanup(basePath, station, network string, lifeCycle in
}
}

time.Sleep(time.Second)
time.Sleep(time.Minute)
}
}
4 changes: 2 additions & 2 deletions frontend/dist/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"files": {
"main.css": "/static/css/main.3d547ccc.css",
"main.js": "/static/js/main.d5698ba2.js",
"main.js": "/static/js/main.ea5b2235.js",
"static/css/278.525e2941.chunk.css": "/static/css/278.525e2941.chunk.css",
"static/js/278.f2bbf51e.chunk.js": "/static/js/278.f2bbf51e.chunk.js",
"static/js/967.8f28312d.chunk.js": "/static/js/967.8f28312d.chunk.js",
Expand Down Expand Up @@ -47,6 +47,6 @@
},
"entrypoints": [
"static/css/main.3d547ccc.css",
"static/js/main.d5698ba2.js"
"static/js/main.ea5b2235.js"
]
}
2 changes: 1 addition & 1 deletion frontend/dist/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"/><link rel="icon" href="/favicon.ico"/><link rel="manifest" href="/manifest.json"/><script defer="defer" src="/static/js/main.d5698ba2.js"></script><link href="/static/css/main.3d547ccc.css" rel="stylesheet"></head><body><div id="root"></div></body></html>
<!doctype html><html><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"/><link rel="icon" href="/favicon.ico"/><link rel="manifest" href="/manifest.json"/><script defer="defer" src="/static/js/main.ea5b2235.js"></script><link href="/static/css/main.3d547ccc.css" rel="stylesheet"></head><body><div id="root"></div></body></html>

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions frontend/src/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
REACT_APP_VERSION=v2.2.1p
REACT_APP_RELEASE=131743e1-20231129221715
REACT_APP_VERSION=v2.2.2p
REACT_APP_RELEASE=0b827168-20231208010559

0 comments on commit c59c540

Please sign in to comment.