madengr / ham2mon

GNU Radio based SDR scanner for narrow band FM demodulation
GNU General Public License v3.0
264 stars 65 forks source link

Print help when starting without arguments #15

Open sa5bke opened 8 years ago

sa5bke commented 8 years ago

Isn´t the intended behavior to print the possible arguments / help when starting ham2mon.py without arguments?

I get this:

linux; GNU C++ version 5.3.1 20160413; Boost_105800; UHD_003.009.004-release

Traceback (most recent call last):
  File "./ham2mon.py", line 137, in <module>
    curses.wrapper(main)
  File "/usr/lib/python2.7/curses/wrapper.py", line 43, in wrapper
    return func(stdscr, *args, **kwds)
  File "./ham2mon.py", line 59, in main
    priority_file_name, play, audio_bps)
  File "/home/esn/src/ham2mon/apps/scanner.py", line 77, in __init__
    audio_bps)
  File "/home/esn/src/ham2mon/apps/receiver.py", line 442, in __init__
    fft_length)
  File "/usr/lib/python2.7/dist-packages/gnuradio/blocks/blocks_swig1.py", line 431, in make
    return _blocks_swig1.stream_to_vector_make(itemsize, nitems_per_block)
RuntimeError: gr::io_signature(3)

I use a HackRF and after figuring out what arguments I should use everything works fine. I use GNU Radio version 3.7.9 and Python is 2.7.11+.

I might come up with some code changes to fix this it is is the intended behavior and the issue can be confirmed from more users.

sa5bke commented 8 years ago

Ok, after actually reading the code I understand that it´s -h to print help and the errors I get is because uhd is set to be default hardware that I don´t have. I think this issue can be closed. Maybe you can add below to the README.md

Usage: ham2mon.py [options]

Options:
  -h, --help            show this help message and exit
  -a HW_ARGS, --args=HW_ARGS
                        Hardware args
  -n NUM_DEMOD, --demod=NUM_DEMOD
                        Number of demodulators
  -d TYPE_DEMOD, --demodulator=TYPE_DEMOD
                        Type of demodulator (0=NBFM, 1=AM)
  -f CENTER_FREQ, --freq=CENTER_FREQ
                        Hardware RF center frequency in Hz
  -r ASK_SAMP_RATE, --rate=ASK_SAMP_RATE
                        Hardware ask sample rate in sps (1E6 minimum)
  -g GAIN_DB, --gain=GAIN_DB
                        Hardware RF gain in dB
  -s SQUELCH_DB, --squelch=SQUELCH_DB
                        Squelch in dB
  -v VOLUME_DB, --volume=VOLUME_DB
                        Volume in dB
  -t THRESHOLD_DB, --threshold=THRESHOLD_DB
                        Threshold in dB
  -w, --write           Record (write) channels to disk
  -l LOCKOUT_FILE_NAME, --lockout=LOCKOUT_FILE_NAME
                        File of EOL delimited lockout channels in Hz
  -p PRIORITY_FILE_NAME, --priority=PRIORITY_FILE_NAME
                        File of EOL delimited priority channels in Hz
  -c FREQ_CORRECTION, --correction=FREQ_CORRECTION
                        Frequency correction in ppm
  -m, --mute-audio      Mute audio from speaker (still allows recording)
  -b AUDIO_BPS, --bps=AUDIO_BPS
                        Audio bit depth (bps)