Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when selecting FSK in modulator in certain conditions #721

Closed
whitequark opened this issue Jan 25, 2020 · 1 comment
Closed

Crash when selecting FSK in modulator in certain conditions #721

whitequark opened this issue Jan 25, 2020 · 1 comment

Comments

@whitequark
Copy link

Expected Behavior

Crash when selecting FSK in modulator in certain conditions.

Actual Behavior

No crash.

Steps To Reproduce
  1. Open project nrfreverse.zip
  2. Click on 'Generator'
  3. Select 'LimeSDR-20200125_083302-2_402GHz-8MSps-2MHz'
  4. Click 'Edit ...'
  5. Under 'Modulation', select 'ASK'
  6. Under 'Modulation', select 'FSK'
  7. Observe crash:
raceback (most recent call last):
  File "/home/whitequark/Projects/urh/src/urh/controller/dialogs/ModulatorDialog.py", line 491, in on_modulation_type_changed
    self.set_default_modulation_parameters()
  File "/home/whitequark/Projects/urh/src/urh/controller/dialogs/ModulatorDialog.py", line 351, in set_default_modulation_parameters
    self.current_modulator.parameters = self.current_modulator.get_default_parameters()
  File "/home/whitequark/Projects/urh/src/urh/signalprocessing/Modulator.py", line 244, in get_default_parameters
    for i in range(self.modulation_order):
TypeError: 'float' object cannot be interpreted as an integer
Platform Specifications
  • OS: Debian buster
  • URH version: 5460cf5
  • Python version: 3.7
  • Installed via git
Workaround

With the following patch, modulator seems to work OK and produce signals that are demodulated by my nRF24L01+:

diff --git a/src/urh/signalprocessing/Modulator.py b/src/urh/signalprocessing/Modulator.py
index 9cdd7942..fc46b7e0 100644
--- a/src/urh/signalprocessing/Modulator.py
+++ b/src/urh/signalprocessing/Modulator.py
@@ -241,7 +241,7 @@ class Modulator(object):
             parameters = np.linspace(0, 100, self.modulation_order, dtype=np.float32)
         elif self.is_frequency_based:
             parameters = []
-            for i in range(self.modulation_order):
+            for i in range(int(self.modulation_order)):
                 parameters.append((i + 1) * self.carrier_freq_hz / self.modulation_order)
         elif self.is_phase_based:
             step = 360 / self.modulation_order

But from looking at the code this doesn't seem like the right fix to me.

jopohl added a commit that referenced this issue Jan 25, 2020
@jopohl jopohl closed this as completed in 0fd9d3d Jan 25, 2020
@whitequark
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant