Created genie.py for generating a RAW .SUB file

This commit is contained in:
Derek Jamison 2023-10-02 18:50:38 -05:00
parent 3e463b17b6
commit c0159c6920
2 changed files with 42 additions and 1 deletions

View File

@ -18,4 +18,5 @@ Bit: 64
Key: 97 A3 8C 95 00 7F 19 91
```
In the future, I'll provide a python script that generates a Bin_RAW file, which will have the TE set to 200 and not require any changes to keeloq.c.
You can run the genie.py file to generate a genie.sub file that uses the RAW protocol to transmit, so it works without modified firmware.
Edit the ``info = 0x0D94C5EC007F1991`` to be the value of the key you wish to use.

View File

@ -0,0 +1,40 @@
import sys
def main():
info = 0x0D94C5EC007F1991
te = 200 #200 is what original remote used. (How short the pulses are, smaller is faster.)
hc = 11 #11 is what original remote sent. (How many pulses in header. You may be able to reduce this.)
end = 40 #40 is what original remote sent. (How long the silence guard is. You may be able to reduce this.)
repeat=5 #5 is what original remote sent. (How many times to repeat the signal. You may be able to reduce this.)
with open('genie.sub', 'w') as f:
f.write("Filetype: Flipper SubGhz RAW File\n")
f.write("Version: 1\n")
f.write("Frequency: 315000000\n")
f.write("Preset: FuriHalSubGhzPresetOok650Async\n")
f.write("Protocol: RAW\n")
for j in range(repeat):
f.write(f"RAW_Data: ")
# header
for i in range(hc):
f.write(f"{te} -{te} ")
f.write(f"{te} -{9*te} ")
# iterate over each bit
for i in range(64):
# get bit value
bit = (info >> (63 - i)) & 1
# get bit value, output on a single line.
if bit == 0:
f.write(f"{2*te} -{te} ")
else:
f.write(f"{te} -{2*te} ")
# stop
f.write(f"{te} -{2*te} {te} -{end*te}\n")
main()