Skip to content

Commit 4cf7fdf

Browse files
author
Jarkko Paso
committed
FHSS: fixed tr51 channel table size
1 parent a1d8b3d commit 4cf7fdf

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

source/Service_Libs/fhss/channel_functions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
static uint32_t global_seed = 1;
4343

4444

45-
static uint16_t tr51_calc_nearest_prime_number(uint16_t start_value)
45+
uint16_t tr51_calc_nearest_prime_number(uint16_t start_value)
4646
{
4747
if (start_value < 2) {
4848
return 0;

source/Service_Libs/fhss/channel_functions.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#ifndef CHANNEL_FUNC_H_
1818
#define CHANNEL_FUNC_H_
1919

20+
uint16_t tr51_calc_nearest_prime_number(uint16_t start_value);
21+
2022
/**
2123
* @brief Initialize channel table for TR51 channel function.
2224
* @param channel_table Channel table to be initialized.

source/Service_Libs/fhss/fhss_ws.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ static int fhss_ws_manage_channel_table_allocation(fhss_structure_t *fhss_struct
114114
{
115115
// Must allocate channel table for TR51
116116
if (!fhss_structure->ws->tr51_channel_table && !fhss_structure->ws->tr51_output_table) {
117-
fhss_structure->ws->tr51_channel_table = ns_dyn_mem_alloc(sizeof(int16_t)*channel_count);
117+
fhss_structure->ws->tr51_channel_table = ns_dyn_mem_alloc(sizeof(int16_t)*tr51_calc_nearest_prime_number(channel_count));
118118
if (!fhss_structure->ws->tr51_channel_table) {
119119
return -1;
120120
}

0 commit comments

Comments
 (0)