auto-sync

This commit is contained in:
rusEfi 2015-01-07 08:03:48 -06:00
parent f79c8902d8
commit e764d4388a
3 changed files with 70 additions and 8 deletions

View File

@ -54,6 +54,7 @@
#include "engine.h"
#include "pin_repository.h"
#include "pwm_generator.h"
#include "lcd_controller.h"
extern OutputPin outputs[IO_PIN_COUNT];
extern pin_output_mode_e *pinDefaultState[IO_PIN_COUNT];
@ -410,4 +411,6 @@ void initEngineContoller(Engine *engine) {
addConsoleActionI("get_int", getInt);
initFsioImpl(engine);
initLcdController();
}

View File

@ -23,6 +23,30 @@
EXTERN_ENGINE
;
static MenuItem ROOT(NULL, NULL);
static MenuTree tree(&ROOT);
static MenuItem miRpm(tree.root, LL_RPM);
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");
static MenuItem miTestFan(&miAbout, "test fan");
static MenuItem miTestFuelPump(&miAbout, "test pump");
static MenuItem miTestSpark1(&miAbout, "test spark1");
static MenuItem miTestSpark2(&miAbout, "test spark2");
static MenuItem miTestSpark3(&miAbout, "test spark3");
static MenuItem miTestSpark4(&miAbout, "test spark4");
static MenuItem miTestInj1(&miAbout, "test injector1");
static MenuItem miTestInj2(&miAbout, "test injector2");
static MenuItem miTestInj3(&miAbout, "test injector3");
static MenuItem miTestInj4(&miAbout, "test injector4");
static MenuItem miVersion(&miAbout, LL_VERSION);
static MenuItem miConfig(&miAbout, LL_CONFIG);
#define DISP_LINES (engineConfiguration->HD44780height - 1)
static int infoIndex = 0;
@ -45,6 +69,10 @@ char * appendStr(char *ptr, const char *suffix) {
return ptr;
}
void initLcdController(void) {
tree.init(&miRpm, 3);
}
static char * prepareVBattMapLine(engine_configuration_s *engineConfiguration, char *buffer) {
char *ptr = buffer;
*ptr++ = 'V';
@ -156,20 +184,50 @@ static void showLine(lcd_line_e line) {
}
void updateHD44780lcd(Engine *engine) {
for (int i = infoIndex; i < infoIndex + DISP_LINES; i++) {
lcd_HD44780_set_position(i - infoIndex, 0);
lcd_HD44780_print_char(cursorY == i ? '*' : ' ');
showLine((lcd_line_e) i);
MenuItem *p = tree.topVisible;
int count = 0;
for (; count < tree.linesCount && p != NULL; count++) {
lcd_HD44780_set_position(count, 0);
char firstChar;
if (p == tree.current) {
firstChar = p->firstChild == NULL ? '*' : '>';
} else {
firstChar = ' ';
}
lcd_HD44780_print_char(firstChar);
if (p->lcdLine == LL_STRING) {
lcd_HD44780_print_string(p->text);
} else {
showLine(p->lcdLine);
}
int column = getCurrentHD44780column();
for (int r = column; r < 20; r++) {
lcd_HD44780_print_char(' ');
}
p = p->next;
}
for(; count < tree.linesCount && p != NULL; count++) {
lcd_HD44780_set_position(count, 0);
for (int r = 0; r < 20; r++) {
lcd_HD44780_print_char(' ');
}
}
// for (int i = infoIndex; i < infoIndex + DISP_LINES; i++) {
// lcd_HD44780_set_position(i - infoIndex, 0);
//
// lcd_HD44780_print_char(cursorY == i ? '*' : ' ');
//
// showLine((lcd_line_e) i);
//
// int column = getCurrentHD44780column();
//
// for (int r = column; r < 20; r++) {
// lcd_HD44780_print_char(' ');
// }
// }
// lcd_HD44780_set_position(0, 0);
// bool_t isEven = getTimeNowSeconds() % 2 == 0;
//

View File

@ -14,6 +14,7 @@
#define TOTAL_OPTIONS 6
void initLcdController(void);
void updateHD44780lcd(Engine *engine);
#endif /* LCD_CONTROLLER_H_ */