-
-
Notifications
You must be signed in to change notification settings - Fork 19.6k
Update marlinui_DOGM.cpp to fix pin 0 configuration. #21417
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
Conversation
Reset pin_list[U8G_PI_A0_STATE] to init state to prevent changing pin 0 pinMode
|
Could this change be made in the |
|
PR made on U8glib-HAL. Fix is done differently but achieves the same result. Limited to SW SPI init in the new PR. |
|
I see some other files we might want to check…? There are a bunch of custom U8G implementations in the Marlin HALs — mostly files starting with Anyway, thanks! I will look more closely at your u8glib changes later this afternoon. |
|
Right, per the discussion in the issue, |
|
I tweaked the PR on u8glib-HAL to check for |
|
We are having similar issue with SMT32.... The issue is: Marlin keeps a global uglib instance, that makes it init in the The correct fix here is: don't have a u8glib global var OR u8glib don't try init hardware on constructor, having a "init" method to be called on setup. |
|
My apologies - I commented on the wrong thing. :\ |
Description
Reset pin_list[U8G_PI_A0_STATE] to init state to prevent changing pin 0 pinMode.
There is a bug in u8glib on Arduino that's setting this pin (U8G_PI_A0_STATE) to 0 following initialization through the use of u8g_SetAddress() and using this pin to update the pin direction on subsequent initializations.
The U8G_CLASS constructor provides the first initialization which doesn't change the pin direction (U8G_PI_A0_STATE = U8G_PIN_NONE) but does change the U8G_PI_A0_STATE value to 0 immediately following the init.
Upon first call to u8g.firstPage(), a second initialization is called with the pin value changed to 0 which will override the pin 0 configuration.
Rewriting the pin value to U8G_PIN_NONE prior to u8g.firstPage() prevents changing of the pin config.
Requirements
Presumably any board that uses pin 0 as any pin config except OUTPUT plus any DOGM LCD.
Benefits
Pin 0 function will not be overridden using a DOGM LCD.
Configurations
config.zip
Related Issues
#21277