Bluetooth: shell: Fix floating point usage

Avoid floating point usage when possible. E.g. on qemu_x86 this would
otherwise result in something like the following:

<err> os: Floating point unit not enabled
<err> os: eax: 0x00000024, ebx: 0x00000000, ecx: 0x00248fc8,
          edx: 0x00146120
<err> os: esi: 0x0012b30c, edi: 0x0024c628, ebp: 0x0024c638,
          esp: 0x0024c5b8
<err> os: eflags: 0x00000216 cs: 0x0008 cr3: 0x001465a0
<err> os: call trace:
<err> os: eip: 0x00121c8d
<err> os:      0x0010679c (0x127750)
<err> os:      0x0010693b (0x100f33)
<err> os:      0x001061bc (0x12b800)
<err> os:      0x001074fb (0x0)
<err> os:      0x00101151 (0x12b800)
<err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception
<err> os: Current thread: 0x00146120 (shell_uart)
<err> os: Halting system

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2019-10-07 13:36:30 +03:00 committed by Johan Hedberg
commit cbb7ef5560

View file

@ -888,10 +888,10 @@ static int cmd_info(const struct shell *shell, size_t argc, char *argv[])
print_le_addr("Remote on-air", info.le.remote);
print_le_addr("Local on-air", info.le.local);
shell_print(ctx_shell, "Interval: 0x%04x (%.2f ms)",
info.le.interval, info.le.interval * 1.25);
shell_print(ctx_shell, "Latency: 0x%04x (%.2f ms)",
info.le.latency, info.le.latency * 1.25);
shell_print(ctx_shell, "Interval: 0x%04x (%u ms)",
info.le.interval, info.le.interval * 5 / 4);
shell_print(ctx_shell, "Latency: 0x%04x (%u ms)",
info.le.latency, info.le.latency * 5 / 4);
shell_print(ctx_shell, "Supervision timeout: 0x%04x (%d ms)",
info.le.timeout, info.le.timeout * 10);
}