Format times better for timer widget and statistics times (#896)

* Fix widget timer.
Modifie getStrString() for  using hms

* Timer over blink with COLOR_THEME_WARNING
Timer unit in uppercase

* Use lowercase unit with small timer display, use uppercase unit in large
display

* Auto formatting

Co-authored-by: Runsys16 <rene.negre@orange.com>
Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
This commit is contained in:
runsys
2021-10-15 21:32:24 +11:00
committed by GitHub
co-authored by Runsys16 Peter Feerick
parent ecf386e71f
commit 520eac3e4f
3 changed files with 447 additions and 328 deletions
+31 -24
View File
@@ -33,34 +33,41 @@ void str2zchar(char *dest, const char *src, int size);
int zchar2str(char *dest, const char *src, int size);
int strnlen(const char *src, int max_size);
char * strAppend(char * dest, const char * source, int len = 0);
char * strAppendUnsigned(char * dest, uint32_t value, uint8_t digits = 0, uint8_t radix = 10);
char * strAppendSigned(char * dest, int32_t value, uint8_t digits = 0, uint8_t radix = 10);
char * strSetCursor(char * dest, int position);
char * strAppendDate(char * str, bool time=false);
char * strAppendFilename(char * dest, const char * filename, const int size);
char *strAppend(char *dest, const char *source, int len = 0);
char *strAppendUnsigned(char *dest, uint32_t value, uint8_t digits = 0,
uint8_t radix = 10);
char *strAppendSigned(char *dest, int32_t value, uint8_t digits = 0,
uint8_t radix = 10);
char *strSetCursor(char *dest, int position);
char *strAppendDate(char *str, bool time = false);
char *strAppendFilename(char *dest, const char *filename, const int size);
#if !defined(BOOT)
char * getStringAtIndex(char * dest, const char * s, int idx);
char * strAppendStringWithIndex(char * dest, const char * s, int idx);
#define LEN_TIMER_STRING 10 // "-00:00:00"
char * getTimerString(char * dest, int tme, uint8_t hours=0);
char * getCurveString(char * dest, int idx);
char * getGVarString(char * dest, int idx);
char * getGVarString(int idx);
char * getSwitchPositionName(char * dest, swsrc_t idx);
char * getSwitchName(char * dest, swsrc_t idx);
char * getSourceString(char * dest, mixsrc_t idx);
char *getStringAtIndex(char *dest, const char *s, int idx);
char *strAppendStringWithIndex(char *dest, const char *s, int idx);
#define LEN_TIMER_STRING 10 // "-00:00:00"
char *getTimerString(char *dest, int32_t tme, uint8_t hours = 0u);
char *getTimerStringCase(char *dest, int32_t tme, uint8_t hours = 0u,
bool bLowerCase = true);
char *getCurveString(char *dest, int idx);
char *getGVarString(char *dest, int idx);
char *getGVarString(int idx);
char *getSwitchPositionName(char *dest, swsrc_t idx);
char *getSwitchName(char *dest, swsrc_t idx);
char *getSourceString(char *dest, mixsrc_t idx);
#endif
char * getFlightModeString(char * dest, int8_t idx);
char *getFlightModeString(char *dest, int8_t idx);
#define SWITCH_WARNING_STR_SIZE 3
char * getSwitchWarningString(char * dest, swsrc_t idx);
char *getSwitchWarningString(char *dest, swsrc_t idx);
char * getSourceString(mixsrc_t idx);
char * getSwitchPositionName(swsrc_t idx);
char * getSwitchWarningString(swsrc_t idx);
char * getCurveString(int idx);
char * getTimerString(int32_t tme, uint8_t hours);
char *getSourceString(mixsrc_t idx);
char *getSwitchPositionName(swsrc_t idx);
char *getSwitchWarningString(swsrc_t idx);
char *getCurveString(int idx);
char *getTimerString(int32_t tme, uint8_t hours);
char *getTimerString(int32_t tme, uint8_t hours, bool bLowercase);
void splitTimer(char *s0, char *s1, char *s2, char *s3, int tme,
bool bLowercase = true);
#endif // _STRHELPERS_H_
#endif // _STRHELPERS_H_