mirror of https://github.com/rusefi/rusefi-1.git
auto-sync
This commit is contained in:
parent
f214ee8c1d
commit
a312e8d4ff
|
@ -10,6 +10,7 @@ CONTROLLERS_ALGO_SRC_CPP = $(PROJECT_DIR)/controllers/algo/advance_map.cpp \
|
||||||
$(PROJECT_DIR)/controllers/algo/accel_enrichment.cpp \
|
$(PROJECT_DIR)/controllers/algo/accel_enrichment.cpp \
|
||||||
$(PROJECT_DIR)/controllers/algo/engine_configuration.cpp \
|
$(PROJECT_DIR)/controllers/algo/engine_configuration.cpp \
|
||||||
$(PROJECT_DIR)/controllers/algo/engine.cpp \
|
$(PROJECT_DIR)/controllers/algo/engine.cpp \
|
||||||
|
$(PROJECT_DIR)/controllers/algo/lcd_menu_tree.cpp \
|
||||||
$(PROJECT_DIR)/controllers/algo/event_registry.cpp \
|
$(PROJECT_DIR)/controllers/algo/event_registry.cpp \
|
||||||
$(PROJECT_DIR)/controllers/algo/algo.cpp \
|
$(PROJECT_DIR)/controllers/algo/algo.cpp \
|
||||||
$(PROJECT_DIR)/controllers/algo/signal_executor.cpp \
|
$(PROJECT_DIR)/controllers/algo/signal_executor.cpp \
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
/**
|
||||||
|
* @file lcd_menu_tree.cpp
|
||||||
|
*
|
||||||
|
* @date Jan 6, 2015
|
||||||
|
* @author Andrey Belomutskiy, (c) 2012-2014
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stddef.h"
|
||||||
|
#include "lcd_menu_tree.h"
|
||||||
|
#include "error_handling.h"
|
||||||
|
|
||||||
|
static MenuItem ROOT(NULL, NULL);
|
||||||
|
|
||||||
|
static MenuTree tree(&ROOT);
|
||||||
|
|
||||||
|
static MenuItem miSensors(tree.root, "sensors");
|
||||||
|
static MenuItem miTrigger(tree.root, "trigger");
|
||||||
|
static MenuItem miBench(tree.root, "bench test");
|
||||||
|
static MenuItem miAbout(tree.root, "about");
|
||||||
|
|
||||||
|
MenuTree::MenuTree(MenuItem *root) {
|
||||||
|
this->root = root;
|
||||||
|
current = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MenuTree::init(MenuItem *first, int linesCount) {
|
||||||
|
this->linesCount = linesCount;
|
||||||
|
current = first;
|
||||||
|
topVisible = first;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MenuTree::nextItem(void) {
|
||||||
|
if (current->next == NULL) {
|
||||||
|
// todo: go to first element
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
current = current->next;
|
||||||
|
if (current->index - topVisible->index == linesCount)
|
||||||
|
topVisible = topVisible->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
MenuItem::MenuItem(MenuItem * parent, const char *text) {
|
||||||
|
this->parent = parent;
|
||||||
|
this->text = text;
|
||||||
|
lcdLine = LL_STRING;
|
||||||
|
|
||||||
|
// root element has NULL parent
|
||||||
|
if (parent != NULL) {
|
||||||
|
if (parent->firstChild == NULL) {
|
||||||
|
parent->firstChild = this;
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
if (parent->lastChild != NULL) {
|
||||||
|
index = parent->lastChild->index + 1;
|
||||||
|
parent->lastChild->next = this;
|
||||||
|
}
|
||||||
|
parent->lastChild = this;
|
||||||
|
} else {
|
||||||
|
firstChild = NULL;
|
||||||
|
lastChild = NULL;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
/**
|
||||||
|
* @file lcd_menu_tree.h
|
||||||
|
*
|
||||||
|
* @date Jan 6, 2015
|
||||||
|
* @author Andrey Belomutskiy, (c) 2012-2014
|
||||||
|
*/
|
||||||
|
#ifndef CONTROLLERS_ALGO_LCD_MENU_TREE_H_
|
||||||
|
#define CONTROLLERS_ALGO_LCD_MENU_TREE_H_
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
LL_STRING,
|
||||||
|
LL_VERSION,
|
||||||
|
LL_CONFIG,
|
||||||
|
LL_RPM,
|
||||||
|
LL_CLT_TEMPERATURE,
|
||||||
|
LL_IAT_TEMPERATURE,
|
||||||
|
LL_ALGORITHM,
|
||||||
|
} lcd_line_e;
|
||||||
|
|
||||||
|
class MenuItem {
|
||||||
|
public:
|
||||||
|
MenuItem(MenuItem * parent, const char *text);
|
||||||
|
const char *text;
|
||||||
|
lcd_line_e lcdLine;
|
||||||
|
int index;
|
||||||
|
// that's upper level menu item
|
||||||
|
MenuItem *parent;
|
||||||
|
MenuItem *firstChild;
|
||||||
|
MenuItem *lastChild;
|
||||||
|
MenuItem *next;
|
||||||
|
};
|
||||||
|
|
||||||
|
class MenuTree {
|
||||||
|
public:
|
||||||
|
MenuTree(MenuItem *root);
|
||||||
|
void nextItem(void);
|
||||||
|
void init(MenuItem *first, int linesCount);
|
||||||
|
MenuItem *root;
|
||||||
|
|
||||||
|
int linesCount;
|
||||||
|
MenuItem *current;
|
||||||
|
MenuItem *topVisible;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* CONTROLLERS_ALGO_LCD_MENU_TREE_H_ */
|
|
@ -17,6 +17,8 @@
|
||||||
#include "efiGpio.h"
|
#include "efiGpio.h"
|
||||||
#include "svnversion.h"
|
#include "svnversion.h"
|
||||||
#include "joystick.h"
|
#include "joystick.h"
|
||||||
|
#include "utlist.h"
|
||||||
|
#include "lcd_menu_tree.h"
|
||||||
|
|
||||||
EXTERN_ENGINE
|
EXTERN_ENGINE
|
||||||
;
|
;
|
||||||
|
|
|
@ -12,15 +12,6 @@
|
||||||
|
|
||||||
#define MAX_LCD_WIDTH 20
|
#define MAX_LCD_WIDTH 20
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
LL_VERSION,
|
|
||||||
LL_CONFIG,
|
|
||||||
LL_RPM,
|
|
||||||
LL_CLT_TEMPERATURE,
|
|
||||||
LL_IAT_TEMPERATURE,
|
|
||||||
LL_ALGORITHM,
|
|
||||||
} lcd_line_e;
|
|
||||||
|
|
||||||
#define TOTAL_OPTIONS 6
|
#define TOTAL_OPTIONS 6
|
||||||
|
|
||||||
void updateHD44780lcd(Engine *engine);
|
void updateHD44780lcd(Engine *engine);
|
||||||
|
|
|
@ -2165,6 +2165,12 @@
|
||||||
<file>
|
<file>
|
||||||
<name>$PROJ_DIR$\..\controllers\algo\io_pins.h</name>
|
<name>$PROJ_DIR$\..\controllers\algo\io_pins.h</name>
|
||||||
</file>
|
</file>
|
||||||
|
<file>
|
||||||
|
<name>$PROJ_DIR$\..\controllers\algo\lcd_menu_tree.cpp</name>
|
||||||
|
</file>
|
||||||
|
<file>
|
||||||
|
<name>$PROJ_DIR$\..\controllers\algo\lcd_menu_tree.h</name>
|
||||||
|
</file>
|
||||||
<file>
|
<file>
|
||||||
<name>$PROJ_DIR$\..\controllers\algo\main_trigger_callback.h</name>
|
<name>$PROJ_DIR$\..\controllers\algo\main_trigger_callback.h</name>
|
||||||
</file>
|
</file>
|
||||||
|
|
Loading…
Reference in New Issue