1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-09-26 16:26:52 +02:00

Fixed PineTime WeatherSpec handling

This commit is contained in:
TaaviE 2022-11-18 00:42:05 +02:00 committed by Gitea
parent 1c93ffc3e5
commit 091fd07c7b
2 changed files with 7 additions and 7 deletions

View File

@ -42,14 +42,14 @@ public class WeatherSpec implements Parcelable, Serializable {
private static final long serialVersionUID = VERSION;
public int timestamp;
public String location;
public int currentTemp;
public int currentTemp; // kelvin
public int currentConditionCode = 3200;
public String currentCondition;
public int currentHumidity;
public int todayMaxTemp;
public int todayMinTemp;
public float windSpeed; //km per hour
public int windDirection; //deg
public int todayMaxTemp; // kelvin
public int todayMinTemp; // kelvin
public float windSpeed; // km per hour
public int windDirection; // deg
public ArrayList<Forecast> forecasts = new ArrayList<>();

View File

@ -736,7 +736,7 @@ public class PineTimeJFSupport extends AbstractBTLEDeviceSupport implements DfuL
.put("Timestamp", System.currentTimeMillis() / 1000L)
.put("Expires", 60 * 6) // 6h this should be the weather provider's interval, really
.put("EventType", WeatherData.EventType.Temperature.value)
.put("Temperature", (int) (weatherSpec.currentTemp * 100))
.put("Temperature", (int) ((weatherSpec.currentTemp - 273.15) * 100))
.put("DewPoint", (int) (-32768))
.end()
.build()
@ -763,7 +763,7 @@ public class PineTimeJFSupport extends AbstractBTLEDeviceSupport implements DfuL
.put("Timestamp", System.currentTimeMillis() / 1000L)
.put("Expires", 60 * 60 * 24) // 24h, because the temperature is today's
.put("EventType", WeatherData.EventType.Temperature.value)
.put("Temperature", (int) (((weatherSpec.todayMinTemp + weatherSpec.todayMaxTemp) / 2) * 100))
.put("Temperature", (int) ((((weatherSpec.todayMinTemp - 273.15) + (weatherSpec.todayMaxTemp - 273.15)) / 2) * 100))
.put("DewPoint", (int) (-32768))
.end()
.build()