mirror of
https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks.git
synced 2025-09-09 15:40:45 +02:00
fix recovery of motion sensitivity after switching on/off
This commit is contained in:
@@ -6,9 +6,13 @@ if [ ! -f /system/sdcard/config/motion.conf ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f /system/sdcard/config/motion.conf ] ; then
|
if [ -f /system/sdcard/config/motion.conf ] ; then
|
||||||
source /system/sdcard/config/motion.conf 2>/dev/null
|
. /system/sdcard/config/motion.conf 2>/dev/null
|
||||||
/system/sdcard/bin/setconf -k r -v ${region_of_interest} 2>/dev/null
|
/system/sdcard/bin/setconf -k r -v ${region_of_interest} 2>/dev/null
|
||||||
/system/sdcard/bin/setconf -k m -v ${motion_sensitivity} 2>/dev/null
|
if [ "$motion_detection" = false ]; then
|
||||||
|
/system/sdcard/bin/setconf -k m -v -1 2>/dev/null
|
||||||
|
else
|
||||||
|
/system/sdcard/bin/setconf -k m -v ${motion_sensitivity} 2>/dev/null
|
||||||
|
fi
|
||||||
/system/sdcard/bin/setconf -k z -v ${motion_indicator_color} 2>/dev/null
|
/system/sdcard/bin/setconf -k z -v ${motion_indicator_color} 2>/dev/null
|
||||||
/system/sdcard/bin/setconf -k t -v ${motion_tracking} 2>/dev/null
|
/system/sdcard/bin/setconf -k t -v ${motion_tracking} 2>/dev/null
|
||||||
fi;
|
fi;
|
||||||
|
@@ -311,11 +311,11 @@ motion_detection(){
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
on)
|
on)
|
||||||
/system/sdcard/bin/setconf -k m -v $(get_config /system/sdcard/config/motion.conf motion_sensitivity)
|
/system/sdcard/bin/setconf -k m -v $(get_config /system/sdcard/config/motion.conf motion_sensitivity)
|
||||||
|
rewrite_config /system/sdcard/config/motion.conf motion_detection "on"
|
||||||
;;
|
;;
|
||||||
off)
|
off)
|
||||||
/system/sdcard/bin/setconf -k m -v -1
|
/system/sdcard/bin/setconf -k m -v -1
|
||||||
rewrite_config /system/sdcard/config/motion.conf motion_sensitivity "-1"
|
rewrite_config /system/sdcard/config/motion.conf motion_detection "off"
|
||||||
|
|
||||||
;;
|
;;
|
||||||
status)
|
status)
|
||||||
status=$(/system/sdcard/bin/setconf -g m 2>/dev/null)
|
status=$(/system/sdcard/bin/setconf -g m 2>/dev/null)
|
||||||
|
@@ -210,7 +210,7 @@ if [ -n "$F_cmd" ]; then
|
|||||||
echo "$timezone_name" > /system/sdcard/config/timezone.conf
|
echo "$timezone_name" > /system/sdcard/config/timezone.conf
|
||||||
# Set system timezone from timezone name
|
# Set system timezone from timezone name
|
||||||
set_timezone
|
set_timezone
|
||||||
fi
|
fi
|
||||||
|
|
||||||
hst=$(printf '%b' "${F_hostname//%/\\x}")
|
hst=$(printf '%b' "${F_hostname//%/\\x}")
|
||||||
if [ "$(cat /system/sdcard/config/hostname.conf)" != "$hst" ]; then
|
if [ "$(cat /system/sdcard/config/hostname.conf)" != "$hst" ]; then
|
||||||
@@ -314,19 +314,11 @@ if [ -n "$F_cmd" ]; then
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
motion_detection_on)
|
motion_detection_on)
|
||||||
motion_sensitivity=4
|
motion_detection on
|
||||||
if [ -f /system/sdcard/config/motion.conf ]; then
|
|
||||||
source /system/sdcard/config/motion.conf
|
|
||||||
fi
|
|
||||||
if [ $motion_sensitivity -eq -1 ]; then
|
|
||||||
motion_sensitivity=4
|
|
||||||
fi
|
|
||||||
/system/sdcard/bin/setconf -k m -v $motion_sensitivity
|
|
||||||
rewrite_config /system/sdcard/config/motion.conf motion_sensitivity $motion_sensitivity
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
motion_detection_off)
|
motion_detection_off)
|
||||||
/system/sdcard/bin/setconf -k m -v -1
|
motion_detection off
|
||||||
;;
|
;;
|
||||||
|
|
||||||
set_video_size)
|
set_video_size)
|
||||||
|
@@ -1,4 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
. /system/sdcard/scripts/common_functions.sh
|
||||||
|
|
||||||
echo "Content-type: application/json"
|
echo "Content-type: application/json"
|
||||||
echo "Pragma: no-cache"
|
echo "Pragma: no-cache"
|
||||||
echo "Cache-Control: max-age=0, no-store, no-cache"
|
echo "Cache-Control: max-age=0, no-store, no-cache"
|
||||||
@@ -49,6 +52,7 @@ fi
|
|||||||
|
|
||||||
echo "{\"motion_indicator_color\": ${motion_indicator_color},
|
echo "{\"motion_indicator_color\": ${motion_indicator_color},
|
||||||
\"motion_sensitivity\": ${motion_sensitivity},
|
\"motion_sensitivity\": ${motion_sensitivity},
|
||||||
|
\"motion_detection\": ${motion_detection status},
|
||||||
\"region_of_interest\": [${region_of_interest}],
|
\"region_of_interest\": [${region_of_interest}],
|
||||||
\"motion_tracking\": ${motion_tracking},
|
\"motion_tracking\": ${motion_tracking},
|
||||||
\"motion_timeout\": ${motion_timeout},
|
\"motion_timeout\": ${motion_timeout},
|
||||||
|
@@ -27,11 +27,19 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="label">Set sensitivity or deactivate</label>
|
<label class="label">Toggle motion detection</label>
|
||||||
|
<div class="control">
|
||||||
|
<div class="checkbox">
|
||||||
|
<input type="checkbox" name="motion_detection" id="motion_detection"> Enable motion detection
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label class="label">Set sensitivity</label>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<div class="select">
|
<div class="select">
|
||||||
<select name="motion_sensitivity" id="motion_sensitivity">
|
<select name="motion_sensitivity" id="motion_sensitivity">
|
||||||
<option value="-1">Deactivated</option>
|
|
||||||
<option value="0">Very Low</option>
|
<option value="0">Very Low</option>
|
||||||
<option value="1">Low</option>
|
<option value="1">Low</option>
|
||||||
<option value="2">Moderate</option>
|
<option value="2">Moderate</option>
|
||||||
@@ -230,6 +238,7 @@
|
|||||||
$('#restart_server').val(0);
|
$('#restart_server').val(0);
|
||||||
$('#motion_indicator_color').val(motionInfo.motion_indicator_color).change();
|
$('#motion_indicator_color').val(motionInfo.motion_indicator_color).change();
|
||||||
$('#motion_sensitivity').val(motionInfo.motion_sensitivity).change();
|
$('#motion_sensitivity').val(motionInfo.motion_sensitivity).change();
|
||||||
|
$('#motion_detection').prop('checked', motionInfo.motion_detection);
|
||||||
$('#motion_tracking').prop('checked', motionInfo.motion_tracking);
|
$('#motion_tracking').prop('checked', motionInfo.motion_tracking);
|
||||||
$('#motion_timeout').val(motionInfo.motion_timeout).change();
|
$('#motion_timeout').val(motionInfo.motion_timeout).change();
|
||||||
setTracking($('#motion_tracking')[0], true);
|
setTracking($('#motion_tracking')[0], true);
|
||||||
@@ -243,6 +252,9 @@
|
|||||||
if ($('#motion_tracking').prop('checked')) {
|
if ($('#motion_tracking').prop('checked')) {
|
||||||
motion_tracking = 'true';
|
motion_tracking = 'true';
|
||||||
}
|
}
|
||||||
|
if ($('#motion_detection').prop('checked')) {
|
||||||
|
motion_detection = 'true';
|
||||||
|
}
|
||||||
var formData = {
|
var formData = {
|
||||||
'x0': $('input[name=x0]').val(),
|
'x0': $('input[name=x0]').val(),
|
||||||
'y0': $('input[name=y0]').val(),
|
'y0': $('input[name=y0]').val(),
|
||||||
@@ -252,6 +264,7 @@
|
|||||||
'motion_sensitivity': $('select[name=motion_sensitivity]').val(),
|
'motion_sensitivity': $('select[name=motion_sensitivity]').val(),
|
||||||
'motion_indicator_color': $('select[name=motion_indicator_color]').val(),
|
'motion_indicator_color': $('select[name=motion_indicator_color]').val(),
|
||||||
'motion_tracking': motion_tracking,
|
'motion_tracking': motion_tracking,
|
||||||
|
'motion_detection': motion_detection,
|
||||||
'motion_timeout': $('input[name=motion_timeout]').val()
|
'motion_timeout': $('input[name=motion_timeout]').val()
|
||||||
};
|
};
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
Reference in New Issue
Block a user