This commit is contained in:
parent
fcb38c09b0
commit
de380df8d6
|
@ -4,6 +4,7 @@ import { Text, View } from './components/Themed';
|
|||
import { StyleSheet } from 'react-native';
|
||||
import * as geolib from 'geolib';
|
||||
|
||||
export const ver:string = "2.06;"
|
||||
var debug:number = 0;
|
||||
var endIsNigh:boolean = false;
|
||||
var testCount = 0;
|
||||
|
@ -153,6 +154,7 @@ export class GT2 {
|
|||
startPoint:Coordinate = new Coordinate(0.0,0.0);
|
||||
|
||||
displayInterval:number = displayBeat * heartbeat;
|
||||
arc:number = 0.0;
|
||||
public distance:number = 0.0;
|
||||
co2Rate:number = 250.0;
|
||||
sensitivity:number = 3;
|
||||
|
@ -210,6 +212,7 @@ export class GT2 {
|
|||
|
||||
this.trip.stop();
|
||||
this.inProgress = false;
|
||||
this.arc = this.startPoint.distanceTo(this.trip.loc);
|
||||
this.trip.CO2 = ( this.distance / 1000 ) * this.co2Rate;
|
||||
this.nTrips++;
|
||||
|
||||
|
@ -225,7 +228,7 @@ export class GT2 {
|
|||
this.co2Rate = last.co2Rate;
|
||||
this.units = last.units;
|
||||
this.sensitivity = last.sensitivity;
|
||||
|
||||
this.arc = last.arc;
|
||||
}
|
||||
|
||||
public setLocEnabled(value:boolean) { locEnabled = value}
|
||||
|
@ -245,6 +248,7 @@ export class GT2 {
|
|||
public reset() {
|
||||
|
||||
this.distance = 0.0;
|
||||
this.arc = 0.0;
|
||||
this.endPoint = new Coordinate(0,0);
|
||||
this.startPoint = new Coordinate(0,0);
|
||||
this.v = 0;
|
||||
|
@ -269,6 +273,8 @@ export class GT2 {
|
|||
|
||||
var preferredUnits:number = ((this.units == 'km') ? (this.distance / 1000)
|
||||
: (this.distance / 1609.34));
|
||||
var preferredUnitsArc:number = ((this.units == 'km') ? (this.arc / 1000)
|
||||
: (this.arc / 1609.34));
|
||||
|
||||
return (
|
||||
'Elapsed - ' + this.trip.elapsed + '\n' +
|
||||
|
@ -278,7 +284,8 @@ export class GT2 {
|
|||
' long: ' + this.trip.loc.mLongitude.toFixed(8) + '\n' +
|
||||
'CO2: ' + this.trip.CO2.toFixed(1) + ' grams ' + this.CO2Effect + '\n\n' +
|
||||
'CO2 Rate / Sensitivity: ' + this.co2Rate + " / " + this.sensitivity + '\n' +
|
||||
'Distance covered while consuming fuel: ' + preferredUnits.toFixed(2) + ' ' + this.units );
|
||||
'Arc distance from origin to destination: ' + preferredUnitsArc.toFixed(2) + this.units + '\n' +
|
||||
'Path distance while consuming fuel: ' + preferredUnits.toFixed(2) + ' ' + this.units );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
],
|
||||
"ios": {
|
||||
"supportsTablet": true,
|
||||
"bundleIdentifier": "app.greentravel.gt2",
|
||||
"buildNumber": "2",
|
||||
"infoPlist": {
|
||||
"UIBackgroundModes": [
|
||||
|
|
|
@ -2,7 +2,7 @@ import React from 'react';
|
|||
import { StyleSheet, TouchableOpacity } from 'react-native';
|
||||
import { Text, View } from './Themed';
|
||||
import * as Device from 'expo-device';
|
||||
import { withSafeAreaInsets } from 'react-native-safe-area-context';
|
||||
import { ver } from '../GT2';
|
||||
|
||||
export default function ScreenInfo() {
|
||||
return (
|
||||
|
@ -61,7 +61,7 @@ export function ScreenInfo3() {
|
|||
style={styles.titleText}
|
||||
lightColor="rgba(0,0,0,0.8)"
|
||||
darkColor="rgba(255,255,255,0.8)">
|
||||
Green Travel Calculator v. 2.0.6
|
||||
{'Green Travel Calculator v. ' + ver }
|
||||
</Text>
|
||||
<Text
|
||||
style={styles.versionText}
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useState } from 'react';
|
|||
import { Alert, BackHandler, Button, StyleSheet } from 'react-native';
|
||||
import { Text, View } from '../components/Themed';
|
||||
import { ScreenInfo2 } from '../components/ScreenInfo';
|
||||
import { locEnabled, TripDisplay, LastTrip, Trips, setEndIsLast } from '../GT2';
|
||||
import { ver, locEnabled, TripDisplay, LastTrip, Trips, setEndIsLast } from '../GT2';
|
||||
import { RootTabScreenProps } from '../types';
|
||||
import { getAdvised, setAdvised } from './ModalScreen';
|
||||
|
||||
|
@ -72,7 +72,7 @@ export default function TripScreen( { navigation }: RootTabScreenProps<'Trip'>)
|
|||
title={sButtonText}
|
||||
onPress={() => {
|
||||
if (!getAdvised()) {
|
||||
Alert.alert("Note: GT2 2.0.n doesn't while run in background.");
|
||||
Alert.alert("Note: " + ver + " doesn't run while in background or sleeping.");
|
||||
setAdvised();
|
||||
}
|
||||
if (!Trips.inProgress) {startTrip();
|
||||
|
@ -102,7 +102,7 @@ export default function TripScreen( { navigation }: RootTabScreenProps<'Trip'>)
|
|||
title={sButtonText}
|
||||
onPress={() => {
|
||||
if (!getAdvised()) {
|
||||
Alert.alert("Note: GT2 2.0.n doesn't run while in background.");
|
||||
Alert.alert("Note: GT2 2.0.6 doesn't run while in background or sleeping.");
|
||||
setAdvised();
|
||||
}
|
||||
if (!Trips.inProgress) {startTrip();
|
||||
|
|
Loading…
Reference in New Issue