Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix coding of the "Margin" field of the "DevStatusAns" command payload #131

Merged
merged 9 commits into from
Sep 27, 2018
4 changes: 2 additions & 2 deletions src/lmic/lmic.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Copyright (c) 2016-2018 MCCI Corporation.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
Expand Down Expand Up @@ -840,7 +840,7 @@ static bit_t decodeFrame (void) {

// Process OPTS
int m = LMIC.rssi - RSSI_OFF - getSensitivity(LMIC.rps);
LMIC.margin = m < 0 ? 0 : m > 254 ? 254 : m;
LMIC.margin = m < 0 ? 0 : m > 31 ? 31 : m;
terrillmoore marked this conversation as resolved.
Show resolved Hide resolved

#if LMIC_DEBUG_LEVEL > 0
LMIC_DEBUG_PRINTF("%lu: process options (olen=%#x)\n", os_getTime(), olen);
Expand Down