Skip to content

Commit

Permalink
add option to exit python on error
Browse files Browse the repository at this point in the history
  • Loading branch information
rpatel3001 committed Feb 23, 2024
1 parent 800c7d5 commit 3e62023
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ These control the SoapySDR device that is opened as the original input stream. N
| `CHANS` | Semicolon separated list of comma separated settings per output channel: `centerfrequency,decimationfactor` | Unset |
| `BASEPORT` | Port to start counting from for output channels. | 1234 |
| `NUMBUFS` | Number of receive buffers to use. Each one allocates 2 \* 8 \* MTU bytes, where MTU is set by the SoapySDR driver in use. If you are having problems with buffer overflows, setting this higher will increase the time between overflows at the expense of increased RAM usage and more data lost per overflow. | 100 |
| `EXIT_ON_ERROR` | Set to any value to fully restart the script on a SoapySDR error instead of trying to reinitialize the device | unset |

## Docker Compose

Expand Down
5 changes: 4 additions & 1 deletion rootfs/scripts/soapy2tcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ def rx_thread(sdrcfg, rxStream, rxcfg, tx_init, inbufs, rxq):
print(f"[rx] failed to read stream, restarting thread: {SoapySDR_errToStr(status.ret)}: {status}")
sdr.deactivateStream(rxStream)
sdr.closeStream(rxStream)
return
if environ.get("EXIT_ON_ERROR"):
exit()
else:
return

for i in range(len(rxq)):
try:
Expand Down

0 comments on commit 3e62023

Please sign in to comment.