la_mojo cameras: send EVT_CAMERA_ON_POSITION only when the move is done #12

Merged
ClaudeAI merged 1 commits from feature/cam-on-position-event into master 31 minutes ago
Collaborator

Summary

deviceNodePTZCamControl (AbsoluteMove) and deviceNodePresetCamControl (preset for the ROI) now send EVT_CAMERA_ON_POSITION (EVT_CLASS_CAMERA_CTRL, already defined in basicEvent.h) only after the camera has finished moving. Both node classes use the shared deviceNodeCamera state machine, so the changes are there. Both move types end in CAM_WS_WAIT_ONPOS, which waits for the end of the move and then broadcasts the event.

Changes

  • AbsoluteMove always waits. With video output enabled (m_bSkeepPositioningWait), the event used to be broadcast right after the AbsoluteMove command, before the camera moved. AbsoluteMove now always goes through CAM_WS_WAIT_ONPOS, like the preset path already did.
  • New flag m_bNoMoveDoneReport.
    • When it is set: waitMoveIsDone() returned false, meaning the protocol cannot report the end of a move.
    • What it does: from then on, every target-driven move waits a fixed CAM_MOVE_FIXED_WAIT_MS (3 s) before the event.
    • Why it is needed: before, the same failure set m_bSkeepPositioningWait, so every later AbsoluteMove broadcast the event immediately.
    • Reset: whenever the protocol is (re)created.
  • protocolPTZ_ONVIF::goPreset forgets the last AbsoluteMove target. Otherwise waitMoveIsDone() (from #11) could compare against an old target and end too early.

Not changed (on purpose)

These still move without sending the event, since only target-driven moves are in scope:

  • homing (CAM_WS_GO_HOMING_PRESET)
  • go-home at init
  • web, IR and wiper presets

Behaviour change on the device

  • Video output enabled: the camera thread now stays in CAM_WS_WAIT_ONPOS until an AbsoluteMove is done. Preset moves already worked this way. Snapshots taken on the event no longer show a moving picture.
  • Protocols without move-done reporting: each target-driven move waits 3 s. Before, only the first move waited and every later event was sent instantly.

Testing

  • Compile check: g++ -fsyntax-only with the la_mojo flags on the changed files and both control nodes. No errors, same warning count as before.
  • Not run: the state machine needs the database and a camera. On the device, check that EVT_CAMERA_ON_POSITION and the snapshot come after the camera stops, with and without video output.

Generated with Claude Code

https://claude.ai/code/session_0139veDo3XyavMuVhdnHcN16

## Summary `deviceNodePTZCamControl` (AbsoluteMove) and `deviceNodePresetCamControl` (preset for the ROI) now send `EVT_CAMERA_ON_POSITION` (`EVT_CLASS_CAMERA_CTRL`, already defined in `basicEvent.h`) only after the camera has finished moving. Both node classes use the shared `deviceNodeCamera` state machine, so the changes are there. Both move types end in `CAM_WS_WAIT_ONPOS`, which waits for the end of the move and then broadcasts the event. ## Changes - **AbsoluteMove always waits.** With video output enabled (`m_bSkeepPositioningWait`), the event used to be broadcast right after the AbsoluteMove command, before the camera moved. AbsoluteMove now always goes through `CAM_WS_WAIT_ONPOS`, like the preset path already did. - **New flag `m_bNoMoveDoneReport`.** - **When it is set:** `waitMoveIsDone()` returned false, meaning the protocol cannot report the end of a move. - **What it does:** from then on, every target-driven move waits a fixed `CAM_MOVE_FIXED_WAIT_MS` (3 s) before the event. - **Why it is needed:** before, the same failure set `m_bSkeepPositioningWait`, so every later AbsoluteMove broadcast the event immediately. - **Reset:** whenever the protocol is (re)created. - **`protocolPTZ_ONVIF::goPreset`** forgets the last AbsoluteMove target. Otherwise `waitMoveIsDone()` (from #11) could compare against an old target and end too early. ## Not changed (on purpose) These still move without sending the event, since only target-driven moves are in scope: - homing (`CAM_WS_GO_HOMING_PRESET`) - go-home at init - web, IR and wiper presets ## Behaviour change on the device - **Video output enabled:** the camera thread now stays in `CAM_WS_WAIT_ONPOS` until an AbsoluteMove is done. Preset moves already worked this way. Snapshots taken on the event no longer show a moving picture. - **Protocols without move-done reporting:** each target-driven move waits 3 s. Before, only the first move waited and every later event was sent instantly. ## Testing - **Compile check:** `g++ -fsyntax-only` with the la_mojo flags on the changed files and both control nodes. No errors, same warning count as before. - **Not run:** the state machine needs the database and a camera. On the device, check that `EVT_CAMERA_ON_POSITION` and the snapshot come after the camera stops, with and without video output. Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_0139veDo3XyavMuVhdnHcN16
ClaudeAI added 1 commit 33 minutes ago
7f1ce51cef
la_mojo cameras: send EVT_CAMERA_ON_POSITION only when the move is done
ClaudeAI merged commit 8e5bddcd0d into master 31 minutes ago
The pull request has been merged as 8e5bddcd0d.
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

This pull request currently doesn't have any dependencies.

Loading…
There is no content yet.