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

library is very sensitive to timings #17

Closed
nahuel opened this issue Oct 12, 2017 · 3 comments
Closed

library is very sensitive to timings #17

nahuel opened this issue Oct 12, 2017 · 3 comments
Labels

Comments

@nahuel
Copy link

nahuel commented Oct 12, 2017

If you run the isolated tests, this library works ok. But if you integrate it in a node process running other stuff, then you get very erratic results. For example (using npm install sleep):

var Lcd = require('lcd')
var sleep = require('sleep')
var lcd = new Lcd(
            {rs: 26,  
             e: 44,  
             data: [66, 67, 69, 68], 
             cols: 20, 
             rows: 4});
lcd.setCursor(0,0)
lcd.print('Hello', () => {})
sleep.sleep(3)  // simulate other stuff running in the node process

When you run this on a Beaglebone Black with a SHENZHEN 2004A Display, you get only the last o character printed at the 0,0 position. If you remove the sleep line, the snippet works ok.

@fivdi
Copy link
Owner

fivdi commented Oct 13, 2017

I can't figure out what the problem is by looking at the code and will need to build a circuit to try and reproduce the problem.

@fivdi
Copy link
Owner

fivdi commented Oct 14, 2017

As mentioned in the documentation an Lcd object will emit a ready event when the display is ready for usage. The usage example shows how to use the ready event. An Lcd object should not be used before the ready event is emitted.

Something like this should work:

var Lcd = require('lcd')
var sleep = require('sleep')
var lcd = new Lcd(
            {rs: 26,  
             e: 44,  
             data: [66, 67, 69, 68], 
             cols: 20, 
             rows: 4});
lcd.on('ready', () => {
  lcd.setCursor(0,0)
  lcd.print('Hello', () => {})
  sleep.sleep(3)  // simulate other stuff running in the node process
});

@fivdi fivdi added the invalid label Oct 14, 2017
@fivdi
Copy link
Owner

fivdi commented Oct 15, 2017

I'm going to go ahead and close this issue as it doesn't appear to be an issue with the lcd module. If it turns out that it is an issue with the lcd module the issue can be reopened.

@fivdi fivdi closed this as completed Oct 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants