mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-07-07 14:11:36 +02:00
Set wind values
This commit is contained in:
parent
287b720350
commit
f970b7482b
|
@ -72,6 +72,29 @@ public class Weather {
|
||||||
this.commandId = id;
|
this.commandId = id;
|
||||||
this.tlv = new HuaweiTLV();
|
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) {
|
if (lowestTemperature != null && highestTemperature != null && settings.temperatureSupported) {
|
||||||
this.tlv.put(0x85, new HuaweiTLV()
|
this.tlv.put(0x85, new HuaweiTLV()
|
||||||
.put(0x06, lowestTemperature)
|
.put(0x06, lowestTemperature)
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class SendWeatherCurrentRequest extends Request {
|
||||||
this.paramsProvider,
|
this.paramsProvider,
|
||||||
settings,
|
settings,
|
||||||
(byte) weatherSpec.windDirection,
|
(byte) weatherSpec.windDirection,
|
||||||
(byte) weatherSpec.windSpeed,
|
(byte) weatherSpec.windSpeedAsBeaufort(),
|
||||||
(byte) (weatherSpec.todayMinTemp - 273),
|
(byte) (weatherSpec.todayMinTemp - 273),
|
||||||
(byte) (weatherSpec.todayMaxTemp - 273),
|
(byte) (weatherSpec.todayMaxTemp - 273),
|
||||||
pm25,
|
pm25,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user