Can't control an IR device via a Mio R2?
vegastech
Posts: 369
I have a directv box that I am unable to control via an R2. Let me explain:
I have an NI-3100 with all IR ports full, also an NXC-IRS, and an NXB-IRS4. The sat box in question is landed on the NXB-IRS4, which is addressed correctly, as I can see it in my device tree. I have programmed an 8400 to control this box, and it works fine, but when I try to control it with the R2, I get no control. Here is the related code for the R2:
Basically, I can use the R2 to turn the tv in the room on (it is wired to the 3100), switch the autopatch switcher to the correct input, but then I get no control. I have used the "control a device" option under diagnostics, and it works - I can send the menu command and I see the box respond. I also can control the blu ray player from the R2, which is also connected to the NI. I would LOVE to move the IRs around, but I simply can't - I have EVERYTHING else working right now, just not the one sat box in one guest room! Help! It's gotta be something in my code!
I have an NI-3100 with all IR ports full, also an NXC-IRS, and an NXB-IRS4. The sat box in question is landed on the NXB-IRS4, which is addressed correctly, as I can see it in my device tree. I have programmed an 8400 to control this box, and it works fine, but when I try to control it with the R2, I get no control. Here is the related code for the R2:
DEFINE_DEVICE RFGUEST418 = 130:1:0 //418 Gateway in Guest1 DEFINE_VARIABLE volatile integer nSatGuest [] = { 10, //0 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, //enter 22, //ch up 23, //ch dn 24, //vol up 25, //vol dn 26, //mute 31, //menu needs to be the # from the MIO R2. 32, //up 33, //down 34, //left 35, //right 36, //select 37, //exit 38, //guide 39, //info 40 //prev channel } BUTTON_EVENT[RFGUEST418,nSatGuest] { PUSH: { local_var integer nBtnSat nBtnSat = GET_LAST(nSatGuest) SWITCH(nBtnSat) { CASE 1: { PULSE[SAT_4,10] } CASE 2: { PULSE[SAT_4,11] } CASE 3: { PULSE[SAT_4,12] } CASE 4: { PULSE[SAT_4,13] } CASE 5: { PULSE[SAT_4,14] } CASE 6: { PULSE[SAT_4,15] } CASE 7: { PULSE[SAT_4,16] } CASE 8: { PULSE[SAT_4,17] } CASE 9: { PULSE[SAT_4,18] } CASE 10: { PULSE[SAT_4,19] } CASE 11: { PULSE[SAT_4,21] } CASE 12: { PULSE[SAT_4,22] } CASE 13: { PULSE[SAT_4,23] } CASE 14: { TO[TV_GUEST1,24] //TV Vol Up } CASE 15: { TO[TV_GUEST1,25] //TV Vol Down } CASE 16: { TO[TV_GUEST1,26] //TV Mute } CASE 17: //Menu { PULSE[SAT_4,44] } CASE 18: //Up { PULSE[SAT_4,45] } CASE 19: //Down { PULSE[SAT_4,46] } CASE 20: //Left { PULSE[SAT_4,47] } CASE 21: //Right { PULSE[SAT_4,48] } CASE 22: //Select { PULSE[SAT_4,49] } CASE 23: //Exit { PULSE[SAT_4,50] } CASE 24: //Guide { PULSE[SAT_4,56] } CASE 25: //Info { PULSE[SAT_4,65] } } } }
Basically, I can use the R2 to turn the tv in the room on (it is wired to the 3100), switch the autopatch switcher to the correct input, but then I get no control. I have used the "control a device" option under diagnostics, and it works - I can send the menu command and I see the box respond. I also can control the blu ray player from the R2, which is also connected to the NI. I would LOVE to move the IRs around, but I simply can't - I have EVERYTHING else working right now, just not the one sat box in one guest room! Help! It's gotta be something in my code!
0
Comments
Why?
The R1 and R2 have a 40 command set FOR EACH OF THE SIX SOURCE BUTTONS. Button one activates commands 1-40, button 2 shifts the R1/R2 buttons up to send 41-80, etc.
This is all documented in the R1/2/3 manuals.
Turn on diagnostic PUSH display in NetLinx Studio and you'll see the actual button codes appear in the bottom green bar in NLStudio. If your code only knows 1-4, and it isn't in that mode, you'll get pushes you don't handle.
To make the buttons work all the time regardless of the shift, you need your code to recognize 1, 41, 81. 121, 161, and 201 all to do the same thing. Etc.
This is due to the thought by the designers that you'd want PLAY to mean something different based on which source you have selected, that the play itself would go to the right device because of the shift. This might be good for some, for us it is painful.
Or of course, this may not be your problem at all. But probably is.
Have you tried "Emulate a Device" to fake the pressing of R2 buttons? If it works there but not from the actual remote then John Nagy may be right about the cause. Need to watch the button presses in Notifications to see that the right channel code is being received. While you're at it, set up notifications to watch the IR port to see if it is being triggered.
If Notifications shows that the right channel codes are being hit on the remote, but the IR port isn't firing then you probably do have a gremlin in your code. Put in debug statements (send_string 0:1:0) to watch in Diagnostics. I've seen at various times over the years, code that is syntactically correct that still doesn't work. Apparently due to unpredictable glitches in the compiler. Try moving the button event to another spot in the code. Try using a global variable instead of a local. Try adding extra lines of code. Try different things that shouldn't make a difference. They might fix it anyway. I say this because I've seen times in the past where inexplicable things were happening, and only by doing these types of things that you shouldn't have to do was I able to fix it.
On the other hand, if you DO see that the IR port is being triggered, but the IR device is not being controlled, you may just need to use set_pulse_time. Or use CTON and CTOF with an SP send_command instead of PULSE.