Skip to content
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

make startup delay optional #1

Open
tablatronix opened this issue Mar 31, 2016 · 8 comments
Open

make startup delay optional #1

tablatronix opened this issue Mar 31, 2016 · 8 comments
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement

Comments

@tablatronix
Copy link

delayMicroseconds(50000); is blocking on esp8266, prevents some wifi routines and can trigger watchdog also, and probably not needed for most instances anyway.

@altishchenko
Copy link

That is what LCD datasheet tells, unfortunately. They are not very fast devices to startup, though some of them do allow you to shorten the delay to 20-30ms as opposed to standard 40. Still this delay is mandatory after you switched on the power on the display, if you remove it - garbage happens sporadically and lcd ends up in misconfigured mode. What ESP type are you using? Can you show bit of your code?

@tablatronix
Copy link
Author

tablatronix commented May 21, 2016

I do not have a code example, pretty sure I was just using the examples, regardless of what the datasheet says, delaymicroseconds is blocking and causes issues with the native wifi autoconnect.

Using esp 12e, nodemcu, adafruit huzzah,

I just unwired my lcd, using i2c lib now, so cannot retest atm.

@altishchenko
Copy link

Sounds like catch22 to me.
Just for a try I removed those delays from init()/begin() sequence in my
fork of the library and things became very unstable - 50/50 and even worse.
I'll try to couple the LCD with my NodeMCU and see what issues you might
have there. You are not using ATA command set for Node, you burning it
directly, right?

i2c is a good solution, my LCD is a standard one and does not support i2c
and as such takes a lot of pins, so i am trying to make it work over
74HC595 shift register - at least that will cover the databus.

С уважением,
Александр Тищенко
+7 (916) 704-6157
atishch@gmail.com

2016-05-21 15:47 GMT+03:00 Shawn A notifications@github.com:

I do not, pretty sure I was just using the examples, regardless of what
the datasheet says, delaymicroseconds is blocking and causes issues with
the native wifi autoconnect.

Using esp 12e, nodemcu, adafruit huzzah,

I just unwired my lcd, using i2c lib now.


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#1 (comment)

@tablatronix
Copy link
Author

At least change to delay(50)( delay is not blocking ), but even then , i can handle startup delays in my own code, if i already have 1000ms delays for wifi I do not need another 50ms kicking around in a lib beyond my control.

I remove the line entirely for my use, hence the add an option. 50ms is a long time when it might not be necessary for all modules, and it is beyond your control when it is inside a library, hence the request for some option to disable or global to modify.

@altishchenko
Copy link

Does changing to delay(50) works for you?
The major problem with the LCD is the strict timing of its init sequence...
Did you try postponing the lcd creation to some later point in the code? Like:
LiquidCrystal lcd; int initialized = 0; ... void loop() { if (!initialized) { lcd(12, 11, 5, 4, 3, 2); initialized = 1; } ... }

@altishchenko
Copy link

The reason I am asking - my LCD refuses to work if I change delayMicroseconds(50000) to delay(50)...

@tablatronix
Copy link
Author

interesting, ill try to test when i get a chance, i just removed it entirely, so I am not sure.

@altishchenko
Copy link

Surprisingly enough, it does work with 'lazy' setup. Say, if you postpone the LCD initialization till at least setup(). Like that:

LiquidCrystal *lcd;
void setup() {
lcd = new LiquidCrystal(13,12,11,10,9,8);
lcd->begin(16,2);
...
}

I even went ahead and tried it with yield() based wait function like this:
void usdelay(unsigned long us) {
unsigned long stop = micros() + us;
while (micros() < stop) {
yield();
}
}
This one also doesn't work in pre-setup stage, but does in 'lazy' mode.
And the important point here - the display initializes consistently.

@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Apr 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

No branches or pull requests

3 participants