diff --git a/fuse_id/setup.py b/fuse_id/setup.py index c2094d8..5386634 100644 --- a/fuse_id/setup.py +++ b/fuse_id/setup.py @@ -109,6 +109,8 @@ def get_version(rel_path: str) -> str: # pip to create the appropriate form of executable for the target platform. entry_points={ 'console_scripts': ['dl_fuseid=sfe_dl_fuseid:dl_fuseid', + 'dl_fuseid_base=sfe_dl_fuseid:dl_fuseid_base', + 'dl_fuseid_9dof=sfe_dl_fuseid:dl_fuseid_9dof', ], }, ) diff --git a/fuse_id/sfe_dl_fuseid/__init__.py b/fuse_id/sfe_dl_fuseid/__init__.py index d046785..ccb9704 100644 --- a/fuse_id/sfe_dl_fuseid/__init__.py +++ b/fuse_id/sfe_dl_fuseid/__init__.py @@ -3,3 +3,7 @@ # just import the entry point method from .dl_fuseid import dl_fuseid + +from .dl_fuseid import dl_fuseid_base + +from .dl_fuseid import dl_fuseid_9dof diff --git a/fuse_id/sfe_dl_fuseid/dl_fuseid.py b/fuse_id/sfe_dl_fuseid/dl_fuseid.py index aeda79a..635ab5c 100644 --- a/fuse_id/sfe_dl_fuseid/dl_fuseid.py +++ b/fuse_id/sfe_dl_fuseid/dl_fuseid.py @@ -358,13 +358,46 @@ def dl_fuseid(): fuseid_process() #----------------------------------------------------------------------------- -def _main(): - #try: - main() - # except Exception as e: - # print('\nA fatal error occurred: %s' % e) - # sys.exit(2) +#----------------------------------------------------------------------------- +# Define entry points - for use by the entry_point:console_scripts - to define +# a board specific commands. +# +#----------------------------------------------------------------------------- +# _dl_add_board_parameter() +# +# Internal routine that addes the specified board arg to sys.argv. +# +# If a board arg is already present, it overrides the arg + +def _dl_add_board_parameter(board_type): + + # does a board parameter already exist in argv? + iBoard = [i for i,x in enumerate(sys.argv) if x == '-b' or x == '--board'] + + # was a swtich provided? + if len(iBoard) == 0: + sys.argv.append('-b') + sys.argv.append(board_type) + else: + # swtich provided .. check value - if switch is at end of list, that's an issue + if len(sys.argv)-1 == iBoard[0]: + sys.argv.append(board_type) + else: + sys.argv[iBoard[0]+1] = board_type + + # that's it, call our, main entry point + dl_fuseid() + + +#----------------------------------------------------------------------------- +# Entry point for the standard datalogger IoT board + +def dl_fuseid_base(): + _dl_add_board_parameter("DLBASE") -if __name__ == '__main__': - _main() +#----------------------------------------------------------------------------- +# Entry point for the 9DOF datalogger IoT board + +def dl_fuseid_9dof(): + _dl_add_board_parameter("DL9DOF")