From f0c48c55ca2ca3058f0b50119beae4a083ea4e0a Mon Sep 17 00:00:00 2001 From: Niclas Finne Date: Sun, 13 Apr 2014 21:33:50 +0200 Subject: [PATCH] Fixed STM32W radio to return RADIO_RESULT_INVALID_VALUE if trying to set a transmission power outside the valid range instead of using closest valid value. --- cpu/stm32w108/dev/stm32w-radio.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cpu/stm32w108/dev/stm32w-radio.c b/cpu/stm32w108/dev/stm32w-radio.c index 07fbf1758..4488b3a93 100644 --- a/cpu/stm32w108/dev/stm32w-radio.c +++ b/cpu/stm32w108/dev/stm32w-radio.c @@ -361,10 +361,8 @@ set_value(radio_param_t param, radio_value_t value) ST_RadioEnableAutoAck((value & RADIO_RX_MODE_AUTOACK) != 0); return RADIO_RESULT_OK; case RADIO_PARAM_TXPOWER: - if(value < MIN_RADIO_POWER) { - value = MIN_RADIO_POWER; - } else if(value > MAX_RADIO_POWER) { - value = MAX_RADIO_POWER; + if(value < MIN_RADIO_POWER || value > MAX_RADIO_POWER) { + return RADIO_RESULT_INVALID_VALUE; } if(ST_RadioSetPower((int8_t)value) != ST_SUCCESS) { return RADIO_RESULT_INVALID_VALUE;