mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 17:11:56 +01:00
Set wind values
This commit is contained in:
parent
287b720350
commit
f970b7482b
@ -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)
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user