Skip to content

Commit

Permalink
Merge branch 'main' of github.com:sparkfun/sfe-datalogger
Browse files Browse the repository at this point in the history
  • Loading branch information
gigapod committed Aug 2, 2023
2 parents f32e06e + 34ff96c commit 753f8c4
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 8 deletions.
2 changes: 2 additions & 0 deletions fuse_id/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
],
},
)
4 changes: 4 additions & 0 deletions fuse_id/sfe_dl_fuseid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
49 changes: 41 additions & 8 deletions fuse_id/sfe_dl_fuseid/dl_fuseid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

0 comments on commit 753f8c4

Please sign in to comment.