Skip to content

Commit fa699fa

Browse files
committed
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. Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
1 parent f52d71c commit fa699fa

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
@@ -701,7 +701,7 @@ struct wifi_iface_status {
701701
/** is TWT capable? */
702702
bool twt_capable;
703703
/** The current 802.11 PHY TX data rate (in Mbps) */
704-
int current_phy_tx_rate;
704+
float current_phy_tx_rate;
705705
};
706706

707707
/** @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
@@ -1489,7 +1489,7 @@ static int cmd_wifi_status(const struct shell *sh, size_t argc, char *argv[])
14891489
PR("DTIM: %d\n", status.dtim_period);
14901490
PR("TWT: %s\n",
14911491
status.twt_capable ? "Supported" : "Not supported");
1492-
PR("Current PHY TX rate (Mbps) : %d\n", status.current_phy_tx_rate);
1492+
PR("Current PHY TX rate (Mbps) : %.1f\n", (double)status.current_phy_tx_rate);
14931493
}
14941494

14951495
return 0;

0 commit comments

Comments
 (0)