public void run() {
DecimalFormat mf = new DecimalFormat("#0.00");
Magnetic magnetic = Magnetic.getInstance();
+ double accelX = 0, accelY = 0, accelZ = 0;
+ double magneticX = 0, magneticY = 0, magneticZ = 0;
+
+ accelX = panel.read_accelx/panel.g;
+ accelY = panel.read_accely/panel.g;
+ accelZ = panel.read_accelz/panel.g;
+ /* for convert (-0 or 1.8014523799287584E-15 etc.) to 0 */
+ if(accelX > -0.01 && accelX < 0.01) accelX = 0;
+ if(accelY > -0.01 && accelY < 0.01) accelY = 0;
+ if(accelZ > -0.01 && accelZ < 0.01) accelZ = 0;
+
+ magneticX = magnetic.getReadCompassX();
+ magneticY = magnetic.getReadCompassY();
+ magneticZ = magnetic.getReadCompassZ();
+ /* for convert (-0 or 1.8014523799287584E-15 etc.) to 0 */
+ if(magneticX > -0.01 && magneticX < 0.01) magneticX = 0;
+ if(magneticY > -0.01 && magneticY < 0.01) magneticY = 0;
+ if(magneticZ > -0.01 && magneticZ < 0.01) magneticZ = 0;
if(checkboxAcceleration.isDisposed())
{
{
if(changed_accel == true){
if( checkboxAcceleration.getSelection()){
- accelerationData = "Acceleration : " + mf.format(panel.read_accelx/panel.g) + ", "+ mf.format(panel.read_accely/panel.g) +
- ", "+ mf.format(panel.read_accelz/panel.g);
+ accelerationData = "Acceleration : " + mf.format(accelX) + ", "+ mf.format(accelY) +
+ ", "+ mf.format(accelZ);
}
else {
accelerationData = "Acceleration : Disable";
}
else
{
- accelerationData = "Acceleration : " + mf.format(panel.read_accelx/panel.g) + ", "+ mf.format(panel.read_accely/panel.g) +
- ", "+ mf.format(panel.read_accelz/panel.g);
+ accelerationData = "Acceleration : " + mf.format(accelX) + ", "+ mf.format(accelY) +
+ ", "+ mf.format(accelZ);
}
}
{
if(changed_geo == true){
if( checkboxMagnetic.getSelection()) {
- magneticData = "Magnetic : " + mf.format(magnetic.getReadCompassX()) +
- ", " + mf.format(magnetic.getReadCompassY()) + ", " + mf.format(magnetic.getReadCompassZ());
+ magneticData = "Magnetic : " + mf.format(magneticX) +
+ ", " + mf.format(magneticY) + ", " + mf.format(magneticZ);
if( checkboxTilt.getSelection() ) {
tiltData = "Tilt : " + mf.format(magnetic.getAzimuth()) +
}
else
{
- magneticData = "Magnetic : " + mf.format(magnetic.getReadCompassX()) +
- ", " + mf.format(magnetic.getReadCompassY()) + ", " + mf.format(magnetic.getReadCompassZ());
+ magneticData = "Magnetic : " + mf.format(magneticX) +
+ ", " + mf.format(magneticY) + ", " + mf.format(magneticZ);
if( checkboxTilt.getSelection() ) {
tiltData = "Tilt : " + mf.format(magnetic.getAzimuth()) +