mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-01-13 03:07:32 +01:00
Fix possible race condition when availableSlots == 3
(There are two difficult things...)
This commit is contained in:
parent
9ea2977143
commit
1d9e1d7caf
@ -811,16 +811,17 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
||||
int iteration = 0;
|
||||
ArrayList<GBAlarm> alarmList = new ArrayList<>();
|
||||
for(CalendarEvents.CalendarEvent mEvt : mEvents) {
|
||||
if (iteration >= availableSlots) {
|
||||
if (iteration >= availableSlots || iteration > 2) {
|
||||
break;
|
||||
}
|
||||
int slotToUse = 2 - iteration;
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(mEvt.getBegin());
|
||||
byte[] calBytes = MiBandDateConverter.calendarToRawBytes(calendar);
|
||||
|
||||
byte[] alarmMessage = new byte[]{
|
||||
MiBandService.COMMAND_SET_TIMER,
|
||||
(byte)(2-iteration),
|
||||
(byte) slotToUse,
|
||||
(byte) 1,
|
||||
calBytes[0],
|
||||
calBytes[1],
|
||||
|
Loading…
x
Reference in New Issue
Block a user