From 867ee7bf9bdfe68ee49e500bc19a3ff373fbae36 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Sun, 24 Sep 2023 01:19:10 +0200 Subject: [PATCH] Breaking change: DATA_CMD_GET_DEVICE_MODEL to match chameleon_device_type_t cf https://github.com/RfidResearchGroup/ChameleonUltra/pull/147#pullrequestreview-1637478473 --- docs/protocol.md | 2 +- firmware/application/src/app_cmd.c | 6 +----- software/script/chameleon_cli_unit.py | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/docs/protocol.md b/docs/protocol.md index 85b4f1ab..c89c1fde 100644 --- a/docs/protocol.md +++ b/docs/protocol.md @@ -166,7 +166,7 @@ In the following list, "CLI" refers to one typical CLI command using the describ * CLI: cf `hw ble bonds clear` ### 1033: GET_DEVICE_MODEL * Command: no data -* Response: 1 byte. `hw_version` aka `NRF_DFU_HW_VERSION` (0=Ultra, 1=Lite) +* Response: 1 byte. `hw_version` aka `NRF_DFU_HW_VERSION` according to `chameleon_device_type_t` enum (0=Ultra, 1=Lite) * CLI: cf `hw version` ### 1034: GET_DEVICE_SETTINGS * Command: no data diff --git a/firmware/application/src/app_cmd.c b/firmware/application/src/app_cmd.c index d78199ad..f9b8ee0d 100644 --- a/firmware/application/src/app_cmd.c +++ b/firmware/application/src/app_cmd.c @@ -49,11 +49,7 @@ static data_frame_tx_t *cmd_processor_get_git_version(uint16_t cmd, uint16_t sta static data_frame_tx_t *cmd_processor_get_device_model(uint16_t cmd, uint16_t status, uint16_t length, uint8_t *data) { -#if defined(PROJECT_CHAMELEON_ULTRA) - uint8_t resp_data = 1; -#else - uint8_t resp_data = 0; -#endif + uint8_t resp_data = hw_get_device_type(); return data_frame_make(cmd, STATUS_DEVICE_SUCCESS, sizeof(resp_data), &resp_data); } diff --git a/software/script/chameleon_cli_unit.py b/software/script/chameleon_cli_unit.py index cdc1555e..63bc65dd 100644 --- a/software/script/chameleon_cli_unit.py +++ b/software/script/chameleon_cli_unit.py @@ -244,7 +244,7 @@ def on_exec(self, args: argparse.Namespace): self.device_com.open(args.port) self.device_com.commands = self.cmd.get_device_capabilities() major, minor = self.cmd.get_app_version() - model = 'Ultra' if self.cmd.get_device_model() else 'Lite' + model = ['Ultra', 'Lite'][self.cmd.get_device_model()] print(f" {{ Chameleon {model} connected: v{major}.{minor} }}") except Exception as e: @@ -306,7 +306,7 @@ def on_exec(self, args: argparse.Namespace): fw_version_tuple = self.cmd.get_app_version() fw_version = f'v{fw_version_tuple[0]}.{fw_version_tuple[1]}' git_version = self.cmd.get_git_version() - model = 'Ultra' if self.cmd.get_device_model() else 'Lite' + model = ['Ultra', 'Lite'][self.cmd.get_device_model()] print(f' - Chameleon {model}, Version: {fw_version} ({git_version})')