Skip to content

division by zero with configTICK_RATE_HZ > 1000 #1

@nbrunner

Description

@nbrunner

I'm using a configTICK_RATE_HZ of 1024 and got the following error:

Middlewares/ST/ST67W6X_Network_Driver/Core/w6x_ble_shell.c:564:53: error: division by zero [-Werror=div-by-zero]
  564 |                                        SCAN_TIMEOUT / portTICK_PERIOD_MS) != EVENT_FLAG_SCAN_DONE)
Middlewares/ST/ST67W6X_Network_Driver/Utils/Performance/iperf.c:868:35: error: division by zero [-Werror=div-by-zero]
  868 |         vTaskDelay((delay / 1000) / portTICK_PERIOD_MS); /* Parameter should be in system ticks */

I think it would be better to use pdMS_TO_TICKS() instead of portTICK_PERIOD_MS, it avoid div by zero and also correctly convert with tick interval that are not an integer of ms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions