1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-25 11:26:47 +01:00

Amazfit Bip: avoid sending weather info when not initialized

This commit is contained in:
cpfeiffer 2017-09-04 23:23:51 +02:00
parent 1ddea9268d
commit e44eb03698

View File

@ -140,16 +140,19 @@ public class AmazfitBipSupport extends MiBand2Support {
@Override @Override
public void onSendWeather(WeatherSpec weatherSpec) { public void onSendWeather(WeatherSpec weatherSpec) {
if (gbDevice.getFirmwareVersion() == null) {
LOG.warn("Device not initialized yet, so not sending weather info");
return;
}
try { try {
TransactionBuilder builder = performInitialized("Sending weather forecast"); TransactionBuilder builder = performInitialized("Sending weather forecast");
boolean supportsConditionString = false; boolean supportsConditionString = false;
if (gbDevice.getFirmwareVersion() != null) {
Version version = new Version(gbDevice.getFirmwareVersion()); Version version = new Version(gbDevice.getFirmwareVersion());
if (version.compareTo(new Version("0.0.8.74")) >= 0) { if (version.compareTo(new Version("0.0.8.74")) >= 0) {
supportsConditionString = true; supportsConditionString = true;
} }
}
final byte NR_DAYS = 2; final byte NR_DAYS = 2;
int bytesPerDay = 4; int bytesPerDay = 4;