Skip to content

Uptime fold over #631

@Jean-LG

Description

@Jean-LG

the uptime counter is coded with an uint32. the uptime is in milliseconds therefore after 49 days (2^32 milliseconds), uptime folds over. Moreover some coversions in the code from uint32 to long give negative values. for uptime after 49/2=25.5 days (2^31 ms)

Some possible solution for ESP32 arch:

In AutoConnectPageImpl.hpp line 1009
#elif defined(ARDUINO_ARCH_ESP32)
long millisecs = esp_timer_get_time() / 1000;

esp_timer_get_time() returns an int64_t (see https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/esp_timer.html#_CPPv418esp_timer_get_timev)

It would be then usefull to convert either to seconds instead of keeping milliseconds in an uint32 variable, or use int64_t all the way long. Not sure if the arduino compiler handles properly uint64

JL

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions