Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add alarm reference image blend percentage option and replace the text field if fast blends are enabled #241

Merged
merged 4 commits into from
Dec 13, 2013

Conversation

mastertheknife
Copy link
Contributor

In order to improve ZoneMinder's already great motion detection system, i find it necessary to have the ability to use a different reference image blend percent for an alarm state.
This pull request adds such option, as can be seen in the screenshot below.
This option is very useful for controlling how long an alarm lasts. For example, If i set it to not blend and stand in front of my camera, the alarm will last forever, until i move out of the camera's way. If i try again, this time with 50%, the alarm will last only a moment. I have chosen 3.125% as a default because it seems optimal according to my tests.
If anyone is looking for the behaviour of ZM without this option, simply set it identical to your non-alarm reference blend percent.

Something else this pull request does is replace the text field with a dropdown list if fast blends are enabled. Fast blend does not use division, but rather bit shifting, so only few values are possible and other values simply get rounded to the closest one. By using a dropdown list when fast blends are enabled, we make it easier for the user to select a reference image blend percent.

Currently, i am missing the code to alter the database to add the new field. Not sure how to tackle this one yet. I thought of creating a zm_update-1.26.4 file for ZM 1.26.5, but this will require us to change version numbers now to 1.26.5.
The SQL statement to alter the Monitors table:

ALTER TABLE `Monitors` ADD `AlarmRefBlendPerc` TINYINT(3) UNSIGNED NOT NULL DEFAULT '3' AFTER `RefBlendPerc`;

Screenshot of the proposed change

@mastertheknife
Copy link
Contributor Author

Any objections?

kylejohnson added a commit that referenced this pull request Dec 13, 2013
Add alarm reference image blend percentage option and replace the text field if fast blends are enabled
@kylejohnson kylejohnson merged commit f39f2fa into master Dec 13, 2013
@knight-of-ni
Copy link
Member

Heads up. This pull request creates an issue with the recently released zoneminder 1.26.5. zmupdate doesn't have the SQL code necessary to make the change in this pull request seamless for normal users. Users will need to be warned they will have to update their Monitors table manually by using the ALTER table command shown above.

@mastertheknife
Copy link
Contributor Author

Are you sure? iconnor told me it searches for the update files automatically since v1.26
Also, I wanted today to add another SQL statement. An UPDATE one to set its value to copy whatever the normal reference image blend percent is, in order to make updating to v1.26.5 smooth for the users by not requiring any monitor reconfig. Sadly, I wasn't home in time to do this before v1.26.5 was released.

@knight-of-ni
Copy link
Member

I think so. After building & installing the new rpm on my demo box, I ran sudo zmupdate.pl. It detected a 1.26.4 dB and upgraded it to 1.26.5. After starting zoneminder, my logs filled with errors about the missing column. Manually adding the column fixed it. Can you try on your end? I'll double check on my end as well.

@knight-of-ni
Copy link
Member

Found the problem. Makefile.am needs to be updated for the new zm_update-1.26.5.sql file. I have not tried cmake just autotools.

Update: found a way to glob all the sql files automatically like cmake does so we don't run into this again. See pull request #269

@mastertheknife
Copy link
Contributor Author

Only when I get home. I think it's not a good idea to update the version number and release right away. We need a day or two to spot upgrade issues after upping the version number.

@knight-of-ni
Copy link
Member

Linking to pull request #269

@mastertheknife mastertheknife deleted the alarmrefblendoption branch December 14, 2013 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants