float64全部改float32
This commit is contained in:
@@ -298,7 +298,7 @@ func (c *ChirpStackListener) handleUpEvent(ctx context.Context, event *UpEvent)
|
||||
valueDescriptor := valueDescriptors[0]
|
||||
|
||||
// 5.3 应用乘数和偏移量计算最终值
|
||||
parsedValue := float64(rawSensorValue)*valueDescriptor.Multiplier + valueDescriptor.Offset
|
||||
parsedValue := rawSensorValue*valueDescriptor.Multiplier + valueDescriptor.Offset
|
||||
|
||||
// 5.4 根据传感器类型构建具体的数据结构
|
||||
var dataToRecord interface{}
|
||||
@@ -312,7 +312,7 @@ func (c *ChirpStackListener) handleUpEvent(ctx context.Context, event *UpEvent)
|
||||
default:
|
||||
// TODO 未知传感器的数据需要记录吗
|
||||
logger.Warnf("未知的传感器类型 '%s',将使用通用格式记录", valueDescriptor.Type)
|
||||
dataToRecord = map[string]float64{"value": parsedValue}
|
||||
dataToRecord = map[string]float32{"value": parsedValue}
|
||||
}
|
||||
|
||||
// 5.5 记录传感器数据
|
||||
|
||||
Reference in New Issue
Block a user