read event fires twice. #6

Closed
YemSalat opened this Issue May 26, 2014 · 4 comments

Comments

Projects
None yet
4 participants

Somewhy the 'read' function is fired multiple times. It will fire for eevery photo that has been taken, so every new photo increases the number of times 'read will be called'

YemSalat closed this May 26, 2014

YemSalat reopened this May 26, 2014

opt/vc/bin/raspistill --output /home/pi/cameraTest/public/uploads/test.jpg --width 640 --height 480
STARTED!
raspicam::watcher::event rename
null
debug - websocket writing 5:::{"name":"done","args":[{"image":"/public/uploads/test.jpg"}]}
FINISHED!
raspicam::watcher::event change
raspicam::watcher::event change
raspicam::watcher::event change
raspicam::watcher::event rename
null
debug - websocket writing 5:::{"name":"done","args":[{"image":"/public/uploads/test.jpg"}]}
FINISHED!
raspicam::watcher::event rename
null
debug - websocket writing 5:::{"name":"done","args":[{"image":"/public/uploads/test.jpg"}]}
FINISHED!

Contributor

markelarizaga commented Oct 7, 2014

In my case, when I call camera.start() I receive 3 read events and 3 rename events on the following order:
Starting watch directory
Watcher is : null
Watching /home/pi/RaspberryCamera/photos/
calling....
/opt/vc/bin/raspistill --output /home/pi/RaspberryCamera/photos/1412713679288.jpg --width 640 --height 480
raspicam::watcher::event rename
raspicam::watcher::event change
raspicam::watcher::event change
raspicam::watcher::event change
raspicam::watcher::event rename
raspicam::watcher::event rename

This means the first time the rename is received RaspiCam sends the 'read' event and this is the event I use to stop the camera. The problem is that the picture is not properly saved so the shot is invalid. I changed RaspiCam code to wait for 3 rename events before emiting the 'read' event and this fixed the problem.

However, as I don't fully understand why those events are fired repeatedly, I'm not sure this workaround is valid or not. Any clue?

lawleo commented Nov 4, 2014

I'm using raspberry pi b+
Linux pi 3.12.31+ #720 PREEMPT Sat Nov 1 13:15:06 GMT 2014 armv6l GNU/Linux
node v0.10.28

I'm new to node, I try to run the example by node photo.js, it keep taking photo and won't stop, any one got this problem?

calling....
/opt/vc/bin/raspistill --output ./photo/image.jpg --encoding jpg --timeout 0 --width 640 --height 480
raspicam::watcher::event rename
photo image captured with filename: image.jpg~
raspicam::watcher::event change
raspicam::watcher::event change
raspicam::watcher::event change
raspicam::watcher::event rename
photo image captured with filename: image.jpg~
raspicam::watcher::event rename
photo image captured with filename: image.jpg
raspicam::watcher::event rename
photo image captured with filename: image.jpg~
raspicam::watcher::event change
raspicam::watcher::event change
raspicam::watcher::event change
raspicam::watcher::event rename
photo image captured with filename: image.jpg~
raspicam::watcher::event rename
photo image captured with filename: image.jpg
raspicam::watcher::event rename
photo image captured with filename: image.jpg~
raspicam::watcher::event change
raspicam::watcher::event change
raspicam::watcher::event change
raspicam::watcher::event rename
photo image captured with filename: image.jpg~
raspicam::watcher::event rename
photo image captured with filename: image.jpg
raspicam::watcher::event rename

Owner

troyth commented Jan 25, 2015

@dsteinborn's update should have fixed this. Closing now, let me know if not.

troyth closed this Jan 25, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment