HHEmu V2.32 / OBD2-Analyser NG Firmware V1.4.2
Yet another update: OBD-Analyser NG / Handheld Open firmware V1.4.2 and Handheld Open Emulator (and OBD software for OBD-Analyser NGs with Bluetooth) HHEmu V2.32.
This is an update to significantly speed up OBD data display in the Current Data Menu and in the Freeze Frame Menu. Furthermore, for HHEmu users it is an update that significantly reduces CPU load in the emulator and OBD2 software mode (not in the DXM simulator mode, though). So, I highly recommend updating.
- fixed a bug in the Read Data Screen. There was a buffer overflow in the text under the progress bar.
- fixed a bug in the Read Data Screen, if coming from the Clear DTC Menu or from Reload OBD Data the ESC button could be pressed (short press) while the Read Data Screen was active. That led to a jump to the Select Protocol Menu.
If in the Diagnostics Menu, there should be no other way to go back to the upper menus than a reset (ESC button long press).
- fixed a bug in the Current Data Menu and Freeze Frame Menu. If at the end of the PID list, and scrolling one position up, the list update did not update the first line at once. However, it was updated in the second and all further loops.
- improved LCD update. Display updates after key press events and OBD data received events are much faster now. Furthermore, if nothing has been drawn into the display buffer since the last update, no update is done at all.
- changed behaviour of the 'Read Indicator' (the little bullet in front of a PID) in the Current Data Menu and in the Freeze Frame Menu. The indicator shows the PID(s) to be read next (before any request is sent).
Doing the update in the 100ms timer event function of the menu, was actually the main reason for the V1.4.0 and V1.4.1 firmware being so slow in these menus. There, the indicator showed the PID(s) that have been requested in the timer event function.
Now the update of the Read Indicator is done when changing the list and in the OBD data received event function.
- reworked TIMER2_COMP interrupt service routine to gain a few clock cycles (details affecting the contact bounce suppression routine are here http://www.mikrocontroller.net/topic/48465#3714661 and here http://www.mikrocontroller.net/topic/48465#3722345 (both in German only). The beep routine was reworked in the same way.)
- added cli()/sei() calls missing in the original firmware, when accessing volatile variables outside of the TIMER2_COMP interrupt service routine non-atomically.
- added a 1ms delay in the main loop if no DXM Rx data transfer is active.
In the real firmware that is not noticeably at all, due to the Rx data transfer being done in an interrupt. However, in the emulator and OBD2 software mode the little pause in the main loop makes a big difference in CPU load.
The DXM simulator mode is unaffected, since in the active Bluetooth Menu another loop is running at full speed to copy single bits between the simulated Bluetooth I/O pins and the simulated DXM I/O pins.
- when running two HHEmus in parallel, one in DXM simulator mode and one in OBD2 software mode, it is not so obvious which one is the simulator for connecting them.
I changed the string "HHEmu Vx.xx" in the System Information Menu for the simulator mode. In DXM simulator mode it displays "HHSim Vx.xx".
So, before entering the Bluetooth Menu to actually start the DXM simulator mode, the System Information Menu can be entered to check that this actually is the HHEmu running as DXM simulator.
The HHEmu running in OBD2 software mode displays an empty System Information Menu before the Bluetooth Menu is entered in the HHEmu running in DXM simulator mode.
- changed the beep sounds.
Actually there was a bug in HHEmu that the OCR3A register value was taken as beep frequency, instead of using the formula from the AT90CAN128 specification for phase and frequency correct PWM.
PWM frequency = f_clk_IO / (2 * prescaler * TOP)
f_clk_IO = F_CPU define from makefile (8 MHz)
prescaler = 1
TOP = OCR3A register value
the formula is frequency = 8000000/(2 * OCR3A).
However, since I like the 'false' HHEmu beeps more than the OBD2-Analyser NG beeps, I changed the analyser beeps to sound like the HHEmu beeps ;)
- further optimizations done to reduce code size and improve speed
For installation and further details see the contribution describing the firmware v1.4.0: