Wednesday, June 4, 2014

pi2go Updates

So it really has been awhile since I last posted, this has seriously been a busy year. However I feel like starting strong again and posting a few new features I put in pi2go. I am really liking how the project is turning out. New features keep coming to me and I lack the time to program them. If your're unfamiliar with the project check this out:

Anyway here is what's new:

OBDII Rewritten!

If you were wondering "didn't he rewrite this already?" You would be correct, however a good friend of mine (c0nrad) pointed out a better way to write this code. A little background knowledge of QT points that it is a system based on events. In laymans terms:

     Event1 happens -> Event2 happens -> QT process events -> Event3 happens

Only Event1 and Event2 are processed. Event3 doesn't process until QT once again processes its events. This enacted by a process of signals and slots within QT.
So how does the code work?

    def ODBII(self):
        """Starts to read the ODB data"""
        self.stopOBD = not self.stopOBD
        while not self.stopOBD:
            OBDvalues = pi2OBD.pi2OBD().OBDread() 

The first important line is the use of emit(). Emit does exactly what you would think, it sends the signal "OBDsignal" with the values of OBDvalues. The signal is classified in earlier within the class

OBDsignal = QtCore.pyqtSignal([list], name='OBDsignal')


The connect statement is extremely important in this case. It tells QT if the signal "OBDsignal" is emitted it will run the function "updateGUI." This function does exactly that and updates the LCD values on the GUI.

Back to the original code snippet. After the signal is emitted the function "updateGUI" runs. Then QT processes the events in the very next line. The main downfall with forcing QT to process events is that the UI doesn't respond on user response but rather when the program processes manually.

So I lured you here with promises of new features......well here is the main new one:

Maintenance Logs!

Now I'm really happy with this feature, I think it will be incredibly useful to every user. The idea is you have the ability to log all your standard maintenance tasks into one single log. This way you will never forget when you last did an oil change. 

This feature also directly writes to an excel file to be read at any time. Ideas to come include pulling the last update directly to the GUI and the ability to search for specific tasks within the log.

Also! I think I forgot to mention that I finally added the clock thanks to the QWT library in python. I will write on that once I use it a little more.

Well I think thats all the updates for this session. Too many projects but I would like to keep this one going. 

If you would like to follow, please do:

As always
**For those that care written in Python2.7 utilizing pyQt4 over pySerial. Issue tracker