Skip to content

Commit c714074

Browse files
kapbhnordicjm
authored andcommitted
[nrf fromlist] wifi: Fix fractional part of Tx rate by converting to float
The Tx rate was previously stored as an integer, which caused loss of precision for rates like 8.6 Mbps or 34.4 Mbps due to integer division. The change will update data type to float. Upstream PR #: 93085 Signed-off-by: Kapil Bhatt <[email protected]>
1 parent d9cd01c commit c714074

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

include/zephyr/net/wifi_mgmt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ struct wifi_iface_status {
672672
/** is TWT capable? */
673673
bool twt_capable;
674674
/** The current 802.11 PHY TX data rate (in Mbps) */
675-
int current_phy_tx_rate;
675+
float current_phy_tx_rate;
676676
};
677677

678678
/** @brief Wi-Fi power save parameters */

subsys/net/l2/wifi/wifi_shell.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1484,7 +1484,7 @@ static int cmd_wifi_status(const struct shell *sh, size_t argc, char *argv[])
14841484
PR("DTIM: %d\n", status.dtim_period);
14851485
PR("TWT: %s\n",
14861486
status.twt_capable ? "Supported" : "Not supported");
1487-
PR("Current PHY TX rate (Mbps) : %d\n", status.current_phy_tx_rate);
1487+
PR("Current PHY TX rate (Mbps) : %.1f\n", (double)status.current_phy_tx_rate);
14881488
}
14891489

14901490
return 0;

0 commit comments

Comments
 (0)