瀏覽代碼

Use the percent util func in the string func. (#13523)

Marcio Teixeira 6 年之前
父節點
當前提交
d992dfe7d5
共有 1 個檔案被更改,包括 1 行新增1 行删除
  1. 1
    1
      Marlin/src/core/utility.cpp

+ 1
- 1
Marlin/src/core/utility.cpp 查看文件

59
 
59
 
60
   // Convert a full-range unsigned 8bit int to a percentage
60
   // Convert a full-range unsigned 8bit int to a percentage
61
   char* ui8tostr_percent(const uint8_t i) {
61
   char* ui8tostr_percent(const uint8_t i) {
62
-    const uint16_t percent = 100 * i / 255;
62
+    const uint8_t percent = ui8_to_percent(i);
63
     conv[3] = RJDIGIT(percent, 100);
63
     conv[3] = RJDIGIT(percent, 100);
64
     conv[4] = RJDIGIT(percent, 10);
64
     conv[4] = RJDIGIT(percent, 10);
65
     conv[5] = DIGIMOD(percent, 1);
65
     conv[5] = DIGIMOD(percent, 1);

Loading…
取消
儲存