From e284c8cf7fc0c4d66eeabd26d5e0b02ecd9ffd11 Mon Sep 17 00:00:00 2001 From: "IoTThinks.com" Date: Sun, 14 Aug 2022 18:25:58 +0700 Subject: [PATCH] To fix precision for frequency To fix precision for frequency https://github.com/things4u/ESP-1ch-Gateway/pull/72 --- src/_txRx.ino | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/_txRx.ino b/src/_txRx.ino index 513b232..dd3420c 100644 --- a/src/_txRx.ino +++ b/src/_txRx.ino @@ -654,7 +654,11 @@ int buildPacket(uint8_t *buff_up, struct LoraUp *LoraUp, bool internal) #else // _JSONENCODE undefined, this is default // --------------------------------------- - ftoa((double)freqs[gwayConfig.ch].upFreq / 1000000, cfreq, 6); // XXX This can be done better + // Fixed wrong frequency (json) & upload for TTN V3 and ChirpStack + // https://github.com/things4u/ESP-1ch-Gateway/pull/72 + // ftoa((double)freqs[gwayConfig.ch].upFreq / 1000000, cfreq, 6); // XXX This can be done better + dtostrf((double)freqs[gwayConfig.ch].upFreq / 1000000, 6, 3, cfreq); + if ((LoraUp->sf<6) || (LoraUp->sf>12)) { // Lora datarate & bandwidth SF6-SF12, 16-19 useful chars */ LoraUp->sf=7; }