From 3e3cc3923126d81e49c43094cc1a0132b468a457 Mon Sep 17 00:00:00 2001 From: Murphy Date: Wed, 15 Nov 2023 18:44:18 +0200 Subject: [PATCH] added self inspection --- README.md | 3 +++ infiray_lrf/__init__.py | 2 +- infiray_lrf/commands.py | 12 ++++++------ infiray_lrf/sender.py | 6 ++++++ 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index fdb90ae..ab549d4 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,9 @@ python -m infiray-lrf # commands list: q - quit h - help + +i - self inspection + s - single ranging cf - continious ranging (frequency 1~10Hz, timout - seconds) diff --git a/infiray_lrf/__init__.py b/infiray_lrf/__init__.py index 7b9b038..edd39f1 100644 --- a/infiray_lrf/__init__.py +++ b/infiray_lrf/__init__.py @@ -1,4 +1,4 @@ -__version__ = '1.0.0' +__version__ = '1.0.1' __author__ = "o-murphy" __credits__ = ["Dmytro Yaroshenko"] __copyright__ = ('2023 Yaroshenko Dmytro (https://github.com/o-murphy)', ) diff --git a/infiray_lrf/commands.py b/infiray_lrf/commands.py index 11f67be..139adbb 100644 --- a/infiray_lrf/commands.py +++ b/infiray_lrf/commands.py @@ -60,18 +60,18 @@ temperature=Enum(Bit, normal=1, exception=0), - reserve=Bit + _reserve=Bit )) TSelfInspect = Struct( - status3=Byte, # reserved - status2=Byte, - status1=TSelfStatus, + _reserved=Byte, # reserved + echo_intensity=Byte, + system=TSelfStatus, status0=BitStruct( v5_power=Enum(Bit, normal=1, exception=0), - reserve=Bit[7] + _reserve=Bit[7] ), ) @@ -172,7 +172,7 @@ def crc(ctx): cmd=COMMAND, params=Switch( this.cmd, { - COMMAND.SelfInspection: TSelfInspect, + # COMMAND.SelfInspection: TSelfInspect, COMMAND.SetFirstLast: TSetFirstLast, COMMAND.SetFrequency: TSetFrequency, diff --git a/infiray_lrf/sender.py b/infiray_lrf/sender.py index d7e3512..be0c604 100644 --- a/infiray_lrf/sender.py +++ b/infiray_lrf/sender.py @@ -84,6 +84,9 @@ def write_serial(intf): if message == 's': cmd = command_request_struct.build({'cmd': COMMAND.SingleRanging, 'params': None}) + elif message == 'i': + cmd = command_request_struct.build({'cmd': COMMAND.SelfInspection, 'params': None}) + elif message == 'C': cmd = command_request_struct.build({'cmd': COMMAND.ContinuousRanging, 'params': None}) @@ -182,6 +185,9 @@ def show_help(): q\t - quit h\t - help + +i\t - self inspection + s\t - single ranging cf \t - continious ranging (frequency 1~10Hz, timout - seconds)