Nadeflore / tetriband

A tetris like watchface game for the mi band 7
GNU General Public License v3.0
19 stars 1 forks source link

CRITICAL: Watch face crash when swiping to a side panel while playing #1

Closed Devnol closed 2 years ago

Devnol commented 2 years ago

Sliding left, right, up or down when playing a tetris round and returning back to the home screen causes the watch to reboot, showing the Mi Logo. This seems to somehow be leaking data, quickly destroying the watch.

To reproduce (this will permanently brick your production watch):

  1. start a game
  2. swipe towards any direction to open a side panel
  3. swipe back to the home screen
  4. watch crashes and reboots
  5. repeat steps 1-4 a bunch of times
  6. watch enters recovery, asks to plug in 5 times to charger to factory reset
  7. after factory reset only connection qr code shows, connecting the watch only shows the blue pair icon. No functions are available on the device, alarms, faces and other data cannot be copied to the watch (presumably due to lack of space), however causing it to vibrate using find band or a notification does work, without the screen changing at all. Screen does appear to be partially responsive since covering the face turns off and tapping turns on the screen, only still showing the blue sync icon.
Devnol commented 2 years ago

watch fw version: 1.20.3.1

Nadeflore commented 2 years ago

Thank you for reporting this bug I'm sorry your watch was affected by this.

I tried to reproduce the crash but could not reproduce with firnware 1.19..1.5 (zepp life tells me it's the latest firnware, I use the chinese version)

Since you mentioned the crash happens when swiping out of the facewatch screen, it might be caused by the pause_call event Maybe the new firmware does not like when the ui state changes in this callback

I can try to change this behavior but I will not be able to test if this actually solves the problem.

I hope you will be able to fix your watch. Have you tried to do the steps mentioned here: ? https://www-bandbbs-cn.translate.goog/threads/4320/?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=ja&_x_tr_pto=wapp It seems to be the same things you described, except you did not do the last step, you need to install a new firmware since the factory reset has reset the firmware as well (which is why it only display the pairing logo)

I'll make a new version of the watch face which might solve the problem. If you are able to fix your watch, I hope you will be able to try it and confirm it actually solves the issue.

Devnol commented 2 years ago

Hello, I thought that it would perhaps be possible to restore the firmware by installing an update, but at the time I only had 22% battery and thus the app wouldn't let me install updates (it needs to be over 30%) I unpaired it out of despair this morning (I obviously tried doing that multiple times to no avail) and left it charge for the day. I just came home and all the band is showing now is the pairing QR code (no text, as mentioned in the site you linked). However, scanning for devices in either zepp life or xiaomi wear, or scanning the QR code, does nothing, as the watch seems to no longer be in pairing mode. I also tried connecting it to the charger, but nothing changed.

Devnol commented 2 years ago

Huh. I turned my phone's bluetooth on and it showed up now. Pairing it to Xiaomi Wear showed no new updates but I tried zepp life and it looks like it's doing something.

Devnol commented 2 years ago

It works now! Thank you so much! If you want any help with future testing of your game I'd be happy to help (as long as it doesn't permabrick my watch again lol)

Nadeflore commented 2 years ago

Great ! I'm happy to see your watch is working again. I'm re opening this issue as the crash issue is still not solved. I'm currently trying to update the firmware to see if I can reproduce the bug. If I'm not able to reproduce the bug, it would really help if you could test the newer version, I'll keep you posted

Devnol commented 2 years ago

Right, okay. I'll be happy to help with testing any changes you make.

Nadeflore commented 2 years ago

I was not able to update the firmware on my Chinese mi band 7, it seems the new firmware has not been released for the Chinese version.

I made a blind fix which hopefully fixes the crash: https://github.com/Nadeflore/tetriband/releases/tag/v0.2-rc1 Can you please test it and tell me if it fixes the crash ? Thank you

Devnol commented 2 years ago

Hello, unfortunately that didn't seem to fix it, the band still crashes when swiping. I also noticed that when I receive a call while playing, the game pauses and when the call modal goes away I only get the vibration toggle button and no way to resume the game.

Another unrelated bug is that when you place a tetromino in the bottom corners, the z-height is above the blue rim and thus it looks a little off.

Nadeflore commented 2 years ago

Thank you for testing, I'm wondering if it's not related to the callback itself, but to something that is done when pausing the game. Just to confirm, do you get the pause menu to be displayed correctly without a crash when going to standby mode, or getting a notification ? The crash only happens when swiping ?

The bug you mentioned when receiving a call may have similar cause as the crash, maybe it has something to do with ram usage, The pause menu background image is quite big, so maybe the image fails to load in some contexts.

I made a new version where the pause is delayad one second after coming back. Can you tell me if the crash still occurs as soom as you go back to the watch face, or only one second after ? https://github.com/Nadeflore/tetriband/releases/tag/v0.2-test

Nadeflore commented 2 years ago

The firmware 1.27.0.4 has just been released, I was able to update to this version, and now I can reproduce the crash.

Turn out it was indeed a memory issue, the menu screen was a full screen 32 bit image, I reduced the size of the image, and it seems to be fixed. Will release a new version with this fix soon

Devnol commented 2 years ago

That's great. And yes, it appeared to work when putting it to sleep but swiping and returning would crash after a little

Devnol commented 2 years ago

Just tested the new stable release, it works perfectly now and the pause menu loads properly. But I'm curious, could you please care to explain how exactly you found out what it was, and where you found the watch face documentation for all of this in the first place?

Thanks in advance

Nadeflore commented 2 years ago

Glad to hear that. I was able to pinpoint the problem when you told me that the vibration toogle icon was displayed, but not the menu image. And because the menu image was the heaviest image, it made sense that was what was causing the crash.

About the documentation, the mi band 7 runs zepp os, and the documentation is available here : https://docs.zepp.com/docs/watchface/app-json/ If you want to make a watchface for the mi band 7 you can start by editing and existing one (the bin file is actually just a zip file, you can just extract it) The only thing you need is to convert images, you can use this tool I made https://github.com/Nadeflore/watchface-js

Also, you may already know this, but it's also possible to make standalone apps for the mi band 7. I do plan to make an standalone app version of tetriband at some point. If you want more info about that, the main mi band 7 hacking community I know of is here https://www.bandbbs.cn/forums/228/ It's all in Chinese, but there are a lot of resources for the mi band 7.

Anyway, thank you a lot for your help,

Just so you know, I do plan to add new features when I have more time, if there's any feature you would like, feel free to ask. Here are some of the features I plan to add:

Devnol commented 2 years ago

Interesting, thanks for the info. I did know that faces were just zips (I happened to open a binfile in a hex editor once and realised that) and I did see and try your tool. What I didn't know is that you can write standalone apps for it or how you can even install those in the first place. One thing I would like to see is a gameboy-palette version of the game because I find it too bright and eye-strainging, but I believe I can try to figure that out on my own, I'll make a fork and experiment a little. Perhaps you could add that as a second colour option (if that's even possible). Anyway, I think this issue can be closed now, thanks again for everything.

Devnol commented 2 years ago

Hey again, sorry to bother you but I found some applet apps on bandbbs and I somehow managed to install them (not entirely sure how), but I can't seem to be able to uninstall them at all. Is there a way to do that and what is the best way to install an applet in the first place? (I can't seem to be able to download the recommended app on bandbbs and I can't sync it with zepp life because I already have it connected to mi wear)

Nadeflore commented 1 year ago

You're totally right about the color scheme, the mi band screen colors are too saturated. It looks fine on my computer screen in the simulator, but when I upload it to the watch, the colors hurt, I will try to adjust the images colors, or maybe as you said make a different color scheme.

To uninstall an app, you can either factory reset the watch (but this will reset everything), or use one of the apps that contains an uninstall app feature. I reccomend the toolbox app https://www.bandbbs.cn/threads/4671/

And I'm not sure what's the best way to install a watchface/app. When the band was just released I just used the replacement method on zepp life. Now I mainly use the notify for mi band app (it has a 'upload custom watchface' feature) An I couldn't get the chinese apps to work either.

Devnol commented 1 year ago

I tried notify for mi band but apparently uploading a watch face requires premium. Do you know any other app on the play store that's free and works? I tried Amazfaces but it doesn't seem to load the custom face at all, even though it has an option, as well as another app that needs a png file too for the preview that just fails to sync.