问题
I'm trying to teach lirc on my Raspberry Pi the remote-codes for my heat pump - a Mitsubishi Electric MSZ-GE60VA (remote is SG10A 1833)
I run irrecord as follows:
sudo /etc/init.d/lirc stop
irrecord -d /dev/lirc0 heatpump
I get the usual cruft about pushing buttons, etc, and duly do so.
After several dots (not always the same number), irrecord bails with the following error message:
irrecord: could not find gap.
irrecord: gap not found, can't continue
Now, I've found elsewhere that the sample rate might be wrong, and to look at the waveform using xmode2 - which I've done. I'm pretty sure I'd have more luck if I could get irrecord to sample faster, as xmode2 can.
Any ideas? (NB: I've run with the force option too, and no difference)
Here are my results using xmode2 - you can see the 5ms sample can't really make heads or tails of the signal, but the 2ms sample can.
5ms sample http://jnawk.net.nz/5ms.png 5ms sample (default)
2ms sample http://jnawk.net.nz/2ms.png 2ms sample
回答1:
First,try to use
irrecord -f -d /dev/lirc0 ~/lirc.conf
-f will force the raw mode. If you're lucky that will generate the config file or at list the gap.
Otherwise, launch the command below and ctrl^c to stop escape / stop recording.
mode2 -m -d /dev/lirc0 > ~/lirc.conf
the -m option should generate formated raws. remove the first value which is the delay before you pressed the remote button.
if you don't use the -m option you can do it with VI.
vim ~/lirc.conf
:%s/^.\{5}
:%s!^! !
:%s/\n/
complete the ~/lirc.conf file to obtain something like :
begin remote
name MY_REMOTE
flags RAW_CODES
eps 30
aeps 100
frequency 38000
# note ensure the modulation frequency above correctly matches your remote, default is set to 38kHz
# you can also try other common frequencies (36000,40000,56000) if you are unsure
begin raw_codes
name MY_TEST
...<<PUT THE RAW CODE HERE >>...
end raw_codes
end remote
No TAB, only spaces in the file.
Make a backup of the original lircd.conf file
sudo mv /etc/lirc/lircd.conf /etc/lirc/lircd_original.conf
Copy over your new configuration file
sudo cp ~/lircd.conf /etc/lirc/lircd.conf
Start up lirc again
sudo /etc/init.d/lirc start
and try it
irsend SEND_ONCE MY_REMOTE MY_TEST
check with your phone camera the led is lighting.
This works for some people...
回答2:
LIRC actually samples as fast as 13 microseconds in raspberry pi which is the speed infrared lights pulse for IR signals (38kHZ), the timing you specify in xmode2 is just used in order to plot the image, each 2 ms it draws either a pulse or space on the graph.
The problem probably is in LIRC not detecting your remote IR code, have you tried running irrecord with the -f option? to force raw mode instead?
If this does not work you can use mode2 to actually try building your raw code manually and create the code like so: pulse time, space time, pulse time, space time and so on, expressed in microseconds.
From your graph it would be something like 6000 4000 1000 2000 1000 and so on...
Option 2- If you can find the pronto remote codes for your heat pump online then you can also convert them to lirc using pronto2lirc http://www.lirc.org/html/pronto2lirc.html
来源:https://stackoverflow.com/questions/22652156/how-to-use-irrecord-with-2ms-timing-instead-of-the-default-5ms