Skip to content

Commit

Permalink
bug_fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
evilpete committed Aug 10, 2022
1 parent 6cf4f29 commit 7ec8191
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 15 deletions.
File renamed without changes
File renamed without changes
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ pycodestyle:


clean:
@/bin/rm -fr *sub *.ir *.nfc touch_tunes-???
@/bin/rm -fr *sub *.ir *.nfc touch_tunes-??? __pycache__
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Note: requires [ndeflib](https://github.com/nfcpy/ndeflib) (available on [pypi](
---

#### [ir_plot.py](ir_plot.py) ####
<img align="right" src=".ir_sig_graph.png" height=100>
<img align="right" src=".img/ir_sig_graph.png" height=100>

Plot signal data from flipper IR raw data save files

Expand All @@ -74,7 +74,7 @@ Will generate filename [IR-CMD-RC5-03.ir](IR/IR-CMD-RC5-03.ir)
---

#### [subghz_histogram.py](subghz_histogram.py) ####
<img align="right" src=".subghz_histogram.png" height=100>
<img align="right" src=".img/subghz_histogram.png" height=100>

Script to read Flipper SubGhz RAW File and plot 0 & 1 segment lengths using pyplot

Expand Down Expand Up @@ -164,7 +164,7 @@ Out:

---

### [nfc](nfc) ###
### [NFC](nfc) ###

Random Collection of flipper [NFC signals files](nfc)

Expand All @@ -176,7 +176,7 @@ Random Collection of flipper [IR signal files](IR)

---

### [subghz](subghz) ###
### [Subghz](subghz) ###

A Collection of Generated [Subghz Signal Files](subghz)

Expand Down
21 changes: 12 additions & 9 deletions ir_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,23 @@ def get_cmd_data_str(filename, targ_cmd):

if name is None:
print("name not found")
return None
return None, None

# print("Found name", n)

for line in fd:
if line.startswith('data:'):
try:
data_str = line.split(':')[1].strip()
return data_str
return data_str, name
except IndexError:
continue

print("data not found")
return data_str
return data_str, name


def split_data(dat, max_val=20000):
def split_data(dat, max_val=15000):

dat_list = dat.split()
ret = []
Expand Down Expand Up @@ -147,13 +147,15 @@ def main():
sys.exit(0)

# plot_data = []
cmd_data_str = get_cmd_data_str(filen, cmd_name)
if cmd_data_str is None:
cmd_data_str, found_name = get_cmd_data_str(filen, cmd_name)
if not cmd_data_str:
print(f'was not able to find raw data for "{cmd_name}"')
sys.exit(0)

if cmd_name is None:
cmd_name = found_name
if debug > 1:
print(cmd_data_str)
print("cmd_data_str:",len(cmd_data_str), cmd_data_str,"<")

dat_lists = split_data(cmd_data_str)

Expand All @@ -166,11 +168,12 @@ def main():

if debug or PRINT_BITS: # this method is total hack
# Print Bits
o = d[3::2]
o = d[1::2]
avg_val = mean(o)
bits = ['0' if b < avg_val else '1' for b in o]
# print(o)
print(bits)
bit_str = "".join(bits)
print(bits, bit_str, "{0:02x} {0:d}".format(int(bit_str, 2)))

n_dat = convert_dat(d, normalize=True)
conv_dat_lists.append(n_dat)
Expand Down
2 changes: 1 addition & 1 deletion subghz_decode_presets.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def set_maxpower(self, power=None, invert=False):
else:
power= 0xC0

self.set_power(self, power=power, invert=invert)
self.set_power(self, power, invert)

def set_power(self, power=None, invert=False):
mod = self.get_Modulation()
Expand Down

0 comments on commit 7ec8191

Please sign in to comment.