Using a uint16_t for time (in milliseconds) you overflow at 65.535s. And you need to compare seconds >= 60 instead of > 60. I corrected the code in two places (sorry for copy & paste, not easy to push a change right now) as per below.
static unsigned long start_time = 0;
static unsigned long time = 0;
static unsigned long total_time = 0;
void print_time(unsigned long time, char *time_str) {
uint16_t seconds = time / 1000;
uint8_t mills = time % 1000;
uint8_t minutes = seconds / 60;
if (seconds >= 60) {
Using a uint16_t for time (in milliseconds) you overflow at 65.535s. And you need to compare seconds >= 60 instead of > 60. I corrected the code in two places (sorry for copy & paste, not easy to push a change right now) as per below.