Skip to content

Commit 2930b50

Browse files
committed
Fix stats Hz to kHz conversion for Concentratord backend.
1 parent 3c674f5 commit 2930b50

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

internal/backend/concentratord/concentratord.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ func (b *Backend) handleUplinkFrame(bb []byte) error {
362362
return nil
363363
}
364364

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

392+
// Hz to kHz
393+
for i := range pl.RxPacketsPerModulation {
394+
if mod := pl.RxPacketsPerModulation[i].GetModulation(); mod != nil {
395+
if lora := mod.GetLora(); lora != nil {
396+
lora.Bandwidth = lora.Bandwidth / 1000
397+
}
398+
}
399+
}
400+
401+
// Hz to kHz
402+
for i := range pl.TxPacketsPerModulation {
403+
if mod := pl.TxPacketsPerModulation[i].GetModulation(); mod != nil {
404+
if lora := mod.GetLora(); lora != nil {
405+
lora.Bandwidth = lora.Bandwidth / 1000
406+
}
407+
}
408+
}
409+
391410
log.WithFields(log.Fields{
392411
"stats_id": statsID,
393412
}).Info("backend/concentratord: stats event received")

0 commit comments

Comments
 (0)