From 5eeca7e8f0797c475870b2ff2f9a01bc0e2eb1f2 Mon Sep 17 00:00:00 2001 From: dernasherbrezon Date: Fri, 10 Nov 2023 20:31:02 +0000 Subject: [PATCH] freq error can be float --- src/main/java/ru/r2cloud/lora/r2lora/R2loraClient.java | 2 +- src/test/resources/r2loratest/successStop.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/ru/r2cloud/lora/r2lora/R2loraClient.java b/src/main/java/ru/r2cloud/lora/r2lora/R2loraClient.java index 45155992..0559a6f9 100644 --- a/src/main/java/ru/r2cloud/lora/r2lora/R2loraClient.java +++ b/src/main/java/ru/r2cloud/lora/r2lora/R2loraClient.java @@ -177,7 +177,7 @@ private static LoraFrame readFrame(JsonValue val) { JsonObject obj = val.asObject(); LoraFrame result = new LoraFrame(); result.setData(Util.hexStringToByteArray(obj.getString("data", null))); - result.setFrequencyError(obj.getLong("frequencyError", 0)); + result.setFrequencyError((long) obj.getFloat("frequencyError", 0)); result.setRssi((short) obj.getInt("rssi", 0)); result.setSnr(obj.getFloat("snr", 0)); result.setTimestamp(obj.getLong("timestamp", 0)); diff --git a/src/test/resources/r2loratest/successStop.json b/src/test/resources/r2loratest/successStop.json index 888cdc00..c3aa21ea 100644 --- a/src/test/resources/r2loratest/successStop.json +++ b/src/test/resources/r2loratest/successStop.json @@ -5,7 +5,7 @@ "data": "CAFE", "rssi": -121, "snr": -5.75, - "frequencyError": -729, + "frequencyError": -729.23, "timestamp": 1641987504 } ]