Skip to content

Commit 5884f60

Browse files
committedJan 16, 2024
Fix loading of secplus module in GRC
1 parent 0419b8b commit 5884f60

9 files changed

+1769
-65
lines changed
 

‎secplus_rx.grc

+31-31
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ blocks:
8484
bus_sink: false
8585
bus_source: false
8686
bus_structure: null
87-
coordinate: [152, 332.0]
87+
coordinate: [232, 332.0]
8888
rotation: 0
8989
state: enabled
9090
- name: samp_rate
@@ -96,7 +96,7 @@ blocks:
9696
bus_sink: false
9797
bus_source: false
9898
bus_structure: null
99-
coordinate: [8, 76]
99+
coordinate: [8, 140.0]
100100
rotation: 0
101101
state: enabled
102102
- name: threshold
@@ -124,7 +124,7 @@ blocks:
124124
bus_sink: false
125125
bus_source: false
126126
bus_structure: null
127-
coordinate: [856, 184.0]
127+
coordinate: [936, 184.0]
128128
rotation: 0
129129
state: enabled
130130
- name: blocks_rotator_cc_0
@@ -141,7 +141,7 @@ blocks:
141141
bus_sink: false
142142
bus_source: false
143143
bus_structure: null
144-
coordinate: [432, 168.0]
144+
coordinate: [512, 168.0]
145145
rotation: 0
146146
state: enabled
147147
- name: import_0
@@ -154,7 +154,7 @@ blocks:
154154
bus_sink: false
155155
bus_source: false
156156
bus_structure: null
157-
coordinate: [8, 404]
157+
coordinate: [8, 76.0]
158158
rotation: 0
159159
state: enabled
160160
- name: osmosdr_source_0
@@ -511,7 +511,7 @@ blocks:
511511
bus_sink: false
512512
bus_source: false
513513
bus_structure: null
514-
coordinate: [136, 76.0]
514+
coordinate: [216, 76.0]
515515
rotation: 0
516516
state: enabled
517517
- name: qtgui_time_sink_x_0
@@ -608,7 +608,7 @@ blocks:
608608
bus_sink: false
609609
bus_source: false
610610
bus_structure: null
611-
coordinate: [576, 420.0]
611+
coordinate: [656, 420.0]
612612
rotation: 180
613613
state: enabled
614614
- name: rational_resampler_xxx_0
@@ -628,7 +628,7 @@ blocks:
628628
bus_sink: false
629629
bus_source: false
630630
bus_structure: null
631-
coordinate: [664, 156.0]
631+
coordinate: [744, 156.0]
632632
rotation: 0
633633
state: enabled
634634
- name: rational_resampler_xxx_1
@@ -648,7 +648,7 @@ blocks:
648648
bus_sink: false
649649
bus_source: false
650650
bus_structure: null
651-
coordinate: [792, 332.0]
651+
coordinate: [872, 332.0]
652652
rotation: 180
653653
state: enabled
654654
- name: secplus_decode
@@ -664,10 +664,10 @@ blocks:
664664
\ See the\n# GNU General Public License for more details.\n#\n# You should\
665665
\ have received a copy of the GNU General Public License\n# along with secplus.\
666666
\ If not, see <http://www.gnu.org/licenses/>.\n#\n\nimport numpy as np\nfrom\
667-
\ gnuradio import gr\nimport secplus\n\n\nclass blk(gr.sync_block):\n \"\"\
668-
\"Decoder for Chamberlain garage door openers\"\"\"\n\n def __init__(self,\
669-
\ samp_rate=10000, threshold=0.02):\n gr.sync_block.__init__(\n \
670-
\ self,\n name='Security+ Decoder',\n\n in_sig=[np.float32],\n\
667+
\ gnuradio import gr\ntry:\n import secplus\nexcept:\n pass\n\n\nclass\
668+
\ blk(gr.sync_block):\n \"\"\"Decoder for Chamberlain garage door openers\"\
669+
\"\"\n\n def __init__(self, samp_rate=10000, threshold=0.02):\n gr.sync_block.__init__(\n\
670+
\ self,\n name='Security+ Decoder',\n\n in_sig=[np.float32],\n\
671671
\ out_sig=[]\n )\n self.samp_rate = samp_rate\n \
672672
\ self.threshold = threshold\n self.last_sample = 0.0\n self.last_rise\
673673
\ = 0\n self.buffer = []\n self.last_pair = []\n self.pair\
@@ -707,7 +707,7 @@ blocks:
707707
bus_sink: false
708708
bus_source: false
709709
bus_structure: null
710-
coordinate: [576, 276.0]
710+
coordinate: [656, 276.0]
711711
rotation: 180
712712
state: enabled
713713
- name: secplus_v2_decode
@@ -723,23 +723,23 @@ blocks:
723723
\ See the\n# GNU General Public License for more details.\n#\n# You should\
724724
\ have received a copy of the GNU General Public License\n# along with secplus.\
725725
\ If not, see <http://www.gnu.org/licenses/>.\n#\n\nimport numpy as np\nfrom\
726-
\ gnuradio import gr\nimport secplus\n\n\nclass blk(gr.sync_block):\n \"\"\
727-
\"Decoder for Chamberlain garage door openers\"\"\"\n\n def __init__(self,\
728-
\ samp_rate=10000, threshold=0.02):\n gr.sync_block.__init__(\n \
729-
\ self,\n name='Security+ 2.0 Decoder',\n\n in_sig=[np.float32],\n\
730-
\ out_sig=[]\n )\n self.samp_rate = samp_rate\n \
731-
\ self.threshold = threshold\n self.last_sample = 0.0\n self.last_edge\
732-
\ = 0\n self.buffer = []\n self.pair = [None, None]\n self.pair_time\
733-
\ = [None, None]\n\n def work(self, input_items, output_items):\n \
734-
\ for n, sample in enumerate(input_items[0]):\n current_sample =\
735-
\ self.nitems_read(0) + n\n if self.last_sample < self.threshold\
736-
\ <= sample:\n # rising edge\n self.process_edge(True,\
726+
\ gnuradio import gr\ntry:\n import secplus\nexcept:\n pass\n\n\nclass\
727+
\ blk(gr.sync_block):\n \"\"\"Decoder for Chamberlain garage door openers\"\
728+
\"\"\n\n def __init__(self, samp_rate=10000, threshold=0.02):\n gr.sync_block.__init__(\n\
729+
\ self,\n name='Security+ 2.0 Decoder',\n\n \
730+
\ in_sig=[np.float32],\n out_sig=[]\n )\n self.samp_rate\
731+
\ = samp_rate\n self.threshold = threshold\n self.last_sample\
732+
\ = 0.0\n self.last_edge = 0\n self.buffer = []\n self.pair\
733+
\ = [None, None]\n self.pair_time = [None, None]\n\n def work(self,\
734+
\ input_items, output_items):\n for n, sample in enumerate(input_items[0]):\n\
735+
\ current_sample = self.nitems_read(0) + n\n if self.last_sample\
736+
\ < self.threshold <= sample:\n # rising edge\n \
737+
\ self.process_edge(True, current_sample - self.last_edge)\n \
738+
\ self.last_edge = current_sample\n elif self.last_sample >= self.threshold\
739+
\ > sample:\n # falling edge\n self.process_edge(False,\
737740
\ current_sample - self.last_edge)\n self.last_edge = current_sample\n\
738-
\ elif self.last_sample >= self.threshold > sample:\n \
739-
\ # falling edge\n self.process_edge(False, current_sample\
740-
\ - self.last_edge)\n self.last_edge = current_sample\n \
741-
\ if current_sample - self.last_edge >= 0.625e-3 * self.samp_rate:\n \
742-
\ self.buffer.append(0)\n self.buffer.append(0)\n\
741+
\ if current_sample - self.last_edge >= 0.625e-3 * self.samp_rate:\n\
742+
\ self.buffer.append(0)\n self.buffer.append(0)\n\
743743
\ self.process_buffer(current_sample)\n self.buffer\
744744
\ = []\n self.last_sample = sample\n return len(input_items[0])\n\
745745
\n def process_edge(self, rising, samples):\n if samples < 0.125e-3\
@@ -781,7 +781,7 @@ blocks:
781781
bus_sink: false
782782
bus_source: false
783783
bus_structure: null
784-
coordinate: [560, 348.0]
784+
coordinate: [640, 348.0]
785785
rotation: 180
786786
state: enabled
787787

