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>
This commit is contained in:
Kapil Bhatt 2025-07-15 06:51:42 +00:00 committed by Fabio Baltieri
parent db0e8a6ff3
commit fbd34dac0f
2 changed files with 2 additions and 2 deletions

View File

@ -788,7 +788,7 @@ struct wifi_iface_status {
/** is TWT capable? */
bool twt_capable;
/** The current 802.11 PHY TX data rate (in Mbps) */
int current_phy_tx_rate;
float current_phy_tx_rate;
};
/** @brief Wi-Fi power save parameters */

View File

@ -1489,7 +1489,7 @@ static int cmd_wifi_status(const struct shell *sh, size_t argc, char *argv[])
PR("DTIM: %d\n", status.dtim_period);
PR("TWT: %s\n",
status.twt_capable ? "Supported" : "Not supported");
PR("Current PHY TX rate (Mbps) : %d\n", status.current_phy_tx_rate);
PR("Current PHY TX rate (Mbps) : %.1f\n", (double)status.current_phy_tx_rate);
}
return 0;