This is an automated email from the ASF dual-hosted git repository.

janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 492629e9772c4c8172a17d4ce2519bea18c0b437
Author: Szymon Janc <szymon.j...@codecoup.pl>
AuthorDate: Wed Aug 9 11:59:01 2023 +0200

    apps/dtm: Fix handling of unmodulated carrier
    
    We now provide unmodulated carrier via DTM extension (payload=255).
    Previously implemented command was never upstream and thus was not
    working.
---
 apps/dtm/src/main.c | 102 ++--------------------------------------------------
 1 file changed, 3 insertions(+), 99 deletions(-)

diff --git a/apps/dtm/src/main.c b/apps/dtm/src/main.c
index e5e0689c..11f41160 100644
--- a/apps/dtm/src/main.c
+++ b/apps/dtm/src/main.c
@@ -105,7 +105,7 @@ cmd_tx_test(int argc, char **argv)
     }
 
     params.payload = parse_arg_uint8("payload", &rc);
-    if ((rc != 0) || ((params.payload > 7))) {
+    if ((rc != 0) || ((params.payload > 7 && params.payload != 255))) {
         console_printf("invalid 'payload' parameter\n");
         return rc;
     }
@@ -205,75 +205,6 @@ cmd_set_antenna(int argc, char **argv)
     return 0;
 }
 
-#define BLE_HCI_OCF_VS_TEST_CARRIER (0x0020)
-
-static bool tx_carrier_running = false;
-
-static int
-cmd_tx_carrier(int argc, char **argv)
-{
-    uint8_t cmd[2];
-    int rc;
-
-    rc = parse_arg_all(argc - 1, argv + 1);
-    if (rc != 0) {
-        return rc;
-    }
-
-    if (tx_carrier_running) {
-        console_printf("TX carrier already started\n");
-        return 0;
-    }
-
-    cmd[0] = 1;
-    cmd[1] = parse_arg_uint8("channel", &rc);
-    if ((rc != 0) || (cmd[1] > 39)) {
-        console_printf("invalid channel\n");
-        return rc;
-    }
-
-    rc = ble_hs_hci_send_vs_cmd(BLE_HCI_OCF_VS_TEST_CARRIER, &cmd, sizeof(cmd),
-                                NULL, 0);
-    if (rc) {
-        console_printf("failed to start TX carrier\n");
-        return rc;
-    }
-
-    console_printf("TX carrier started\n");
-    tx_carrier_running = true;
-    return 0;
-}
-
-static int
-cmd_stop_carrier(int argc, char **argv)
-{
-    uint8_t cmd[2];
-    int rc;
-
-    rc = parse_arg_all(argc - 1, argv + 1);
-    if (rc != 0) {
-        return rc;
-    }
-
-    if (!tx_carrier_running) {
-        console_printf("TX carrier not started\n");
-        return 0;
-    }
-    cmd[0] = 0;
-    cmd[1] = 0;
-
-    rc = ble_hs_hci_send_vs_cmd(BLE_HCI_OCF_VS_TEST_CARRIER, &cmd, sizeof(cmd),
-                                NULL, 0);
-    if (rc) {
-        console_printf("failed to stop TX carrier\n");
-        return rc;
-    }
-
-    console_printf("TX carrier stopped\n");
-    tx_carrier_running = false;
-    return 0;
-}
-
 static const struct shell_param cmd_rx_test_params[] = {
     {"channel", "RX channel, usage: =[0-39]"},
     {"phy", "usage: =[1M|2M], default: 1M"},
@@ -288,10 +219,10 @@ static const struct shell_cmd_help cmd_rx_test_help = {
 };
 
 static const struct shell_param cmd_tx_test_params[] = {
-    {"channel", "RX channel, usage: =[0-39]"},
+    {"channel", "TX channel, usage: =[0-39]"},
     {"phy", "usage: =[1M|2M], default: 1M"},
     {"data_length", "usage: =[0-255], default: 0"},
-    {"payload", "usage: =[0-7]"},
+    {"payload", "usage: =[0-7, 255]"},
     {NULL}
 };
 
@@ -329,23 +260,6 @@ static const struct shell_cmd_help cmd_set_antenna_help = {
     .params = cmd_set_antenna_params,
 };
 
-static const struct shell_param cmd_tx_carrier_params[] = {
-    {"channel", "TX channel, usage: =[0-39]"},
-    {NULL}
-};
-
-static const struct shell_cmd_help cmd_tx_carrier_help = {
-    .summary = "TX unmodulated carrier",
-    .usage = NULL,
-    .params = cmd_tx_carrier_params,
-};
-
-static const struct shell_cmd_help cmd_stop_carrier_help = {
-    .summary = "stop TX unmodulated carrier",
-    .usage = NULL,
-    .params = NULL,
-};
-
 static const struct shell_cmd dtm_commands[] = {
     {
         .sc_cmd = "rx-test",
@@ -372,16 +286,6 @@ static const struct shell_cmd dtm_commands[] = {
         .sc_cmd_func = cmd_set_antenna,
         .help = &cmd_set_antenna_help,
     },
-    {
-        .sc_cmd = "tx-carrier",
-        .sc_cmd_func = cmd_tx_carrier,
-        .help = &cmd_tx_carrier_help,
-    },
-    {
-        .sc_cmd = "stop-carrier",
-        .sc_cmd_func = cmd_stop_carrier,
-        .help = &cmd_stop_carrier_help,
-    },
     { }
 };
 

Reply via email to