Commit 257fe00a79331de4965ed5d316516a70d39a663b

Con Kolivas 2014-02-18T22:19:45

Move driver statline padding to cgminer.c, expanding width of maximum displayable statistics and window width to add more info.

diff --git a/cgminer.c b/cgminer.c
index 0685d50..507012c 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -2299,7 +2299,7 @@ static void curses_print_status(void)
 	wattron(statuswin, A_BOLD);
 	cg_mvwprintw(statuswin, 0, 0, " " PACKAGE " version " VERSION " - Started: %s", datestamp);
 	wattroff(statuswin, A_BOLD);
-	mvwhline(statuswin, 1, 0, '-', 90);
+	mvwhline(statuswin, 1, 0, '-', 98);
 	cg_mvwprintw(statuswin, 2, 0, " %s", statusline);
 	wclrtoeol(statuswin);
 	cg_mvwprintw(statuswin, 3, 0, " ST: %d  SS: %d  NB: %d  LW: %d  GF: %d  RF: %d",
@@ -2320,8 +2320,8 @@ static void curses_print_status(void)
 	wclrtoeol(statuswin);
 	cg_mvwprintw(statuswin, 5, 0, " Block: %s...  Diff:%s  Started: %s  Best share: %s   ",
 		     prev_block, block_diff, blocktime, best_share);
-	mvwhline(statuswin, 6, 0, '-', 90);
-	mvwhline(statuswin, statusy - 1, 0, '-', 90);
+	mvwhline(statuswin, 6, 0, '-', 98);
+	mvwhline(statuswin, statusy - 1, 0, '-', 98);
 #ifdef USE_USBUTILS
 	cg_mvwprintw(statuswin, devcursor - 1, 1, "[U]SB device management [P]ool management [S]ettings [D]isplay options [Q]uit");
 #else
@@ -2342,6 +2342,8 @@ static void adj_fwidth(float var, int *length)
 }
 
 static int dev_width;
+#define STATBEFORELEN 23
+const char blanks[] = "                                        ";
 
 static void curses_print_devstatus(struct cgpu_info *cgpu, int devno, int count)
 {
@@ -2351,6 +2353,7 @@ static void curses_print_devstatus(struct cgpu_info *cgpu, int devno, int count)
 	uint64_t dh64, dr64;
 	struct timeval now;
 	double dev_runtime, wu;
+	unsigned int devstatlen;
 
 	if (opt_compact)
 		return;
@@ -2378,7 +2381,10 @@ static void curses_print_devstatus(struct cgpu_info *cgpu, int devno, int count)
 	cg_wprintw(statuswin, " %03d: %s %*d: ", devno, cgpu->drv->name, dev_width, cgpu->device_id);
 	logline[0] = '\0';
 	cgpu->drv->get_statline_before(logline, sizeof(logline), cgpu);
-	cg_wprintw(statuswin, "%s", logline);
+	devstatlen = strlen(logline);
+	if (devstatlen < STATBEFORELEN)
+		strncat(logline, blanks, STATBEFORELEN - devstatlen);
+	cg_wprintw(statuswin, "%s | ", logline);
 
 	dh64 = (double)cgpu->total_mhashes / dev_runtime * 1000000ull;
 	dr64 = (double)cgpu->rolling * 1000000ull;
@@ -8048,9 +8054,8 @@ static void noop_reinit_device(struct cgpu_info __maybe_unused *cgpu)
 {
 }
 
-void blank_get_statline_before(char *buf, size_t bufsiz, struct cgpu_info __maybe_unused *cgpu)
+void blank_get_statline_before(char __maybe_unused *buf,size_t __maybe_unused bufsiz, struct cgpu_info __maybe_unused *cgpu)
 {
-	tailsprintf(buf, bufsiz, "               | ");
 }
 
 static void noop_get_statline(char __maybe_unused *buf, size_t __maybe_unused bufsiz, struct cgpu_info __maybe_unused *cgpu)
diff --git a/driver-avalon.c b/driver-avalon.c
index 3f862ed..1533ae9 100644
--- a/driver-avalon.c
+++ b/driver-avalon.c
@@ -1479,7 +1479,7 @@ static void get_avalon_statline_before(char *buf, size_t bufsiz, struct cgpu_inf
 			temp = 99;
 		if (temp < 0)
 			temp = 0;
-		tailsprintf(buf, bufsiz, "%2dC %3d %4dmV | ", temp, info->frequency, info->core_voltage);
+		tailsprintf(buf, bufsiz, "%2dC %3d %4dmV", temp, info->frequency, info->core_voltage);
 	} else {
 		/* Find the lowest fan speed of the ASIC cooling fans. */
 		if (info->fan1 >= 0 && info->fan1 < lowfan)
@@ -1487,7 +1487,7 @@ static void get_avalon_statline_before(char *buf, size_t bufsiz, struct cgpu_inf
 		if (info->fan2 >= 0 && info->fan2 < lowfan)
 			lowfan = info->fan2;
 
-		tailsprintf(buf, bufsiz, "%2dC/%3dC %04dR | ", info->temp0, info->temp2, lowfan);
+		tailsprintf(buf, bufsiz, "%2dC/%3dC %04dR", info->temp0, info->temp2, lowfan);
 	}
 }
 
diff --git a/driver-bab.c b/driver-bab.c
index a5ed3ad..c7c46e8 100644
--- a/driver-bab.c
+++ b/driver-bab.c
@@ -2987,13 +2987,13 @@ static void bab_get_statline_before(char *buf, size_t bufsiz, struct cgpu_info *
 		K_RUNLOCK(babinfo->nfree_list);
 	}
 
-	tailsprintf(buf, bufsiz, "%d.%02d.%03d D:%03d | ",
+	tailsprintf(buf, bufsiz, "%d.%02d.%03d D:%03d",
 				 babinfo->banks,
 				 babinfo->boards,
 				 babinfo->chips,
 				 dead);
 #else
-	tailsprintf(buf, bufsiz, "B:%d B:%02d C:%03d | ",
+	tailsprintf(buf, bufsiz, "B:%d B:%02d C:%03d",
 				 babinfo->banks,
 				 babinfo->boards,
 				 babinfo->chips);
diff --git a/driver-bflsc.c b/driver-bflsc.c
index c47afc3..50c5475 100644
--- a/driver-bflsc.c
+++ b/driver-bflsc.c
@@ -932,7 +932,7 @@ static void get_bflsc_statline_before(char *buf, size_t bufsiz, struct cgpu_info
 	}
 	rd_unlock(&(sc_info->stat_lock));
 
-	tailsprintf(buf, bufsiz, " max%3.0fC %4.2fV | ", temp, vcc2);
+	tailsprintf(buf, bufsiz, "max%3.0fC %4.2fV", temp, vcc2);
 }
 
 static void flush_one_dev(struct cgpu_info *bflsc, int dev)
diff --git a/driver-bitforce.c b/driver-bitforce.c
index d4f51c1..34f1ef9 100644
--- a/driver-bitforce.c
+++ b/driver-bitforce.c
@@ -298,11 +298,7 @@ static void get_bitforce_statline_before(char *buf, size_t bufsiz, struct cgpu_i
 	float gt = bitforce->temp;
 
 	if (gt > 0)
-		tailsprintf(buf, bufsiz, "%5.1fC ", gt);
-	else
-		tailsprintf(buf, bufsiz, "       ");
-
-	tailsprintf(buf, bufsiz, "        | ");
+		tailsprintf(buf, bufsiz, "%5.1fC", gt);
 }
 
 static bool bitforce_thread_prepare(__maybe_unused struct thr_info *thr)
diff --git a/driver-bitfury.c b/driver-bitfury.c
index 94e0540..65aab5b 100644
--- a/driver-bitfury.c
+++ b/driver-bitfury.c
@@ -1114,11 +1114,10 @@ static void bitfury_get_statline_before(char *buf, size_t bufsiz, struct cgpu_in
 
 	switch(info->ident) {
 		case IDENT_BXF:
-			tailsprintf(buf, bufsiz, "%5.1fC         | ", cgpu->temp);
+			tailsprintf(buf, bufsiz, "%5.1fC", cgpu->temp);
 			break;
 		case IDENT_BF1:
 		default:
-			tailsprintf(buf, bufsiz, "               | ");
 			break;
 	}
 }
diff --git a/driver-cointerra.c b/driver-cointerra.c
index abc4d73..9633c69 100644
--- a/driver-cointerra.c
+++ b/driver-cointerra.c
@@ -1108,7 +1108,7 @@ static void cta_statline_before(char *buf, size_t bufsiz, struct cgpu_info *coin
 	}
 	max_volt /= 100;
 
-	tailsprintf(buf, bufsiz, "%3d %3.1fC %2.1fV | ", freq, cointerra->temp, max_volt);
+	tailsprintf(buf, bufsiz, "%3d %3.1fC %2.1fV", freq, cointerra->temp, max_volt);
 }
 
 struct device_drv cointerra_drv = {
diff --git a/driver-drillbit.c b/driver-drillbit.c
index daebeed..9550a57 100644
--- a/driver-drillbit.c
+++ b/driver-drillbit.c
@@ -444,8 +444,6 @@ static void drillbit_get_statline_before(char *buf, size_t bufsiz, struct cgpu_i
 		// Space out to the same width as if there was a temp field in place
 		tailsprintf(buf, bufsiz, "           %*s", space, "");
 	}
-
-	tailsprintf(buf, bufsiz, " | ");
 }
 
 
diff --git a/driver-hashfast.c b/driver-hashfast.c
index 7d3298e..61cbdec 100644
--- a/driver-hashfast.c
+++ b/driver-hashfast.c
@@ -1487,7 +1487,7 @@ static void hfa_statline_before(char *buf, size_t bufsiz, struct cgpu_info *hash
 		}
 	}
 
