uint_fast8_t progressSetPos(uintmax_t pos) { statusDrawStart(); uint32_t timeleft = 0; if ((pos += progress_offset) >= progress_posmax) { pos = progress_posmax; timerStop(); wcscpy(status_value, lang(S_COMPLETED)); status_features |= STATUS_FINISHED; } if (pos != progress_pos || !pos) { if ((progress_pos = pos) && pos) { timeleft = timerGet(); timeleft = progress_posmax * timeleft / progress_pos - timeleft; } DrawProgress(progress_screen, &progress_rect, progress_frame, progress_done, progress_back, progress_textcolor, progress_fontsize, progress_posmax, progress_pos, timeleft); } if (pos != progress_posmax && status_features & STATUS_CANCELABLE && GetInput() & keys[KEY_B].mask) { wcscpy(status_value, lang(S_CANCELED)); status_features |= STATUS_WAIT | STATUS_FINISHED | STATUS_FAILED; } if (status_features & STATUS_FINISHED) { wcscat(status_value, L" "); swprintf(status_value + wcslen(status_value), _MAX_LFN + 1, lang(SF2_PRESS_BUTTON_ACTION), lang(S_ANY_BUTTON), lang(S_CONTINUE)); } DrawStringRect(&bottomScreen, status_value, &style.activityStatusRect, style.activityColor, style.activityStatusAlign, 16); statusDrawFinish(); if (status_features & STATUS_WAIT && status_features & STATUS_FINISHED) InputWait(); return !(status_features & STATUS_FAILED); }
/** * Refresh the elapsed time value. */ void refreshElapsedTime(void) { uint16_t t; t = timerGet(); gotoxy(17, 13); leadingZero(t >> 8); utilAppendDecimal(t >> 8); cputs(utilStr); cputc(':'); leadingZero(t & 0xff); utilAppendDecimal(t & 0xff); cputs(utilStr); }