Last part was strange, we wrote a direct driver that has no real usage. We done it only because we kept compatibility. This time we will do something more useful, WiFi content driver. We will try and do in such way that only content is send. This is more friendly for network and sanity 😛
What does it mean? It means that we will add another driver to CharLCD. This will allow us to use remote LCD with Raspberry Pi and later with any application in Python. It should be possible to use it with LCD Manager package and this is something very interesting 🙂
As a remote LCD we will use HD44780 (40×4) hooked to NodeMCU via i2c (but we know that we can plug any LCD via gpio or i2c 😛 ) and it will listen to broadcast messages.
Rpi (with CharLCD and driver) will broadcast UDP messages into network.
Lets get started.
What I need is ability to read content of LCDs via network. With our manager it should be easy. We will add such service to Display class. It will start server and react according to request. For now I think about two commands, one for getting list of all managers and second for getting a content from needed.
We have a nice game and we may play it. But there is one problem we don’t see number of lives and our score. In this article we will create another view and position it on second display. I played with 40×4 for game and 20×4 for score but ended with one lcd with two vlcds 🙂
We will also do something with difficulty as we have such setting it would be nice that it would do something
And of course we can’t forget about bugs, we will fix few along the way.
Thinking about Piader game view brought me to conclusion that we need a canvas widget. The widget on which we can draw any char at any place. Something similar to pure lcd usage. We will be able to set cursor at any position in canvas and put char. Internal pointer will allow us to stream chars one after another.
We have a home view now lets work on options and option view. We want to be able to set maximum lives and difficulty level. Still I have no idea what would be difference between easy and hard 🙂
LCDmanger doesn’t care about application logic its job is to display. So its up to us and application to use events and change views. Each app may have different actions and effects.
So what now ?
Simple we will create new project Piader and use LCD Manager as external package. This way we will have two separate projects. And we may focus on develop them separately.
We have just two things left. After that we are back to main goal – upgrading LCD class.
First we will go with shooting. Next small refactor of our controls and finally adding missile class and space as fire button. After that we will add collision detection.
Download source code.
Before we add new drivers lets do some more cleaning, upgrading and add nose tests.
First we will clean driver class and remove manual 4/8 bit function usage.
Next we will add abstraction class to our driver to force required functions implementation.
Finally we will add Nose framework for tests. And add few simple tests.
This time I will attach ziped source code