net: wifi: shell: fix twt setup quick failed issue
The default exponent is 0, will cause twt setup quick failed, set exponent value derived from twt interval to fix it. Signed-off-by: Rex Chen <rex.chen_1@nxp.com>
This commit is contained in:
parent
0406f9b403
commit
ab948b080d
1 changed files with 11 additions and 0 deletions
|
@ -1533,6 +1533,10 @@ static int cmd_wifi_twt_setup_quick(const struct shell *sh, size_t argc,
|
|||
struct wifi_twt_params params = { 0 };
|
||||
int idx = 1;
|
||||
long value;
|
||||
double twt_mantissa_scale = 0.0;
|
||||
double twt_interval_scale = 0.0;
|
||||
uint16_t scale = 1000;
|
||||
int exponent = 0;
|
||||
|
||||
context.sh = sh;
|
||||
|
||||
|
@ -1557,6 +1561,13 @@ static int cmd_wifi_twt_setup_quick(const struct shell *sh, size_t argc,
|
|||
}
|
||||
params.setup.twt_interval = (uint64_t)value;
|
||||
|
||||
/* control the region of mantissa filed */
|
||||
twt_interval_scale = (double)(params.setup.twt_interval / scale);
|
||||
/* derive mantissa and exponent from interval */
|
||||
twt_mantissa_scale = frexp(twt_interval_scale, &exponent);
|
||||
params.setup.twt_mantissa = ceil(twt_mantissa_scale * scale);
|
||||
params.setup.twt_exponent = exponent;
|
||||
|
||||
if (net_mgmt(NET_REQUEST_WIFI_TWT, iface, ¶ms, sizeof(params))) {
|
||||
PR_WARNING("%s with %s failed, reason : %s\n",
|
||||
wifi_twt_operation_txt(params.operation),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue