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

"Go to Presets" error #184

Open
renegade304 opened this issue Jan 25, 2025 · 7 comments · May be fixed by #189
Open

"Go to Presets" error #184

renegade304 opened this issue Jan 25, 2025 · 7 comments · May be fixed by #189

Comments

@renegade304
Copy link

The "Go to Presets" command does not work on positions 0 - 9, even though they are saved. Preset numbers 10 - 14 work correctly.

@roleoroleo
Copy link
Owner

10-14 are predefined presets.
Check if your presets are properly saved:
cat /mnt/mmc/sonoff-hack/etc/ptz_presets.conf

@renegade304
Copy link
Author

The file content looks like this:

0=Start|2364|-102
1=OK|2329|-182
2=Domka|2632|-182
3=Nelka|2053|-412
4=empty|-1|-1
5=empty|-1|-1
6=empty|-1|-1
7=empty|-1|-1
8=empty|-1|-1
9=empty|-1|-1

@roleoroleo
Copy link
Owner

Mmmmh
Negative numbers are not allowed.
ptz binary discards them.
Please try to set presets again.

@renegade304
Copy link
Author

I tried - it was saved as a negative number again.
When I manually deleted the minus - the preset location setting worked.
It looks like an error while saving the preset.

@roleoroleo
Copy link
Owner

When the camera starts up, does it do a full pan and tilt?

@flreinhard
Copy link
Contributor

I think, there's a bug in ptz.c

if (x < MIN_X) x = MIN_X;
if (x > MAX_X) x = MAX_X;
if (y < MIN_Y) y = MIN_Y;
if (y < MAX_Y) y = MAX_Y;
x = preset_buffer[3];
y = preset_buffer[4];

I think it should be

        x = preset_buffer[3];
        y = preset_buffer[4];
        if (x < MIN_X) x = MIN_X;
        if (x > MAX_X) x = MAX_X;
        if (y < MIN_Y) y = MIN_Y;
        if (y < MAX_Y) y = MAX_Y;

otherwise your limits to min(0) and max won't work.

@roleoroleo: why do you limit to 0 when /dev/ptz delivers negative numbers?

flreinhard added a commit to flreinhard/sonoff-hack that referenced this issue Mar 2, 2025
@flreinhard flreinhard linked a pull request Mar 2, 2025 that will close this issue
@flreinhard
Copy link
Contributor

flreinhard commented Mar 2, 2025

@renegade304 you could give my changes a try. you can download a file at the bottom here: https://github.com/roleoroleo/sonoff-hack/actions/runs/13616982538

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 a pull request may close this issue.

3 participants