50ButtonsEach / flic2lib-ios

The framework for Flic 2 on iOS
19 stars 6 forks source link

Button will disconnect randomly with error Code=106 "Apple specific error code." #22

Closed ehmjaysee closed 3 years ago

ehmjaysee commented 3 years ago

Here is my test environment:

1) Testing with a single Flic-2 button 2) flic2lib.xcframework dated April 6 2020 3) Xcode 12.2 4) iOS 13.6.1 and iOS 14.2

We have been using the Flic1 and Flic2 buttons for a couple years now. Recently I noticed the button would disconnect randomly so I started looking into this today. I cannot say exactly when this problem started happening.

Testing starts by scanning for the button and connecting. Once connected I randomly press the button once every 2-10 seconds. After some time I notice the button will disconnect unexpectedly and I see this error code on the console:

BA46-A28152 disconnect with error Error Domain=com.shortcutlabs.flic2lib Code=106 "Apple specific error code." UserInfo={NSLocalizedDescription=Apple specific error code.}

When this happens I notice the LED blinks RED once, then short pause, then blinks RED twice very quickly.

Once the button gets into this state, tapping the button again will do one of two things: 1) Immediate reconnect 2) LED blinks RED twice and reconnect fails. Pressing again will sometimes repeat this behavior 4 times in a row. Other times it will reconnect.

ehmjaysee commented 3 years ago

TLDR: The battery cage could no longer hold the battery and make a solid connection

This took a while to figure out because the SDK reported battery voltage around 3.0 which is very good. However when I opened the flic it was obvious the two metal prongs which push against the battery were no longer pushing. Over time they became so weak the battery was literally bouncing around in the cage. I think I had this battery maybe 1 year on my desk.

AntonMeier commented 3 years ago

Hello, this does not sound good. The error 106 simply means that the device has dropped the connection. However, the two red blinks would indicate that there is something wrong with the battery. Two short blinks indicate that the battery level is low, but three blinks indicate that that the chip reboots. It can be very hard to tell them apart though.

Do think you can manage to capture it on video? Additionally, do you get a different behaviour if you try to switch to a different battery?

The two metal prangs on the battery, you could try and bend them in (there should be two white lines indicating where they should be). If they are indeed apart, then it would most likely be caused by a production issue.. but I can't tell for sure.

ehmjaysee commented 3 years ago

Sorry my last message was not very clear, it was late when I wrote it. The problem was caused by the battery cage getting loose and not holding the battery securely. At first I assumed the battery was good because the SDK was reporting 3.0V consistently. But when I opened the button I could see the problem. The battery was so loose I believe the battery was losing connection randomly when I pushed the button. I measured the battery with multimeter and recorded 2.94V which seemed good. Bending the metal tabs on the battery cage seemed to fix the problem. I'm going to check the battery cage on a couple other buttons and see how they compare.