View Single Post
Old 12-10-2013, 11:54 PM   #269 (permalink)
t vago
MPGuino Supporter
 
t vago's Avatar
 
Join Date: Oct 2010
Location: Hungary
Posts: 1,807

iNXS - '10 Opel Zafira 111 Anniversary

Suzi - '02 Suzuki Swift GL
Thanks: 830
Thanked 708 Times in 456 Posts
Quote:
Originally Posted by josemapiro View Post
If it is not asking too much, is that I could explain the points which I must add the code to for eg: a menu to show text on the first line and the second line an outcome one more symbol.
The result can be any of those already in the code, what I want is to understand the process.
Ooo... you just asked for a novel. Sorry about that.

In order to make the code as compact as possible and add all of the features I've added, it was necessary to make some complexity for each display level.

The code defines several display levels:
Level 1 - Standard 4-variable display
Level 2 - Big FE display
Level 3 - CPU Utilization
Level 4 - FE vs Time graphs
Level 5 - FE vs Speed graphs
Level 6 - Time To Empty big number displays
Level 7 - System Clock
Level 8 - System Clock Editor
Level 9 - Settings Selector Menu
Level 10 - Setting Editor
Level 11 - Trip Load/Save/View Select Menu
Level 12 - Trip Viewer
Level 13 - Level 1 Display Editor
Level 14 - A/B Trip Viewer (not yet implemented)
Level 15 - A/B Trip Trigger (not yet implemented)
Level 16 - Coastdown Tool (not yet implemented)
Level 17 - EEPROM Viewer

Of course, these levels are controlled by the various #defines placed at the beginning of the code. Some levels are also grouped together. These levels, and their groupings, are controlled by several arrays.

The first array (screenCursorSize) contains the maximum number of options that each level may have, and is directly related to left/right button cursor movement functionality. For instance, Level 1 contains either 7, 8, 9, or 10 - depending on whether or not idle/EOC tracking is enabled, analog scanning is enabled, or whether Chrysler MAP correction is enabled. This is directly related to how many different 4-variable screens Level 1 is allowed to display.

The second array (screenCursor) contains the cursor position for a given level.

The third array (menuBaseLevelPosition) contains information about the base level, for a given level group. Levels 1 through 7 are grouped together, for instance. This is used by the level up/down code, which directly corresponds to a future implementation of cursor up/down code for 5-button configurations of MPGuino.

The fourth array (menuBaseLevelLength) contains information about the # of levels in a group. This is also used by the level up/down code.

The fifth array (buttonPressAdrList) contains information related to any special keypresses associated with a given level. It contains value pairs, which correspond to keypresses and their associated function index. Note that left-button and right-button definitions do not go here - they are rather handled directly within the main loop itself.

The sixth array (screenCursorUpdate) contains function indexes related to left-button/right button cursor updates. Each time the cursor is moved left or right, this array is accessed, and the corresponding function is called for the current level.

The seventh array (menuDisplayFuncs) contains function indexes related to main loop update refreshes. Every time the main loop refreshes, once every 1/2 second, this array is accessed, and the corresponding function is called for the current level. This array is also accessed immediately after the cursor update function is called.

The eighth array (funcPointers) contains a pointer list of all functions that are referenced by the keypress array, the cursor update array, and the display refresh array. This array is referenced by function index values in buttonPressAdrList, screenCursorUpdate, and menuDisplayFuncs.

The most recent version of the code has been attached to the first post in this thread. In the future, this is where the most recent version will be located.

Last edited by t vago; 12-11-2013 at 12:06 AM..
  Reply With Quote
The Following 4 Users Say Thank You to t vago For This Useful Post:
AndrzejM (12-11-2013), Ardent (12-11-2013), ECONORAM (03-17-2014), josemapiro (12-11-2013)