‎secplus_rx_secplus_decode.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919

2020
import numpy as np
2121
from gnuradio import gr
22-
import secplus
22+
try:
23+
import secplus
24+
except:
25+
pass
2326

2427

2528
class blk(gr.sync_block):

‎secplus_rx_secplus_v2_decode.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919

2020
import numpy as np
2121
from gnuradio import gr
22-
import secplus
22+
try:
23+
import secplus
24+
except:
25+
pass
2326

2427

2528
class blk(gr.sync_block):

‎secplus_tx.grc

+253-14
Large diffs are not rendered by default.

‎secplus_tx.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#
77
# GNU Radio Python Flow Graph
88
# Title: Secplus Tx
9-
# GNU Radio version: 3.10.5.0
9+
# GNU Radio version: 3.10.9.2
1010

1111
from gnuradio import analog
1212
from gnuradio import blocks
@@ -21,7 +21,7 @@
2121
from gnuradio import eng_notation
2222
import osmosdr
2323
import time
24-
import secplus
24+
import secplus_tx_secplus as secplus # embedded python module
2525

2626

2727

@@ -47,6 +47,7 @@ def __init__(self, fixed=1234567890, freq=315150000, rolling=1234567890):
4747
##################################################
4848
# Blocks
4949
##################################################
50+
5051
self.single_pole_iir_filter_xx_0 = filter.single_pole_iir_filter_cc(0.1, 1)
5152
self.osmosdr_sink_0 = osmosdr.sink(
5253
args="numchan=" + str(1) + " " + ''

‎secplus_tx_secplus.py

+609
Large diffs are not rendered by default.

‎secplus_v2_tx.grc

+253-14
Large diffs are not rendered by default.

‎secplus_v2_tx.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#
77
# GNU Radio Python Flow Graph
88
# Title: Secplus V2 Tx
9-
# GNU Radio version: 3.10.5.0
9+
# GNU Radio version: 3.10.9.2
1010

1111
from gnuradio import analog
1212
from gnuradio import blocks
@@ -21,7 +21,7 @@
2121
from gnuradio import eng_notation
2222
import osmosdr
2323
import time
24-
import secplus
24+
import secplus_v2_tx_secplus as secplus # embedded python module
2525

2626

2727

@@ -48,6 +48,7 @@ def __init__(self, data=(-1), fixed=1234567890, freq=315000000, rolling=12345678
4848
##################################################
4949
# Blocks
5050
##################################################
51+
5152
self.single_pole_iir_filter_xx_0 = filter.single_pole_iir_filter_cc(0.2, 1)
5253
self.osmosdr_sink_0 = osmosdr.sink(
5354
args="numchan=" + str(1) + " " + ''

‎secplus_v2_tx_secplus.py

+609
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.