Problems with projector feedback
SCOTTYP
Posts: 32
Hi, I've been working with a couple hitachi projectors and I was hoping to populate some status variables based on the feedback from the projectors. My problem is that the projectors only send back an acknowlegment when they receive a command (06H), other than that they do not send back any data unless talked to first. They have a get status command I can send but I wanted to update the power variable when the projector is done cooling, and it takes 1:15 to finish. Ive tried a few things one being sending the get command in my data_event followed by a select active. This kind of worked however it severely slowed down my network. I was hoping to get some good insight on how some experienced programmers would handle this. Let me know if you need any other info. Thanks in advance.
(here is the basic idea of what I had done)
String:
{
send_string dvProj, "(get command here)"
select
{
active(proj cool):
{
projCooling=1
}
active(proj off):
{
projCooling=0
projPow=0
}
active(proj on):
{
projCooling=0
projPow=1
}
}
}
(here is the basic idea of what I had done)
String:
{
send_string dvProj, "(get command here)"
select
{
active(proj cool):
{
projCooling=1
}
active(proj off):
{
projCooling=0
projPow=0
}
active(proj on):
{
projCooling=0
projPow=1
}
}
}
0
Comments
So basically, nCmdList is a queue of up to 30 commands that you would send to your projector. Every time you push a button that does something to the projector, it adds itself to the command list. You could also add things to the command list in other ways, this is just an example. you keep track of nNumCmds so that you know how many commands are currently queued up.
nStringSent is a variable that tells you whether you have already sent a command to the projector. Every 10th of a second the processor checks to see if you're waiting for a response or not. If you're waiting for a response, it does nothing. If not (if nStringSent has been set to 0 because a response was received), then it sends the next command in the list, deletes it, and moves everything in the list down a step.
The 'StringSent' wait serves to deal with lost commands and stuff so the whole processor doesn't just get stuck. The particular projector I was dealing with always took 2 seconds to respond to anything, but occasionally took up to 4. I didn't want to send strings every 4 seconds because of those occasional commands, so I wrote this. It sends commands as fast as the projector will allow, but no faster.
I've stripped this down a lot, my actual module does a ton of other stuff, including resending the command until it gets a response that the command has been acknowledged, but for the purposes of your question I think I've included everything relevant. Please feel free to ask questions if you don't get it all or are just curious, as I may have left something important out.
J
Thanks for all the info! I saw Daves post and got something working pretty quick. over the weekend. as well as learning a few things along the way. I ended up starting the timeline only when the shutoff command was initiated which worked out perfectly.. Im now messing around with Jeff's just because I have some time on my hands and we have a ton of Hitachi projectors here. Again thankyou, since I dont have anyone to learn from this is my only resource for problems I have not seen before. Oh and Dave whether you know it or not this is at least the fourth problem you have helped me out with, so heres a special thanx to you.