Faster then I thought, here you are:
Code:
--------------------
function PRONTOtoNATIVE(self, dataField, action)
local blocks = self:splitString(dataField, " ")
if blocks[1]~="0000" then
log:error("no Pronto 'Learned' IR code.")
return "",0,""
end
-- FREQ = 4,14Mhz/Carrier divider
local FREQ=4145146/tonumber(blocks[2],16)
local FREQ_HEX=string.format("%x", FREQ)
FREQ_HEX = "0x" .. string.rep("0", 8 - string.len(FREQ_HEX)) .. FREQ_HEX
local nativeCode= FREQ_HEX
-- block 3 contains the number of high/low blocks for initial sequence
- ignore
-- block 4 contains the number of high/low blocks for repeat sequence -
ignore
-- now we have high/low blocks, each representing # of cycles of the
freq.
for i = 5, #blocks,2 do
local HIGH=1000000/FREQ * tonumber(blocks[i],16)
local LOW=1000000/FREQ * tonumber(blocks[i+1], 16)
local HIGH_HEX=string.format("%x", HIGH);
HIGH_HEX="0x8".. string.rep("0", 7 - string.len(HIGH_HEX)) ..
HIGH_HEX
local LOW_HEX=string.format("%x", LOW);
LOW_HEX="0x0".. string.rep("0", 7 - string.len(LOW_HEX)) ..
LOW_HEX
nativeCode = nativeCode .. " " .. HIGH_HEX .. " " .. LOW_HEX
end
return nativeCode, 108, nativeCode
end
--------------------
With this a code like
Code:
--------------------
PRONTO:0000 006c 0000 0020 000a 001e 000a 001e 000a 0046 000b 0046 000a 001e
000a 0047 000a 001e 000a 0046 000b 0046 000a 001e 000a 001e 000a 0047 000a 001e
000a 001e 000a 001e 000a 06ad 000a 001e 000a 001e 000a 0046 000b 0046 000a 001e
000a 001e 000a 0047 000a 001e 000a 001e 000a 0046 000b 0046 000a 001e 000a 0047
000a 0046 000b 0046 000a 065d
--------------------
(Vol Up for our Denon-Friends) can be used.
Note that I don't know, how the 'Repeat Rate' that I need to return is
defined.
Is this just the time that a command takes ? If that the case, then the
high+low times should be added to make the 'Repeat Rate' (instead of
just using '108' like I did).
--
bluegaspode
1x SB-Controller+Receiver (Duet), 1xSB-Boom. 1xSB-Radio
Server (7.4.1) running on SheevaPlug (Ubuntu) with attached Western
Digital MyBook Essential.
Secondary 7.4 Server on Debianized Buffalo Linkstation LS-CHL.
------------------------------------------------------------------------
bluegaspode's Profile: http://forums.slimdevices.com/member.php?userid=31651
View this thread: http://forums.slimdevices.com/showthread.php?t=66795
_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins