Skip to content

Commit

Permalink
Chamtool: Add Autothreshold command
Browse files Browse the repository at this point in the history
Signed-off-by: cacke-r <[email protected]>
  • Loading branch information
cacke-r committed Feb 23, 2022
1 parent c686040 commit a212bbb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Software/ChamTool/Chameleon/Device.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class Device:
COMMAND_RED_LED = "LEDRED"
COMMAND_THRESHOLD = "THRESHOLD"
COMMAND_AUTOCALIBRATE = "AUTOCALIBRATE"
COMMAND_AUTOTHRESHOLD = "AUTOTHRESHOLD"
COMMAND_UPGRADE = "upgrade"

STATUS_CODE_OK = 100
Expand Down Expand Up @@ -280,7 +281,10 @@ def cmdThreshold(self, value):

def cmdAutoCalibrate(self):
return self.returnCmd(self.COMMAND_AUTOCALIBRATE)


def cmdAutoThreshold(self, newLogMode):
return self.getSetCmd(self.COMMAND_AUTOTHRESHOLD, newLogMode)

def cmdUpgrade(self):
# Execute command
cmdLine = self.COMMAND_UPGRADE + self.LINE_ENDING
Expand Down
13 changes: 13 additions & 0 deletions Software/ChamTool/chamtool.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,17 @@ def cmdAutoCalibrate(chameleon, arg):

else:
return "Command failed - No Parameter expected ! {}".format(arg)

def cmdAutoThreshold(chameleon, arg):
result = chameleon.cmdAutoThreshold(arg)

if (arg is None):
return "Autothreshold is: {}".format(result['response'])
else:
if (result['statusCode'] in chameleon.STATUS_CODES_SUCCESS):
return "Autothreshold is now {}".format(arg)
else:
return "Setting Autothreshold failed: {}".format(arg, result['statusText'])

def cmdUpgrade(chameleon, arg):
if(chameleon.cmdUpgrade() == 0):
Expand Down Expand Up @@ -236,6 +247,7 @@ def main():
cmdArgGroup.add_argument("-rl", "--rled", dest="rled", action=CmdListAction, metavar="FUNCTION", nargs='?', help="retrieve or set the current red led function")
cmdArgGroup.add_argument("-th", "--threshold", dest="threshold", action=CmdListAction, nargs='?', help="retrieve or set the threshold")
cmdArgGroup.add_argument("-ac", "--autocalibrate", dest="auto_calib", action=CmdListAction, nargs=0, help="Send AutoCalibration command")
cmdArgGroup.add_argument("-at", "--autothreshold", dest="auto_thres", action=CmdListAction, metavar="0/1", nargs='?', help="DIS-/ENABLES Autothreshold for SniffIso15693 Codec")
cmdArgGroup.add_argument("-ug", "--upgrade", dest="upgrade", action=CmdListAction, nargs=0, help="set the micro Controller to upgrade mode")

args = argParser.parse_args()
Expand Down Expand Up @@ -271,6 +283,7 @@ def main():
"rled" : cmdRedLED,
"threshold" : cmdThreshold,
"auto_calib": cmdAutoCalibrate,
"auto_thres": cmdAutoThreshold,
"upgrade" : cmdUpgrade,
}

Expand Down

0 comments on commit a212bbb

Please sign in to comment.