Skip to content

Commit

Permalink
Fix stats Hz to kHz conversion for Concentratord backend.
Browse files Browse the repository at this point in the history
  • Loading branch information
brocaar committed Aug 31, 2021
1 parent 3c674f5 commit 2930b50
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions internal/backend/concentratord/concentratord.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ func (b *Backend) handleUplinkFrame(bb []byte) error {
return nil
}

// Hz to kHz
loRaModInfo := pl.GetTxInfo().GetLoraModulationInfo()
if loRaModInfo != nil {
loRaModInfo.Bandwidth = loRaModInfo.Bandwidth / 1000
Expand All @@ -388,6 +389,24 @@ func (b *Backend) handleGatewayStats(bb []byte) error {
var statsID uuid.UUID
copy(statsID[:], pl.GetStatsId())

// Hz to kHz
for i := range pl.RxPacketsPerModulation {
if mod := pl.RxPacketsPerModulation[i].GetModulation(); mod != nil {
if lora := mod.GetLora(); lora != nil {
lora.Bandwidth = lora.Bandwidth / 1000
}
}
}

// Hz to kHz
for i := range pl.TxPacketsPerModulation {
if mod := pl.TxPacketsPerModulation[i].GetModulation(); mod != nil {
if lora := mod.GetLora(); lora != nil {
lora.Bandwidth = lora.Bandwidth / 1000
}
}
}

log.WithFields(log.Fields{
"stats_id": statsID,
}).Info("backend/concentratord: stats event received")
Expand Down

0 comments on commit 2930b50

Please sign in to comment.