Skip to content

Commit

Permalink
NR strength: limit range to 1 - 100 and step = 2
Browse files Browse the repository at this point in the history
  • Loading branch information
DD4WH committed Feb 4, 2018
1 parent a99fc25 commit c1cdee6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion mchf-eclipse/drivers/audio/audio_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1362,7 +1362,7 @@ void AudioDriver_SetRxAudioProcessing(uint8_t dmod_mode, bool reset_dsp_nr)
// convert user setting of noise reduction to alpha NR parameter
// alpha ranges from 0.9 to 0.999 [float32_t]
// dsp_nr_strength is from 0 to 100 [uint8_t]
ts.nr_alpha = 0.9 + ((float32_t)ts.dsp_nr_strength / 1000.0);
ts.nr_alpha = 0.899 + ((float32_t)ts.dsp_nr_strength / 1000.0);

// NEW AUTONOTCH
// set to passthrough
Expand Down
4 changes: 2 additions & 2 deletions mchf-eclipse/drivers/audio/audio_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,8 @@ enum {
#define RX_DECIMATION_RATE_24KHZ 2 // Decimation/Interpolation rate in receive function for 24 kHz sample rate
#define RX_DECIMATION_RATE_48KHZ 1 // Deimcation/Interpolation rate in receive function for 48 kHz sample rate (e.g. no decimation!)

#define DSP_NR_STRENGTH_MAX 99 // Maximum menu setting for DSP "Strength"
#define DSP_NR_STRENGTH_DEFAULT 50 // Default setting
#define DSP_NR_STRENGTH_MAX 100 // Maximum menu setting for DSP "Strength"
#define DSP_NR_STRENGTH_DEFAULT 60 // Default setting
#ifdef OBSOLETE_NR
//
// ************
Expand Down
4 changes: 2 additions & 2 deletions mchf-eclipse/drivers/ui/menu/ui_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -784,10 +784,10 @@ void UiMenu_UpdateItem(uint16_t select, uint16_t mode, int pos, int var, char* o
case MENU_DSP_NR_STRENGTH: // DSP Noise reduction strength

var_change = UiDriverMenuItemChangeUInt8(var, mode, &ts.dsp_nr_strength,
0,
1,
DSP_NR_STRENGTH_MAX,
DSP_NR_STRENGTH_DEFAULT,
1
2
);
if(var_change)
{
Expand Down
4 changes: 2 additions & 2 deletions mchf-eclipse/drivers/ui/ui_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -3438,12 +3438,12 @@ static void UiDriver_CheckEncoderTwo()
case ENC_TWO_MODE_NR:
if (is_dsp_nr()) // only allow adjustment if DSP NR is active
{
ts.dsp_nr_strength = change_and_limit_uint(ts.dsp_nr_strength,pot_diff_step,0,DSP_NR_STRENGTH_MAX);
ts.dsp_nr_strength = change_and_limit_uint(ts.dsp_nr_strength,pot_diff_step * 2,1,DSP_NR_STRENGTH_MAX);

// this causes considerable noise
//AudioDriver_SetRxAudioProcessing(ts.dmod_mode, false);
// we do this instead
ts.nr_alpha = 0.9 + ((float32_t)ts.dsp_nr_strength / 1000.0);
ts.nr_alpha = 0.899 + ((float32_t)ts.dsp_nr_strength / 1000.0);
}
// Signal processor setting
UiDriver_DisplayDSPMode(1);
Expand Down

0 comments on commit c1cdee6

Please sign in to comment.