Author: ks156
Date: 2009-01-09 11:15:52 +0100 (Fri, 09 Jan 2009)
New Revision: 3394
Modified:
software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/levelPanel.java
software_suite_v2/software/tools/tuxController/trunk/src/GUI/control/controlTux.java
software_suite_v2/software/tools/tuxController/trunk/src/GUI/mainWindow.java
Log:
* Polishing - Shifted the range of the battery level :
- prog bar : 0% = 4.8V
- prog bar : 100% = 6.5V
Modified:
software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/levelPanel.java
===================================================================
---
software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/levelPanel.java
2009-01-09 09:32:35 UTC (rev 3393)
+++
software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/levelPanel.java
2009-01-09 10:15:52 UTC (rev 3394)
@@ -111,7 +111,7 @@
GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
win.progBatteryLevel.setPreferredSize(win.dimProg);
- win.progBatteryLevel.setMaximum(70);
+ win.progBatteryLevel.setMaximum(1700);
win.progBatteryLevel.setMinimumSize(win.dimProg);
win.progBatteryLevel.setMaximumSize(win.dimProg);
Modified:
software_suite_v2/software/tools/tuxController/trunk/src/GUI/control/controlTux.java
===================================================================
---
software_suite_v2/software/tools/tuxController/trunk/src/GUI/control/controlTux.java
2009-01-09 09:32:35 UTC (rev 3393)
+++
software_suite_v2/software/tools/tuxController/trunk/src/GUI/control/controlTux.java
2009-01-09 10:15:52 UTC (rev 3394)
@@ -585,7 +585,7 @@
* @param The time of the last value.
*/
public void onBatteryLevelEvent(String value, Double delay) {
- win.refreshBatteryLevel(((int)Float.parseFloat(value) / 100), value);
+ win.refreshBatteryLevel(((int)Float.parseFloat(value)), value);
}
/**
Modified:
software_suite_v2/software/tools/tuxController/trunk/src/GUI/mainWindow.java
===================================================================
---
software_suite_v2/software/tools/tuxController/trunk/src/GUI/mainWindow.java
2009-01-09 09:32:35 UTC (rev 3393)
+++
software_suite_v2/software/tools/tuxController/trunk/src/GUI/mainWindow.java
2009-01-09 10:15:52 UTC (rev 3394)
@@ -735,9 +735,22 @@
* @param fvalue A string containing the value.
*/
public void refreshBatteryLevel(Integer value, String fvalue) {
- this.progBatteryLevel.setValue(value);
+ Integer batteryLevel = value;
this.lblBatteryLevel.setText(String.format("%.2f", //$NON-NLS-1$
Float.parseFloat(fvalue) / 1000) +" V"); //$NON-NLS-1$
+ // Check the range
+ if (batteryLevel < 4800) {
+ batteryLevel = 4800;
+ }
+ if (batteryLevel > 6500) {
+ batteryLevel = 6500;
+ }
+ // New values :
+ // 4.8V = 0% of the progress bar
+ // 6.5V = 100% of the progress bar
+ batteryLevel = batteryLevel - 4800;
+ // Set the progress bar value : from 0 to 1700 (6500 - 4800)
+ this.progBatteryLevel.setValue(batteryLevel);
}
/**
------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn