From 0a7ada426049a95d1ae7a6134ca9cfd1cd47d777 Mon Sep 17 00:00:00 2001 From: Dave Akerman Date: Sun, 7 Mar 2021 13:37:21 +0000 Subject: [PATCH] V1.8.43 - Fixed bug in implicit/explicit setting when used with HAB Base --- README.md | 5 +++++ config.c | 2 +- gateway.c | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c02404b..0c90220 100644 --- a/README.md +++ b/README.md @@ -250,6 +250,11 @@ Many thanks to David Brooke for coding this feature and the AFC. Change History ============== +07/03/2021 - V1.8.43 +-------------------- + + Fixed erors in setting implicit/explicit bit on config register when sent from JSON client. Thanks to Alan Hall for spotting this one. + 23/02/2021 - V1.8.42 -------------------- diff --git a/config.c b/config.c index a214f19..077f6aa 100644 --- a/config.c +++ b/config.c @@ -356,7 +356,7 @@ void SetConfigValue(char *Setting, char *Value) break; case stBoolean: - *Settings[SettingIndex].IntValuePtr = Value[strcspn(Value, "1YyTt")]; + *Settings[SettingIndex].IntValuePtr = (*Value == '1') || (*Value == 'Y') || (*Value == 'y') || (*Value == 't') || (*Value == 'T'); break; case stNone: diff --git a/gateway.c b/gateway.c index 7b7b2d5..28c5f82 100644 --- a/gateway.c +++ b/gateway.c @@ -46,7 +46,7 @@ #include "udpclient.h" #include "lifo_buffer.h" -#define VERSION "V1.8.42" +#define VERSION "V1.8.43" bool run = TRUE; // RFM98 @@ -573,7 +573,7 @@ int LowOptToInt(int LowOpt) void SetLoRaParameters( int Channel, int ImplicitOrExplicit, int ErrorCoding, double Bandwidth, int SpreadingFactor, int LowDataRateOptimize ) { - writeRegister( Channel, REG_MODEM_CONFIG, ImplicitOrExplicit | IntToEC(ErrorCoding) | DoubleToBandwidth(Bandwidth)); + writeRegister( Channel, REG_MODEM_CONFIG, (ImplicitOrExplicit ? IMPLICIT_MODE : EXPLICIT_MODE) | IntToEC(ErrorCoding) | DoubleToBandwidth(Bandwidth)); writeRegister( Channel, REG_MODEM_CONFIG2, IntToSF(SpreadingFactor) | CRC_ON ); writeRegister( Channel, REG_MODEM_CONFIG3, 0x04 | IntToLowOpt(LowDataRateOptimize)); // 0x04: AGC sets LNA gain writeRegister( Channel, REG_DETECT_OPT, ( readRegister( Channel, REG_DETECT_OPT ) & 0xF8 ) | ( ( SpreadingFactor == 6 ) ? 0x05 : 0x03 ) ); // 0x05 For SF6; 0x03 otherwise