Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

Commit

Permalink
Add warning for lack of interface
Browse files Browse the repository at this point in the history
Update relevant documentation
  • Loading branch information
dmitri-mcguckin committed Feb 19, 2021
1 parent 51a39a6 commit 64d6666
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ An NCurses-based TUI application for tracking activity over the CAN bus and deco

### Run

`$` `canopen-monitor`
**Run the monitor, binding to `can0`**

`$` `canopen-monitor -i can0`

**Use this for an extensive help menu**

`$` `canopen-monitor --help`

***

Expand Down
2 changes: 1 addition & 1 deletion canopen_monitor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

MAJOR = 3
MINOR = 2
PATCH = 0
PATCH = 1

APP_NAME = 'canopen-monitor'
APP_DESCRIPTION = 'An NCurses-based TUI application for tracking activity' \
Expand Down
17 changes: 16 additions & 1 deletion canopen_monitor/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import sys
import argparse
from . import APP_NAME, APP_DESCRIPTION, CONFIG_DIR, CACHE_DIR
from .app import App
Expand Down Expand Up @@ -28,7 +29,7 @@ def main():
dest='interfaces',
type=str,
nargs='+',
default=['vcan0'],
default=[],
help='A list of interfaces to bind to.')
parser.add_argument('--no-block',
dest='no_block',
Expand All @@ -40,6 +41,20 @@ def main():
args = parser.parse_args()

try:
if(len(args.interfaces) == 0):
print('Warning: no interfaces config was found and you did not'
' specify any interface arguments')
print(f'\t(see {APP_NAME} -h for details)\n')
print('This means the monitor will not be listening to anything.')
while(True):
answer = input('Would you like to continue anyways? [y/N]: ')
if(answer.upper() == 'N' or answer == ''):
sys.exit(0)
elif(answer.upper() == 'Y'):
break
else:
print(f'Invalid response: {answer}')

init_dirs()
eds_configs = load_eds_files()
mt = MessageTable(CANOpenParser(eds_configs))
Expand Down

0 comments on commit 64d6666

Please sign in to comment.