From 1518046188a582a190832afd1bba78b792fd4526 Mon Sep 17 00:00:00 2001 From: Esa Tikka Date: Sat, 7 Dec 2024 16:10:38 +0200 Subject: [PATCH 1/2] Fix rounding issue when reading config parameter value --- motioneye/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/motioneye/config.py b/motioneye/config.py index 7feafd7ca..52e08d4c4 100644 --- a/motioneye/config.py +++ b/motioneye/config.py @@ -1384,7 +1384,7 @@ def motion_camera_dict_to_ui(data): 'auto_noise_detect': data['noise_tune'], 'max_frame_change_threshold': data['threshold_maximum'], 'auto_threshold_tuning': data['threshold_tune'], - 'noise_level': int(int(data['noise_level']) / 2.55), + 'noise_level': round(int(data['noise_level']) / 2.55), 'light_switch_detect': data['lightswitch_percent'], 'despeckle_filter': data['despeckle_filter'], 'event_gap': int(data['event_gap']), From 6f5768ff03ea22aefd0fc0341d61d163fa9b5e6e Mon Sep 17 00:00:00 2001 From: MichaIng Date: Mon, 9 Dec 2024 00:00:19 +0100 Subject: [PATCH 2/2] enh: remove unnecessary integer conversions round() produces an integer already, if no explicit number of decimal places passed as 2nd parameter. Wrapping it into another int() is hence unnecessary. Signed-off-by: MichaIng --- motioneye/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/motioneye/config.py b/motioneye/config.py index 52e08d4c4..2b53d018c 100644 --- a/motioneye/config.py +++ b/motioneye/config.py @@ -915,7 +915,7 @@ def motion_camera_ui_to_dict(ui, prev_config=None): 'threshold_maximum': ui['max_frame_change_threshold'], 'threshold_tune': ui['auto_threshold_tuning'], 'noise_tune': ui['auto_noise_detect'], - 'noise_level': max(1, int(round(int(ui['noise_level']) * 2.55))), + 'noise_level': max(1, round(int(ui['noise_level']) * 2.55)), 'lightswitch_percent': ui['light_switch_detect'], 'event_gap': int(ui['event_gap']), 'pre_capture': int(ui['pre_capture']),