mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-27 20:36:51 +01:00
AsteroidOS: Fix the weather service + set-time
The weather service was suffering from an off-by-one error. This is now fixed. The weather also sends more days in its forecast. There is an issue open in the AsteroidOS weather app to perhaps add more days to its forcast so this should cover for it. There is also a fix for the time not being set upon connection. I'm not quite sure why this wasn't happening before, but it is happening now. It might be a bit kludgy, but it is what it is.
This commit is contained in:
parent
4f93ac627d
commit
86460ea7c6
@ -18,6 +18,7 @@ package nodomain.freeyourgadget.gadgetbridge.devices.asteroidos;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec;
|
||||
|
||||
@ -67,7 +68,7 @@ public class AsteroidOSWeather {
|
||||
/**
|
||||
* The days of the weather
|
||||
*/
|
||||
public Day[] days = new Day[5];
|
||||
public ArrayList<Day> days = new ArrayList<>();
|
||||
/**
|
||||
* The city name of the weather
|
||||
*/
|
||||
@ -80,9 +81,9 @@ public class AsteroidOSWeather {
|
||||
*/
|
||||
public AsteroidOSWeather(WeatherSpec spec) {
|
||||
cityName = spec.location;
|
||||
days[0] = new Day(spec);
|
||||
for (int i = 1; i < 5 && i < spec.forecasts.size(); i++) {
|
||||
days[i] = new Day(spec.forecasts.get(i));
|
||||
days.add(new Day(spec));
|
||||
for (int i = 1; i < spec.forecasts.size(); i++) {
|
||||
days.add(new Day(spec.forecasts.get(i - 1)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.actions.SetDeviceStateAction;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.profiles.IntentListener;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.profiles.battery.BatteryInfoProfile;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.lefun.requests.SetTimeRequest;
|
||||
|
||||
public class AsteroidOSDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(AsteroidOSDeviceSupport.class);
|
||||
@ -112,6 +113,8 @@ public class AsteroidOSDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||
|
||||
batteryInfoProfile.requestBatteryInfo(builder);
|
||||
batteryInfoProfile.enableNotify(builder, true);
|
||||
// Gadgetbridge doesn't seem to do this itself, so we force it to set its time
|
||||
onSetTime();
|
||||
return builder;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user