1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-06-20 12:00:51 +02:00

Set wind values

This commit is contained in:
Martin.JM 2024-02-03 23:26:25 +01:00 committed by José Rebelo
parent 287b720350
commit f970b7482b
2 changed files with 24 additions and 1 deletions

View File

@ -72,6 +72,29 @@ public class Weather {
this.commandId = id;
this.tlv = new HuaweiTLV();
HuaweiTLV tlv81 = new HuaweiTLV();
if (settings.weatherIconSupported) {
tlv81.put(0x02, (byte) 0x01);
}
if (settings.windSupported) {
short wind = 0;
if (windSpeed != null)
wind = (short) windSpeed;
if (windDirection != null) {
if (windDirection > 0)
wind |= ((short) (windDirection * 8 / 360)) << 8;
else
wind |= ((short) (360 + windDirection) * 8 / 360) << 8;
}
tlv81.put(0x03, wind);
}
if (settings.weatherIconSupported || settings.windSupported)
this.tlv.put(0x81, tlv81);
if (lowestTemperature != null && highestTemperature != null && settings.temperatureSupported) {
this.tlv.put(0x85, new HuaweiTLV()
.put(0x06, lowestTemperature)

View File

@ -49,7 +49,7 @@ public class SendWeatherCurrentRequest extends Request {
this.paramsProvider,
settings,
(byte) weatherSpec.windDirection,
(byte) weatherSpec.windSpeed,
(byte) weatherSpec.windSpeedAsBeaufort(),
(byte) (weatherSpec.todayMinTemp - 273),
(byte) (weatherSpec.todayMaxTemp - 273),
pm25,