-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OLED Re-init on ext_pwr on #674
Comments
Hm, I'd think there is (or ought to be) a separation of display initialization from scene/frame rendering, so display init can be rerun after being powered back on. I'm looking at this code now as I try to figure out how to use a non-oled display type which probably has a "boot up" sequence for the display. With SPI not I2C, for extra Fun™. Hopefully, I will have something intelligent to say about this soon. |
This actually needs to be an update to the ssd1306 driver in zephyr proper. There are power management apis that aren't implemented in the upstream driver that need to be implemented. ext_pwr implements the power management api so updating the upstream driver is the first step to addressing this. |
Ah got it, thanks for the explanation! |
bumping just because still stymied by this problem :( |
@carcinization The fix in the description has been implemented, and it mostly fixes the issue. If you're still experiencing it, you may need to increase the external power |
@Nicell It seems to be fixed only for turning device on and off completely, but if you turn it off and on, for instance, with UPD: Additionally it causes another issue. When you turn device on and external power is off initially, display doesn't get initialized as well even if you turn external power on later. As workaround you can turn external power on and wait about a minute till state gets saved and then turn device off and on so display gets initialized. |
@tokolist This is a known issue. RGB + OLEDs don't play nicely together. The solution presented in this issue only helps for reinitializing after deep sleep/startup. The OLED driver needs to reinitialize itself when moving between power management states that result in power being removed. We also probably need our external power driver to move into and out of the low power devices state when cutting power. |
It seems like there is no good way to reinitialize screen driver in Zephyr, at least I couldn't find one. There is open issue with idea that should allow to reinitialize driver zephyrproject-rtos/zephyr#39896 I was thinking about some workarounds, but they don't look good to me from architectural standpoint. |
I tried some solutions. I managed to trigger
Any ideas how to proceed or is it even a good direction? |
wow, looks like I've made it working by resetting i2c too, I'll try to post working workaround in a few days, if not ping me please |
cool! this is great news! I've already workarounded it in hardware way by connecting OLED directly to battery, but would love to try software workaround, since it should save even more battery life. |
@ddudek - curious to see the workaround and thought I would ping you. |
I wanted to test it a bit more before publishing to avoid confustion, few notes:
My workaround needed modification of zephyr drivers and their apis, so first (assuming you're in the
then zmk changes:
I've also made a small changes to auto power-off ext_pwr when OLED goes to sleep in zmk, which drastically improves battery life and makes oled + rgb usable I'm new to zephyr and zmk, and also not an experienced C dev, so anyone feel free to check this as first step and maybe find a proper/better solution |
I went ahead and pulled these changes and applied the changes from zephyr_* and app_*. It seems like it almost works but I do see a bizarre result where the display content is rotated 180 degrees and squashed into what was formerly the "bottom" half of the OLED. As far as I can tell, the oled_auto_power changes shouldn't have any impact on this but I will try to test that at some point as well. I am running with n!n v1s but I don't think that should matter - the same display driver seems to be used for both version. I will try to dig in a little bit at some point to see if I can understand what is going on (but I'm a bit out of my depth here, so I can't promise much). Aside from that issue, though, the core concept seems to work well. |
@Percentnineteen Looks like it was not needed for my screen which is not rotated (I skipped some of the initialization to try shorter sleep) but that might be an easy fix, try this: the change is in |
That works. After applying that patch, I can confirm that the functionality works. A huge step forward. I guess the next steps are to try to formalize and shove this into 2 PRs (maybe 3?). I guess one to zephyr itself and at least one to zmk (not sure if you want to split off the "turn off ext_power when display is idle" portion). EDIT: I forgot - I guess the next thing might be resolving the issue with booting where ext_power is OFF on boot. |
Just one more update in case anyone else is using this - with the oled_auto_off* changes, I had some weird behavior. Sometimes the OLEDs would power off, sometimes they wouldn't come back. Sometimes they would come back with garbage. Getting them back on and working would usually require toggling ext_power and waiting a minute and resetting. This was more of a hassle for me than the potential battery savings so I just backed those changes out. I might look into it a bit more some time as a gateway into understanding the system but there's no pressure from me. It wasn't something easily reproducible so I'm not even 100% sure that backing out the change fixed it yet... |
Original code can be found here: zmkfirmware#674 (comment)
This commit adjusts the github build action to apply the zephyr patch from this PR: zmkfirmware/zmk#674 (comment) It can then be used with a zmk fork that patches zmk’s external power code: infused-kim/zmk@f750924
Original code can be found here: zmkfirmware#674 (comment)
This commit properly reinitializes the OLED display after ext power is re-enabled. It requires a patch pn zephyr itself. Until the patch is implemented in zephyr, it can be applied in your zmk-config’s github build action. More info here: zmkfirmware#674 Original code by ddudek can also be found in the above issue.
This commit properly reinitializes the OLED display after ext power is re-enabled. It requires a patch pn zephyr itself. Until the patch is implemented in zephyr, it can be applied in your zmk-config’s github build action. More info here: zmkfirmware#674 Original code by ddudek can also be found in the above issue.
This commit adjusts the github build action to apply the zephyr patch from this PR: zmkfirmware/zmk#674 (comment) It can then be used with a zmk fork that patches zmk’s external power code: infused-kim/zmk@ec0a365
This commit properly reinitializes the OLED display after ext power is re-enabled. It requires a patch pn zephyr itself. Until the patch is implemented in zephyr, it can be applied in your zmk-config’s github build action. More info here: zmkfirmware#674 Original code by ddudek can also be found in the above issue.
@ddudek thank you so much for creating this fix and sharing it here. It works perfectly for me. For anyone else, who'd like to try this, but doesn't want to set up a zmk build environment...You can modify your zmk-config's GitHub Actions You can see an example of how to do that in this commit: And you can find a zmk fork with the patch applied here: |
This commit allows zmk to properly reinitialize the OLED display after ext power is re-enabled. More info here: zmkfirmware/zmk#674 This code was written by ddudek and not me. I am just adding it as a commit.
For anyone else interested in this, I figured out there is no need to modify the GitHub build.yml to apply the patch. I created a fork of zephyr with @ddudek's changes here: And then I modified my zmk fork's west.yml to use that zephyr fork: Now if you build against that zmk fork you will get a working oled implementation: You can just reference that repo and branch in your zmk-config's west.yml. @ddudek are you interested in submitting PRs to the two repos? If not, perhaps I could submit them |
This commit properly reinitializes the OLED display after ext power is re-enabled. It requires a patch pn zephyr itself. Until the patch is implemented in zephyr, it can be applied in your zmk-config’s github build action. More info here: zmkfirmware#674 Original code by ddudek can also be found in the above issue.
This commit properly reinitializes the OLED display after ext power is re-enabled. It requires a patch pn zephyr itself. Until the patch is implemented in zephyr, it can be applied in your zmk-config’s github build action. More info here: zmkfirmware#674 Original code by ddudek can also be found in the above issue.
This commit properly reinitializes the OLED display after ext power is re-enabled. It requires a patch pn zephyr itself. Until the patch is implemented in zephyr, it can be applied in your zmk-config’s github build action. More info here: zmkfirmware#674 Original code by ddudek can also be found in the above issue.
Basic code mimics changes suggested by ddudek mentioned in zmkfirmware#674 Added extra code to deal with interrupt triggers
This commit allows zmk to properly reinitialize the OLED display after ext power is re-enabled. More info here: zmkfirmware/zmk#674 This code was written by ddudek and not me. I am just adding it as a commit.
This commit properly reinitializes the OLED display after ext power is re-enabled. It requires a patch pn zephyr itself. Until the patch is implemented in zephyr, it can be applied in your zmk-config’s github build action. More info here: zmkfirmware#674 Original code by ddudek can also be found in the above issue.
This commit properly reinitializes the OLED display after ext power is re-enabled. It requires a patch pn zephyr itself. Until the patch is implemented in zephyr, it can be applied in your zmk-config’s github build action. More info here: zmkfirmware#674 Original code by ddudek can also be found in the above issue.
This commit allows zmk to properly reinitialize the OLED display after ext power is re-enabled. More info here: zmkfirmware/zmk#674 This code was written by ddudek and not me. I am just adding it as a commit.
This commit allows zmk to properly reinitialize the OLED display after ext power is re-enabled. More info here: zmkfirmware/zmk#674 This code was written by ddudek and not me. I am just adding it as a commit.
…s re-enabled. It requires a patch pn zephyr itself. Until the patch is implemented in zephyr, it can be applied in your zmk-config’s github build action. More info here: zmkfirmware#674 Original code by ddudek can also be found in the above issue.
This commit allows zmk to properly reinitialize the OLED display after ext power is re-enabled. More info here: zmkfirmware/zmk#674 This code was written by ddudek and not me. I just modified it to work on zephyr-3.0.
This commit properly reinitializes the OLED display after ext power is re-enabled. It requires a patch pn zephyr itself. Until the patch is implemented in zephyr, it can be applied in your zmk-config’s github build action. More info here: zmkfirmware#674 Original code by ddudek can also be found in the above issue.
FWIW I took the original patch and updated it for a more modern Zephyr, since it didn't apply cleanly when I tried: https://github.com/bobobo1618/zephyr/tree/fix-oled Didn't have to make any changes to the ZMK patch I think. |
Hi, I'm desperately trying to apply this patch to my local ZMK setup. I'm using the Zephyr repo you suggested, it seems to contain the Zephyr part of the patch. Applying ddudek's patch to ZMK succeeds, but my build always fails with this error:
Can someone please point me in the right direction? |
I just blindly did this: https://github.com/bobobo1618/zmk/blob/8af6847b8883daf52eb9cb9a9867bd8627124624/app/src/ext_power_generic.c#L19 It's almost certainly incorrect but it fixes the compile failures. I believe it's unnecessary if you have a display enabled though. |
This commit allows zmk to properly reinitialize the OLED display after ext power is re-enabled. More info here: zmkfirmware#674
…k to properly reinitialize the OLED display after ext power is re-enabled. More info here: zmkfirmware#674
Suggestion from: zmkfirmware#674 (comment)
|
It seems like the problem caused by the external power being cut off. So it is a known problem, but for a keyboard newbie like me, it was not obvious how to fix it. Here are the things I did:
But yeah, it is turned on now. It is amazed that none of the step-by-step fix were mentioned anywhere. Most of the modification I found was so complex that I don't even know where to put the fix. Hope it helps someone. |
1 similar comment
It seems like the problem caused by the external power being cut off. So it is a known problem, but for a keyboard newbie like me, it was not obvious how to fix it. Here are the things I did:
But yeah, it is turned on now. It is amazed that none of the step-by-step fix were mentioned anywhere. Most of the modification I found was so complex that I don't even know where to put the fix. Hope it helps someone. |
To get the OLED to turn back on, the required steps are:
1. Turn VCC on (EP_ON is the most reliable)
2. Wait 60s for the setting to write to flash
3. Power cycle or reset the board by pressing the reset button once.
…On Wed, Aug 9, 2023, 5:46 PM Turbo Ninh ***@***.***> wrote:
It seems like the problem caused by the external power being cut off. So
it is a known problem, but for a keyboard newbie like me, it was not
obvious how to fix it. Here are the things I did:
- Assign &ext_power EP_TOG to your_board.keymap file
- Build and flash the keyboard
- Click on the EP_TOG button (at this stage, I clicked quite a few
times, and the OLED is still dark). Eventually, I accidently found out that
I need to click on the bootloader button *once* for the OLED to turn
on.
But yeah, it is turned on now. It is amazed that none of the step-by-step
fix were mentioned anywhere. Most of the modification I found was so
complex that I don't even know where to put the fix. Hope it helps someone.
—
Reply to this email directly, view it on GitHub
<#674 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC4HWRGECLS6PJ4KJER6QTDXUQHLLANCNFSM4XLW5Y3A>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
This commit properly reinitializes the OLED display after ext power is re-enabled. It requires a patch pn zephyr itself. Until the patch is implemented in zephyr, it can be applied in your zmk-config’s github build action. More info here: zmkfirmware#674 Original code by ddudek can also be found in the above issue. These changes are based on infused-kim zmk repo
@t18n @Percentnineteen Are your steps outlined performed in addition to the patches outlined above? Or is this the "easy no-patch-fix" that can be used without the patches? |
Those steps work without the patch.
…On Thu, Nov 16, 2023, 8:38 AM NellyWhads ***@***.***> wrote:
@t18n <https://github.com/t18n> @Percentnineteen
<https://github.com/Percentnineteen> Are your steps outlined performed in
addition to the patches outlined above? Or is this the "easy no-patch-fix"
that can be used without the patches?
—
Reply to this email directly, view it on GitHub
<#674 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC4HWRC72WJ3BFIGKDQW2WTYEYQPZAVCNFSM4XLW5Y3KU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBRGQ2TMOBZGU3Q>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Is someone currently working on this? I have got my new keyboard with an oled and would be willing to dig into it. But if somebody is already on it I would try to support if I can. |
Check out #1775 Which includes the SSD1306 driver fixes, as well as a fully integrated power domain setup to make RGB + OLED not fight over VCC power enabling, and allows multiple power domains for hardware designs that include such things. |
Turning off external power using a keymap is causing the keyboard to be super laggy. If I keep it on, the display does not work anyway [0] and it keeps drawing a lot of power anyway. [0]: zmkfirmware/zmk#674
Nearly a year since the last comment, any chance anyone is doing something about this? |
Hi, I plan to build a three parts split kb, with one central usb connected to pc with oled display, few macro buttons and two encoders plus two BLE sides left and right. Left and Right parts will have no display or rgb. My question is if the central part is USB connected, does this issue apply to it? In case it is affected, can i just connect the oled power to the 3.3v power pin? (the central has no battery, so power saving is not a concern) |
when ext_pwr comes back online the oled is not re-initialized and stays blank. this is particularly noticeable when coming out of sleep
the below was provided by @Nicell as a hack to work around the problem and suggested the ext_power should be moved to kernel level
The text was updated successfully, but these errors were encountered: