From 349e7b71568469511280c9e86ae349222ebf01a1 Mon Sep 17 00:00:00 2001 From: Olaf Rempel Date: Sun, 22 Jun 2008 23:50:55 +0200 Subject: [PATCH] show real voltage value --- gtk2-gui.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gtk2-gui.c b/gtk2-gui.c index 5fa2c20..a2a01ee 100644 --- a/gtk2-gui.c +++ b/gtk2-gui.c @@ -96,7 +96,9 @@ static void update_status_boxes(struct blmc_status *status) snprintf(buf, sizeof(buf), "%d", status->current); gtk_entry_set_text(GTK_ENTRY(entry404), buf); - snprintf(buf, sizeof(buf), "%d", status->voltage); + double voltage = (status->voltage * 5.00 * (18000 + 4700)) / (6 * 1024 * 4700); + + snprintf(buf, sizeof(buf), "%2.3f", voltage); gtk_entry_set_text(GTK_ENTRY(entry405), buf); }