From 79e0718e05c12f55c98608192de791ada2dde892 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Fri, 1 Nov 2024 08:13:52 +0100 Subject: [PATCH] Update DOCS.md --- birdnet-pi/DOCS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/birdnet-pi/DOCS.md b/birdnet-pi/DOCS.md index 379d18170..95f963001 100644 --- a/birdnet-pi/DOCS.md +++ b/birdnet-pi/DOCS.md @@ -759,14 +759,14 @@ def main(): # Adjust gain based on noise trend if threshold count is reached if TREND_COUNT >= TREND_COUNT_THRESHOLD: - if CURRENT_TREND == 1: + if CURRENT_TREND == 1 and int(current_gain_db) >= MAX_GAIN_DB: # Decrease gain by DECREASE_GAIN_STEP_DB dB NEW_GAIN_DB = max(current_gain_db - DECREASE_GAIN_STEP_DB, MIN_GAIN_DB) if set_gain_db(MICROPHONE_NAME, NEW_GAIN_DB): print(f"Background noise high. Decreased gain to {NEW_GAIN_DB} dB") debug_print(f"Gain decreased to {NEW_GAIN_DB} dB due to high noise.", "info") TREND_COUNT = 0 - elif CURRENT_TREND == -1: + elif CURRENT_TREND == -1 and int(current_gain_db) < MAX_GAIN_DB: # Increase gain by INCREASE_GAIN_STEP_DB dB NEW_GAIN_DB = min(current_gain_db + INCREASE_GAIN_STEP_DB, MAX_GAIN_DB) if set_gain_db(MICROPHONE_NAME, NEW_GAIN_DB):