-	tailsprintf(buf, bufsiz, " max%3.0fC %3.2fV | ", hashfast->temp, max_volt);
+	tailsprintf(buf, bufsiz, "max%3.0fC %3.2fV", hashfast->temp, max_volt);
 }
 
 static void hfa_init(struct cgpu_info __maybe_unused *hashfast)
diff --git a/driver-icarus.c b/driver-icarus.c
index 40600f8..6e25452 100644
--- a/driver-icarus.c
+++ b/driver-icarus.c
@@ -1513,10 +1513,6 @@ static void icarus_statline_before(char *buf, size_t bufsiz, struct cgpu_info *c
 
 	if (info->ident == IDENT_CMR2 && info->cmr2_speed > 0)
 		tailsprintf(buf, bufsiz, "%5.1fMhz", (float)(info->cmr2_speed) * ICARUS_CMR2_SPEED_FACTOR);
-	else
-		tailsprintf(buf, bufsiz, "       ");
-
-	tailsprintf(buf, bufsiz, "        | ");
 }
 
 static void icarus_shutdown(__maybe_unused struct thr_info *thr)
diff --git a/driver-klondike.c b/driver-klondike.c
index 5da915c..43adbae 100644
--- a/driver-klondike.c
+++ b/driver-klondike.c
@@ -1446,7 +1446,7 @@ static void get_klondike_statline_before(char *buf, size_t siz, struct cgpu_info
 	if (strlen(tmp) < 4)
 		strcat(tmp, " ");
 
-	tailsprintf(buf, siz, "%3dMHz %2d%% %s| ", (int)clock, fan, tmp);
+	tailsprintf(buf, siz, "%3dMHz %2d%% %s", (int)clock, fan, tmp);
 }
 
 static struct api_data *klondike_api_stats(struct cgpu_info *klncgpu)
diff --git a/driver-minion.c b/driver-minion.c
index f66c020..6bbc9f8 100644
--- a/driver-minion.c
+++ b/driver-minion.c
@@ -2594,7 +2594,7 @@ static void minion_get_statline_before(char *buf, size_t bufsiz, struct cgpu_inf
 	if (max_temp > 99)
 		max_temp = 99;
 
-	tailsprintf(buf, bufsiz, "max%2dC Ch:%2d.%d%*s| ", (int)max_temp,
+	tailsprintf(buf, bufsiz, "max%2dC Ch:%2d.%d%*s", (int)max_temp,
 				 minioninfo->chips, (int)cores, sp, "");
 }
 
diff --git a/driver-modminer.c b/driver-modminer.c
index a3804b7..a7fb856 100644
--- a/driver-modminer.c
+++ b/driver-modminer.c
@@ -734,7 +734,7 @@ static bool modminer_fpga_init(struct thr_info *thr)
 
 static void get_modminer_statline_before(char *buf, size_t bufsiz, struct cgpu_info *modminer)
 {
-	tailsprintf(buf, bufsiz, " %s%.1fC %3uMHz  | ",
+	tailsprintf(buf, bufsiz, "%s%.1fC %3uMHz",
 			(modminer->temp < 10) ? " " : "",
 			modminer->temp,
 			(unsigned int)(modminer->clock));