Printer is driving me crazy - Script Writing - CHDK Forum supplierdeeply

Printer is driving me crazy

  • 2 Replies
  • 3444 Views
Printer is driving me crazy
« on: 02 / June / 2011, 18:30:08 »
Advertisements
OK...having very annoying issues with my "take a photo then print it automatically script."

Decided not to use enable USB to trigger since the printer is directly connected to the camera already via USB... probably gonna hardwire it instead. enable USB is OFF.

Done a ton of troubleshooting, and it seems like CHDK hangs the USB stream after shooting, locking up the little Polaroid Pogo Printer.

Here's the steps:

1. Starting in REC mode, it waits for any button to be pressed, then SHOOTS.
2. Switches to PLAY mode (printer is already attached, so the Print button is now lit)
3. Presses "SET" to enter Print menu
4. Presses "SET" to confirm Print, sending the current image (the one you just took) to the Printer.

Here's a simple, test code of the basic operation (you start the script in REC mode):

Code: [Select]
@title TEST

wait_click
shoot
sleep 4000
set_record 0
sleep 6000
click "set"
sleep 4000
click "set"
sleep 50000
end

It's working fine visually, going through the menus, etc. except instead of receiving data over the USB, the printer hangs and locks up.

Here's my troubleshooting:

1. Doing these above steps manually (not using the test script), also using the same timings, works perfectly.
2. Adding a "left" command after returning to the PLAY mode to select a previous image, DOESN'T WORK EITHER
3. Starting in REC, after Rem'ing out the wait & shoot command, works, causing the printer to simply print the last image in the pile
4. Starting in REC, Shooting first manually, then entering ALT, then running the test script with the wait & shoot commands rem'd out WORKS
4. Changing compression/resolution of images has no effect. Right now they are 640x480, normal compression

It seems like when CHDK invokes the shoot command, it hangs any further doings on the USB port.

Am I missing something? It's driving me nuts!

Thanks

*

Offline reyalp

  • ******
  • 14080
Re: Printer is driving me crazy
« Reply #1 on: 02 / June / 2011, 21:58:39 »
I suspect very few people use the direct print functionality, never mind trying to script it with CHDK, This means
1) You're probably on your own
2) There's a very good chance things are messed up somewhere

Shoot shouldn't do anything specifically to stop USB from working. We can shoot with USB connected to a computer PC no problem.

On dryos cameras you generally need to use switch_mode_usb() to/from record mode when USB is connected to a PC. I have now idea how that might affect DP.
Don't forget what the H stands for.

Re: Printer is driving me crazy
« Reply #2 on: 03 / June / 2011, 01:17:01 »
Finally figured it out what was jamming up the works... THANKS EVERYONE FOR THE HELP!

It was the SLEEP command after the SHOOT command. Apparently, you don't need it, and it causes problems down the line.

Also, I had to use the GERMAN version of CHDK to be able to turn on/off the "Enable USB Remote" feature. Otherwise, it wouldn't switch PLAY/REC modes with the printer permanently connected. Any chance of getting this in the EN build? Crazy useful!

I ended up hotwiring the DISPLAY button for my remote trigger, but as I discovered later (thank you MSL!!!) with the DE version of CHDK, and it's set_config_value function, I didn't have to. With that, I could probably have reworked the code to allow for a USB remote. Oh well... it's a bit more reliable this way I suppose and I don't have to rely on a power supply.

In case anyone was wondering why in the world I needed this functionality, it's for something called an "Iconograph" which is a fictional device in Terry Pratchett's Discworld novels. Basically, it's a medieval magical camera. You press the enchanted lever, and a "picture imp" inside the box quickly draws the picture and hands it to you. :)

I'm attending a Discworld sci-fi convention in July and have made a fully working version of both the "Luggage" and the "Iconograph" for my costume. See details at: http://www.farshiftnovel.com/luggage

Here's the final code if anyone else needs it (change the timings, etc for your model camera)

Code: [Select]
@title ICONOGRAPH

while 1
wait_click
if is_key "display" then gosub "runthrough"
wend
end

:runthrough
print "IGNORING USB"
set_config_value 121 1
sleep 500

print "SWITCHING TO REC MODE"
set_record 1
sleep 6000

print "TAKING PICTURE"
shoot

print "SWITCHING BACK TO PLAY MODE"
set_record 0
sleep 6000

print "RESTORING USB"
set_config_value 121 0
sleep 6000

print "Entering Print Menu"
click "set"
sleep 6000

print "Confirming Print"
click "set"
sleep 50000
return
« Last Edit: 03 / June / 2011, 09:25:45 by mcaramb »

 

Related Topics