altosui: Fix pyro channel value formatting
authorKeith Packard <keithp@keithp.com>
Tue, 3 Jun 2014 05:06:22 +0000 (22:06 -0700)
committerKeith Packard <keithp@keithp.com>
Tue, 3 Jun 2014 05:06:22 +0000 (22:06 -0700)
Was using %6.1f for 1 and 2 fraction digit values as the
conditional structure for figuring out which format to use was
broken.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosui/AltosConfigPyroUI.java

index 9df2d87dc302e5c4755804daccfa6b6740ab9737..6cbac31677e243a009b419c4ffaad79467649a4d 100644 (file)
@@ -105,11 +105,13 @@ public class AltosConfigPyroUI
                                AltosUnits units = AltosPyro.pyro_to_units(flag);
                                if (units != null)
                                        unit_value = units.value(new_value);
-                               String  format = "%6.0f";
-                               if (scale >= 10)
-                                       format = "%6.1f";
-                               else if (scale >= 100)
+                               String  format;
+                               if (scale >= 100)
                                        format = "%6.2f";
+                               else if (scale >= 10)
+                                       format = "%6.1f";
+                               else
+                                       format = "%6.0f";
                                value.setText(String.format(format, unit_value));
                        }
                        if (combo != null)