diff --git a/CHANGELOG.md b/CHANGELOG.md index a58ed396..e8a0b7f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,17 @@ Starting from v2.2.5, all notable changes to this project will be documented in this file. +## v3.0.1 + +### Bug Fixes + +- Fixed the issue where MiniSEED recording in legacy mode would be interrupted due to sampling rate jitter + ## v3.0.0 ### Breaking Changes -- **Data Protocol**: The AnyShake Explorer data protocol has been entirely refactored. **Please rebuild and flash the firmware of AnyShake Explorer to the latest version.** +- **Data Protocol**: The AnyShake Explorer data protocol has been entirely refactored. **Please rebuild and burn the firmware of AnyShake Explorer to the latest version.** - **Configuration File**: The configuration file layout has been completely overhauled. The old configuration file format is no longer supported. - **SeedLink Server**: The SeedLink service has been temporarily removed and will be re-implemented in a future release. - **API Endpoints**: Some request and response fields have been modified in API v1. Please refer to the built-in Swagger API documentation for details. diff --git a/VERSION b/VERSION index ad55eb85..b105cea1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v3.0.0 +v3.0.1 diff --git a/build/assets/config.json b/build/assets/config.json index 8bbf3268..9fcf9a59 100644 --- a/build/assets/config.json +++ b/build/assets/config.json @@ -35,12 +35,12 @@ "port": 123 }, "database_settings": { - "engine": "sqlite", - "host": "", - "port": 0, - "username": "", - "password": "", - "database": "/home/yuki/observer.db" + "engine": "postgresql", + "host": "127.0.0.1", + "port": 5432, + "username": "postgres", + "password": "passw0rd", + "database": "observer" }, "server_settings": { "host": "0.0.0.0", diff --git a/frontend/src/.env b/frontend/src/.env index f48e3e79..f1f355ac 100644 --- a/frontend/src/.env +++ b/frontend/src/.env @@ -1,2 +1,2 @@ -REACT_APP_VERSION=v3.0.0 -REACT_APP_RELEASE=b2150f37-20240808023110 +REACT_APP_VERSION=v3.0.1 +REACT_APP_RELEASE=f0315abf-20240808033910 diff --git a/services/miniseed/start.go b/services/miniseed/start.go index ffad162d..721a6674 100644 --- a/services/miniseed/start.go +++ b/services/miniseed/start.go @@ -36,6 +36,7 @@ func (m *MiniSeedService) Start(options *services.Options, waitGroup *sync.WaitG explorer.EXPLORER_CHANNEL_CODE_E: 0, explorer.EXPLORER_CHANNEL_CODE_N: 0, } + m.legacyMode = options.Config.Explorer.Legacy m.cleanUpCountDown = MINISEED_CLEANUP_INTERVAL m.writeBufferCountDown = MINISEED_WRITE_INTERVAL diff --git a/services/miniseed/types.go b/services/miniseed/types.go index 24905eb6..76964db7 100644 --- a/services/miniseed/types.go +++ b/services/miniseed/types.go @@ -6,10 +6,11 @@ import ( ) const ( - MINISEED_BIT_ORDER = mseedio.MSBFIRST - MINISEED_ENCODE_TYPE = mseedio.STEIM2 - MINISEED_WRITE_INTERVAL = 5 - MINISEED_CLEANUP_INTERVAL = 60 + MINISEED_BIT_ORDER = mseedio.MSBFIRST + MINISEED_ENCODE_TYPE = mseedio.STEIM2 + MINISEED_WRITE_INTERVAL = 5 + MINISEED_CLEANUP_INTERVAL = 60 + MINISEED_ALLOWED_JITTER_MS = 10 ) type MiniSeedService struct { @@ -18,6 +19,7 @@ type MiniSeedService struct { writeBufferCountDown int cleanUpCountDown int lifeCycle int + legacyMode bool basePath string stationCode string networkCode string diff --git a/services/miniseed/write.go b/services/miniseed/write.go index 3ae275ab..64a6f75b 100644 --- a/services/miniseed/write.go +++ b/services/miniseed/write.go @@ -2,6 +2,7 @@ package miniseed import ( "fmt" + "math" "time" "github.com/anyshake/observer/drivers/explorer" @@ -14,17 +15,18 @@ func (m *MiniSeedService) handleWrite() error { startSampleRate = m.miniseedBuffer[0].SampleRate ) - // Check if the timestamp is continuous + // Check if the timestamp is within the allowed jitter for i := 1; i < len(m.miniseedBuffer); i++ { - if m.miniseedBuffer[i].Timestamp != startTimestamp+int64(i*1000) { + if math.Abs(float64(m.miniseedBuffer[i].Timestamp-startTimestamp-int64(i*1000))) > 1000+MINISEED_ALLOWED_JITTER_MS { return fmt.Errorf("timestamp is not continuous, expected %d, got %d", startTimestamp+int64(i*1000), m.miniseedBuffer[i].Timestamp) } } - // Check if sample rate is the same - for i := 1; i < len(m.miniseedBuffer); i++ { - if m.miniseedBuffer[i].SampleRate != startSampleRate { - return fmt.Errorf("sample rate is not the same, expected %d, got %d", startSampleRate, m.miniseedBuffer[i].SampleRate) + if !m.legacyMode { + for i := 1; i < len(m.miniseedBuffer); i++ { + if m.miniseedBuffer[i].SampleRate != startSampleRate { + return fmt.Errorf("sample rate is not the same, expected %d, got %d", startSampleRate, m.miniseedBuffer[i].SampleRate) + } } }