drillbit fix temp display to fit in standard space
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
diff --git a/driver-drillbit.c b/driver-drillbit.c
index 8050e6a..9345946 100644
--- a/driver-drillbit.c
+++ b/driver-drillbit.c
@@ -426,15 +426,27 @@ static void drillbit_updatetemps(struct thr_info *thr)
static void drillbit_get_statline_before(char *buf, size_t bufsiz, struct cgpu_info *drillbit)
{
struct drillbit_info *info = drillbit->device_data;
-
- tailsprintf(buf, bufsiz, "%c%-2d", info->product[0], info->num_chips);
-
- if ((info->capabilities & CAP_TEMP) && info->temp != 0) {
- tailsprintf(buf, bufsiz, " %d.%dC (%d.%dC)", info->temp/10, info->temp%10,
- info->max_temp/10, info->max_temp%10);
+ int temp, max_temp, space = 0;
+
+ temp = (int)(info->temp);
+
+ tailsprintf(buf, bufsiz, "%c%d", info->product[0], info->num_chips);
+ if (info->num_chips < 10)
+ space++;
+
+ if ((info->capabilities & CAP_TEMP) && temp != 0) {
+ if (temp > 999) // Fixed display space
+ temp = 999;
+ max_temp = (int)(info->max_temp);
+ if (max_temp > 999) // Fixed display space
+ max_temp = 999;
+ if (max_temp < 100)
+ space++;
+ tailsprintf(buf, bufsiz, " %2d max%d.%d%*s",
+ temp / 10, max_temp / 10, max_temp % 10, space, "");
} else {
// Space out to the same width as if there was a temp field in place
- tailsprintf(buf, bufsiz, " ");
+ tailsprintf(buf, bufsiz, " %*s", space, "");
}
tailsprintf(buf, bufsiz, " | ");