Adjustments to ui8tostr_percent

This commit is contained in:
Scott Lahteine 2019-04-08 21:47:23 -05:00
parent 321a5e6580
commit 9cb5c57b84
3 changed files with 7 additions and 7 deletions

View file

@ -58,11 +58,11 @@ void safe_delay(millis_t ms) {
#define MINUSOR(n, alt) (n >= 0 ? (alt) : (n = -n, '-'))
// Convert a full-range unsigned 8bit int to a percentage
char* ui8tostr_percent(const uint8_t i) {
const uint8_t percent = ui8_to_percent(i);
conv[3] = RJDIGIT(percent, 100);
conv[4] = RJDIGIT(percent, 10);
conv[5] = DIGIMOD(percent, 1);
char* ui8tostr4pct(const uint8_t i) {
const uint8_t n = ui8_to_percent(i);
conv[3] = RJDIGIT(n, 100);
conv[4] = RJDIGIT(n, 10);
conv[5] = DIGIMOD(n, 1);
conv[6] = '%';
return &conv[3];
}

View file

@ -56,7 +56,7 @@ inline void serial_delay(const millis_t ms) {
#if ANY(ULTRA_LCD, DEBUG_LEVELING_FEATURE, EXTENSIBLE_UI)
// Convert a full-range unsigned 8bit int to a percentage
char* ui8tostr_percent(const uint8_t i);
char* ui8tostr4pct(const uint8_t i);
// Convert uint8_t to string with 123 format
char* ui8tostr3(const uint8_t x);

View file

@ -43,7 +43,7 @@ bool printer_busy();
static inline char* strfunc(const float value) { return STRFUNC((TYPE) value); } \
};
DECLARE_MENU_EDIT_TYPE(uint8_t, percent, ui8tostr_percent,1 ); // 100% right-justified
DECLARE_MENU_EDIT_TYPE(uint8_t, percent, ui8tostr4pct, 1 ); // 100% right-justified
DECLARE_MENU_EDIT_TYPE(int16_t, int3, i16tostr3, 1 ); // 123, -12 right-justified
DECLARE_MENU_EDIT_TYPE(int16_t, int4, i16tostr4sign, 1 ); // 1234, -123 right-justified
DECLARE_MENU_EDIT_TYPE(int8_t, int8, i8tostr3, 1 ); // 123, -12 right-justified