Merge pull request #12383 from aabadie/pr/pkg/semtech-loramac_fix_us915
pkg/semtech-loramac: fix failed assertion in randr function
This commit is contained in:
commit
b7dfb6a26f
@ -1,4 +1,4 @@
|
|||||||
From 68f3239926462e04931b7bc71dc199ee776d37cb Mon Sep 17 00:00:00 2001
|
From 6a902f4c2406aa9bf3286bb73a8116953b21257a Mon Sep 17 00:00:00 2001
|
||||||
From: Alexandre Abadie <alexandre.abadie@inria.fr>
|
From: Alexandre Abadie <alexandre.abadie@inria.fr>
|
||||||
Date: Mon, 6 Aug 2018 15:46:40 +0200
|
Date: Mon, 6 Aug 2018 15:46:40 +0200
|
||||||
Subject: [PATCH] Applying: patch utilities functions
|
Subject: [PATCH] Applying: patch utilities functions
|
||||||
@ -9,7 +9,7 @@ Subject: [PATCH] Applying: patch utilities functions
|
|||||||
2 files changed, 6 insertions(+), 21 deletions(-)
|
2 files changed, 6 insertions(+), 21 deletions(-)
|
||||||
|
|
||||||
diff --git a/src/boards/mcu/utilities.c b/src/boards/mcu/utilities.c
|
diff --git a/src/boards/mcu/utilities.c b/src/boards/mcu/utilities.c
|
||||||
index d32d573..2d29f9d 100644
|
index d32d5735..be141100 100644
|
||||||
--- a/src/boards/mcu/utilities.c
|
--- a/src/boards/mcu/utilities.c
|
||||||
+++ b/src/boards/mcu/utilities.c
|
+++ b/src/boards/mcu/utilities.c
|
||||||
@@ -22,7 +22,9 @@
|
@@ -22,7 +22,9 @@
|
||||||
@ -34,7 +34,7 @@ index d32d573..2d29f9d 100644
|
|||||||
int32_t randr( int32_t min, int32_t max )
|
int32_t randr( int32_t min, int32_t max )
|
||||||
{
|
{
|
||||||
- return ( int32_t )rand1( ) % ( max - min + 1 ) + min;
|
- return ( int32_t )rand1( ) % ( max - min + 1 ) + min;
|
||||||
+ return (int32_t) (random_uint32_range(0, max - min) + min);
|
+ return (min == max) ? min : (int32_t) (random_uint32_range(0, max - min) + min);
|
||||||
}
|
}
|
||||||
|
|
||||||
void memcpy1( uint8_t *dst, const uint8_t *src, uint16_t size )
|
void memcpy1( uint8_t *dst, const uint8_t *src, uint16_t size )
|
||||||
@ -60,7 +60,7 @@ index d32d573..2d29f9d 100644
|
|||||||
|
|
||||||
int8_t Nibble2HexChar( uint8_t a )
|
int8_t Nibble2HexChar( uint8_t a )
|
||||||
diff --git a/src/boards/utilities.h b/src/boards/utilities.h
|
diff --git a/src/boards/utilities.h b/src/boards/utilities.h
|
||||||
index 8e0b028..9e226d4 100644
|
index 8e0b0284..9e226d4a 100644
|
||||||
--- a/src/boards/utilities.h
|
--- a/src/boards/utilities.h
|
||||||
+++ b/src/boards/utilities.h
|
+++ b/src/boards/utilities.h
|
||||||
@@ -25,17 +25,6 @@
|
@@ -25,17 +25,6 @@
|
||||||
@ -82,5 +82,5 @@ index 8e0b028..9e226d4 100644
|
|||||||
* \brief Returns the minimum value between a and b
|
* \brief Returns the minimum value between a and b
|
||||||
*
|
*
|
||||||
--
|
--
|
||||||
2.17.1
|
2.20.1
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user