]> www.vanbest.org Git - motioneye-debian/commitdiff
light switch detection option is now a slider (was a simple on/off
authorCalin Crisan <ccrisan@gmail.com>
Sun, 4 Oct 2015 14:08:25 +0000 (17:08 +0300)
committerCalin Crisan <ccrisan@gmail.com>
Sun, 4 Oct 2015 14:08:25 +0000 (17:08 +0300)
button)

motioneye/config.py
motioneye/static/js/main.js
motioneye/templates/main.html

index 1160554d96f792e5e48c6b23f1b3932dcf28f7d6..c17b5c9097387d903b23f6f6390e6b7d950ef6f5 100644 (file)
@@ -623,7 +623,7 @@ def motion_camera_ui_to_dict(ui, old_config=None):
         # device
         '@name': ui['name'],
         '@enabled': ui['enabled'],
-        'lightswitch': int(ui['light_switch_detect']) * 50,
+        'lightswitch': ui['light_switch_detect'],
         'auto_brightness': ui['auto_brightness'],
         'framerate': int(ui['framerate']),
         'rotate': int(ui['rotation']),
@@ -902,7 +902,7 @@ def motion_camera_dict_to_ui(data):
         'name': data['@name'],
         'enabled': data['@enabled'],
         'id': data['@id'],
-        'light_switch_detect': data['lightswitch'] > 0,
+        'light_switch_detect': data['lightswitch'],
         'auto_brightness': data['auto_brightness'],
         'framerate': int(data['framerate']),
         'rotation': int(data['rotate']),
index bd62fa070a7e647c7553ecfc94b481cfacc9be87..0fe6ca794aaf1568b968175a96a27129127e9b47 100644 (file)
@@ -1249,7 +1249,7 @@ function cameraUi2Dict() {
         'proto': $('#deviceTypeEntry')[0].proto,
         
         /* video device */
-        'light_switch_detect': $('#lightSwitchDetectSwitch')[0].checked,
+        'light_switch_detect': $('#lightSwitchDetectSlider').val(),
         'auto_brightness': $('#autoBrightnessSwitch')[0].checked,
         'rotation': $('#rotationSelect').val(),
         'framerate': $('#framerateSlider').val(),
@@ -1477,7 +1477,7 @@ function dict2CameraUi(dict) {
     $('#deviceUrlEntry').val(dict['device_url']); markHideIfNull('device_url', 'deviceUrlEntry');
     $('#deviceTypeEntry').val(prettyType); markHideIfNull(!prettyType, 'deviceTypeEntry');
     $('#deviceTypeEntry')[0].proto = dict['proto'];
-    $('#lightSwitchDetectSwitch')[0].checked = dict['light_switch_detect']; markHideIfNull('light_switch_detect', 'lightSwitchDetectSwitch');
+    $('#lightSwitchDetectSlider').val(dict['light_switch_detect']); markHideIfNull('light_switch_detect', 'lightSwitchDetectSlider');
     $('#autoBrightnessSwitch')[0].checked = dict['auto_brightness']; markHideIfNull('auto_brightness', 'autoBrightnessSwitch');
     
     $('#brightnessSlider').val(dict['brightness']); markHideIfNull('brightness', 'brightnessSlider');
index 1349c2d6528316ad777de570abaaa0b805d92752..4a7390e49d15d89fe21736ce4684876a587527ca 100644 (file)
                     <tr class="settings-item advanced-setting">
                         <td colspan="100"><div class="settings-item-separator"></div></td>
                     </tr>
-                    <tr class="settings-item advanced-setting">
-                        <td class="settings-item-label"><span class="settings-item-label">Light Switch Detection</span></td>
-                        <td class="settings-item-value"><input type="checkbox" class="styled device camera-config" id="lightSwitchDetectSwitch"></td>
-                        <td><span class="help-mark" title="enable this if you want sudden changes in light to not be treated as motion">?</span></td>
-                    </tr>
                     <tr class="settings-item advanced-setting">
                         <td class="settings-item-label"><span class="settings-item-label">Automatic Brightness</span></td>
                         <td class="settings-item-value"><input type="checkbox" class="styled device camera-config" id="autoBrightnessSwitch"></td>
                         <td><span class="help-mark" title="enables software automatic brightness (only recommended for cameras without autobrightness)">?</span></td>
                     </tr>
+                    <tr class="settings-item advanced-setting" min="0" max="100" snap="2" ticksnum="5" decimals="0" unit="%">
+                        <td class="settings-item-label"><span class="settings-item-label">Light Switch Detection</span></td>
+                        <td class="settings-item-value"><input type="text" class="range styled device camera-config" id="lightSwitchDetectSlider"></td>
+                        <td><span class="help-mark" title="sets the percentage of the image that needs to change so that the event is treated as a sudden light change instead of motion">?</span></td>
+                    </tr>
                     <tr class="settings-item advanced-setting" min="0" max="100" snap="2" ticksnum="5" decimals="0" unit="%">
                         <td class="settings-item-label"><span class="settings-item-label">Brightness</span></td>
                         <td class="settings-item-value"><input type="text" class="range styled device camera-config" id="brightnessSlider"></td>