bartoszbielawski / LEDMatrixDriver

A replacement for Arduino's LedControl library
MIT License
74 stars 25 forks source link

calling clear() after setEnabled(false); #36

Closed quakec closed 5 years ago

quakec commented 5 years ago

Whilst the led matrix controller is in disabled state after calling led.setEnabled(false);, trying to enable it again cleanly seems impossible.

So when I have try:

led.clear(); led.setEnabled(true); or led.setEnabled(true); led.clear();

The issue is, when enabling again there is a sligh flash of the previous text on the display, the order in calling the two functions above doesn't make a difference.

It could be my controller and/or limitation of the hardware but I am wondering if there anything which can be implemented in this driver to clear the driver buffer and the device buffer whilst in the disabled state?

bartoszbielawski commented 5 years ago

Hi James,

Enabling/disabling display doesn't clear the memory in the chip. Calling lcd.clear() clears only the local frame buffer.

I believe the right order of operations is: lcd.setEnabled(false); lcd.clear(); lcd.display(); lcd.setEnabled(true);

Does it solve your problem?

If I were to change the behaviour, what would be the best way to do it? The assumption was from the very beginning that it's the user who decides when to flush to the hardware. setEnabled() maps directly to the hardware command so it would be a bit confusing if it started doing something else as well...

quakec commented 5 years ago

Hi Bartosz

What I am doing is already what you are describing in that very order 😊

Yes I wouldn’t be comfortable having the clear command actually clear the hw at the same time, perhaps another command to flush the hardware?

J

On Fri, 21 Jun 2019 at 23:59, Bartosz Bielawski notifications@github.com wrote:

Hi James,

Enabling/disabling display doesn't clear the memory in the chip. Calling lcd.clear() clears only the local frame buffer.

I believe the right order of operations is: lcd.setEnabled(false); lcd.clear(); lcd.display(); lcd.setEnabled(true);

Does it solve your problem?

If I were to change the behaviour, what would be the best way to do it? The assumption was from the very beginning that it's the user who decides when to flush to the hardware. setEnabled() maps directly to the hardware command so it would be a bit confusing if it started doing something else as well...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bartoszbielawski/LEDMatrixDriver/issues/36?email_source=notifications&email_token=AANUS34BVDKOXXIX2BURS6LP3VMM5A5CNFSM4H2VIEIKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYJY7EY#issuecomment-504598419, or mute the thread https://github.com/notifications/unsubscribe-auth/AANUS3Y5QINJRE2ABRKBFNDP3VMM5ANCNFSM4H2VIEIA .

-- Sent from my iPhone 6s A1688 iOS 11.0.3

bartoszbielawski commented 5 years ago

Yes I wouldn’t be comfortable having the clear command actually clear the hw at the same time, perhaps another command to flush the hardware?

Hmm, that's what display() does?

I have an idea but tell me yours so I can check if what I came up with makes sense :)

quakec commented 5 years ago

Okay that has given me another idea, let me try calling display() after clear() on the driver buffer first.

On Sat, 22 Jun 2019 at 08:24, Bartosz Bielawski notifications@github.com wrote:

Yes I wouldn’t be comfortable having the clear command actually clear the hw at the same time, perhaps another command to flush the hardware?

Hmm, that's what display() does?

I have an idea but tell me yours so I can check if what I came up with makes sense :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bartoszbielawski/LEDMatrixDriver/issues/36?email_source=notifications&email_token=AANUS36XX3DTRUI6JPUGU2DP3XHS5A5CNFSM4H2VIEIKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYKDBGY#issuecomment-504639643, or mute the thread https://github.com/notifications/unsubscribe-auth/AANUS36H27RQPKFYTBPIGQLP3XHS5ANCNFSM4H2VIEIA .

-- Sent from my iPhone 6s A1688 iOS 11.0.3

bartoszbielawski commented 5 years ago

Did your idea work?

quakec commented 5 years ago

It did improve slightly, there was some flickering on the display showing the previous leds for a noticeable, but the duration was significantly shorter. What else can I do? So I tried, clear(), display() setEnable(true)

On Mon, 24 Jun 2019 at 08:49, Bartosz Bielawski notifications@github.com wrote:

Did your idea work?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bartoszbielawski/LEDMatrixDriver/issues/36?email_source=notifications&email_token=AANUS3YVGEMFC3LNIEORXWLP4B4ATA5CNFSM4H2VIEIKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYMCNJI#issuecomment-504899237, or mute the thread https://github.com/notifications/unsubscribe-auth/AANUS35AHAHNXHCA2EYLZFLP4B4ATANCNFSM4H2VIEIA .

-- Sent from my iPhone 6s A1688 iOS 11.0.3

bartoszbielawski commented 5 years ago

Let me get this straight, you want to disable display, clear it and then enable it and see it empty, without flicker of the previous content, right?

If setEnabled(false); clear(); display(); setEnabled(true); still causes flickering then I will have to look into the problem. Maybe I don't understand how is the display sleep mode handled.

quakec commented 5 years ago

Yes I am basically using setEnable how I think should be used, to quickly enable and disable on-the-fly. Perhaps a clearDisplay() function needs adding which does both but handles better.

On Mon, 24 Jun 2019 at 09:13, Bartosz Bielawski notifications@github.com wrote:

Let me get this straight, you want to disable display, clear it and then enable it and see it empty, without flicker of the previous content, right?

If 'setEnabled(false); clear(); display(); setEnabled(true);' still causes flickering then I will have to look into the problem. Maybe I don't understand how is the display sleep mode handled.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bartoszbielawski/LEDMatrixDriver/issues/36?email_source=notifications&email_token=AANUS33N2MX3E5VVY52HS23P4B62FA5CNFSM4H2VIEIKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYMEKFI#issuecomment-504907029, or mute the thread https://github.com/notifications/unsubscribe-auth/AANUS34CJJ2ZPIW5ZG4HMELP4B62FANCNFSM4H2VIEIA .

-- Sent from my iPhone 6s A1688 iOS 11.0.3

bartoszbielawski commented 5 years ago

Can you make a video of the problem happening + the code you use? I will try to check it at home.

The manual specifies: The display drivercan be programmed while in shutdown mode, andshutdown mode can be overridden by the display-testfunction.

So I see no reason why it would blink while being powered up.

bartoszbielawski commented 5 years ago

I didn't manage to reproduce the problem. If I clear the display when it's disabled I just shows nothing when I enable it. Can you send me your code and maybe a recording of the problem?

quakec commented 5 years ago

I didn't manage to reproduce the problem. If I clear the display when it's disabled I just shows nothing when I enable it. Can you send me your code and maybe a recording of the problem?

It could be just the chip I am using.

Sorry I haven't had the time to play with this, I will create a recording and send you this weekend. The code I am using is interconnected with a windows application which sends data over serial to the arduino.

bartoszbielawski commented 5 years ago

No hurry, if it's a bug, it's not critical ;) You can send me your code as well. Maybe I can spot the problem...