Skip to content

Commit

Permalink
Working over display handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Angel committed Apr 5, 2017
1 parent a3af7f4 commit 06fb53b
Show file tree
Hide file tree
Showing 5 changed files with 2,499 additions and 156 deletions.
12 changes: 12 additions & 0 deletions .project
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ArduinoMid</name>
<comment></comment>
<projects>
<project>RemoteSystemsTempFiles</project>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
19 changes: 10 additions & 9 deletions MID/lib/InitLcd.h
Expand Up @@ -128,15 +128,16 @@ MenuBase menuBase(&btnMenu, midMenu);
LcdPwr lcdPwr = LcdPwr(DSP_PIN_GD1, DSP_PIN_VCC, DSP_PIN_LDK, DSP_PIN_LDA, DSP_PIN_RD, DSP_PIN_FS, DSP_PIN_GD2);
//
// Check https://github.com/olikraus/u8g2/wiki/u8g2setupcpp for display setup
U8G2_T6963_240X64_1_8080 u8g2(U8G2_R0,
DSP_PIN_DT1,
DSP_PIN_DT2,
DSP_PIN_DT3,
DSP_PIN_DT4,
DSP_PIN_DT5,
DSP_PIN_DT6,
DSP_PIN_DT7,
DSP_PIN_DT8,
U8G2_T6963_240X64_1_8080 // Screen constructor
u8g2(U8G2_R0,
DSP_PIN_DT1,
DSP_PIN_DT2,
DSP_PIN_DT3,
DSP_PIN_DT4,
DSP_PIN_DT5,
DSP_PIN_DT6,
DSP_PIN_DT7,
DSP_PIN_DT8,
/*WR*/ DSP_PIN_WR, /*CE*/ DSP_PIN_CE, /*dc8*/DSP_PIN_CD, /*RST*/ DSP_PIN_RST);
//U8G2_T6963_240X64_2_8080 u8g2(U8G2_R0, 8, 9, 10, 11, 4, 5, 6, 7,/*WR*/ 14, /*CE*/ 16, /*dc8*/17, /*RST*/ 18); // Connect RD with +5V, FS0 and FS1 with GND
LcdMenuInterface *lcdMenu = new Lcd240x62(&u8g2, &btnMenu, &menuBase, &shutDown);
Expand Down
77 changes: 47 additions & 30 deletions MID/lib/Lcd240x64.h
Expand Up @@ -67,24 +67,25 @@ class Lcd240x62 : virtual public LcdMenuInterface {
mbs->startEntry();
break;
case 1:
tone(TONE_ADT_PIN, 2800, 16);
case 2:
lcd->drawStr(0, 15, MenuBase::usedBack);
case 3:
lcd->drawStr(0, 30, MenuBase::usedMenu);
case 4:
lcd->drawStr(0, 45, MenuBase::usedNext);
case 5:
lcd->drawUTF8(76, 30, "");
lcd->drawStr(78, 30, MenuBase::usedNext);
case 6:

case 7:
case 8:
case 9:
lcd->drawStr(0, 15, MenuBase::usedBack);
lcd->drawStr(0, 30, MenuBase::usedMenu);
lcd->drawStr(0, 45, MenuBase::usedNext);
lcd->drawStr(78, 30, MenuBase::usedNext);
lcd->drawUTF8(76, 30, "");
break;
default:
case 10:
lcd->clear();
mbs->finishEntry();
drawState = 0;
break;
case 8:

break;
}
}
Expand All @@ -109,22 +110,38 @@ class Lcd240x62 : virtual public LcdMenuInterface {
}

void intro(void) {

//
// Test tone
tone(TONE_ADT_PIN, 400, 20);
delay(10);
lcd->firstPage();
do {
//
// https://github.com/olikraus/u8g2/wiki/u8g2reference#drawxbm
lcd->drawXBMP(0, 0, 240, 64, OpelLogoBits);
// lcd->drawCircle(10, 18, 9);
// lcd->drawStr(0, 0, " ASTRA ");
// lcd->drawStr(0, 20, " Bertone ");
lcd->drawXBMP(49, 16, 142, 33, OpelLogoBits);
} while (lcd->nextPage());
lcd->sendBuffer();
delay(2500);
delay(1500);
lcd->clear();
tone(TONE_ADT_PIN, 800, 10);
delay(10);
lcd->firstPage();
do {
lcd->drawXBMP(51, 20, 137, 25, ArduinoLogoBits);
} while (lcd->nextPage());
lcd->sendBuffer();
tone(TONE_ADT_PIN, 800, 10);
delay(1500);
lcd->clear();
tone(TONE_ADT_PIN, 800, 10);
delay(10);
lcd->firstPage();
do {
lcd->drawXBMP(68, 2, 104, 60, Fire1LogoBits);
} while (lcd->nextPage());
lcd->sendBuffer();
tone(TONE_ADT_PIN, 800, 10);
delay(1500);
delay(10);
tone(TONE_ADT_PIN, 800, 10);
lcd->clear();
prepareScreen();
mbs->savedCursor = 0;
Expand All @@ -135,20 +152,20 @@ class Lcd240x62 : virtual public LcdMenuInterface {
prepareScreen();
}


/**
* Draw graphic
*/
void draw() {


if (amp->isLow()) {
lcd->firstPage();
do {
menus(drawState);
} while (lcd->nextPage());
drawState++;
}

if (drawState >= 9)
drawState = 0;
// default state must reset it ...
// if (drawState >= 11)
// drawState = 0;
}

private:
Expand Down Expand Up @@ -192,7 +209,7 @@ void Lcd240x62::menus(uint8_t index) {
//
// Dashboard
case 11:
lcd->drawStr(0, 0, "Menu");
lcd->drawStr(0, 0, "Dashboard");
break;

case 12:
Expand All @@ -202,22 +219,22 @@ void Lcd240x62::menus(uint8_t index) {
//
// Travel menu
case 2:
lcd->drawStr(0, 0, "Menu");
lcd->drawStr(0, 0, "Travel menu");
break;
case 21:
lcd->drawStr(0, 0, "Menu");
lcd->drawStr(0, 0, "Travel");
break;
case 22:
lcd->drawStr(0, 0, "Menu");
lcd->drawStr(0, 0, "Travel");
break;

//
// Fuel menu
case 3:
lcd->drawStr(0, 0, "Menu");
lcd->drawStr(0, 0, " Fuel menu");
break;
case 32:
lcd->drawStr(0, 0, "Menu");
lcd->drawStr(0, 0, " Fuel menu");
break;
case 4:
case 41:
Expand Down

0 comments on commit 06fb53b

Please sign in to comment.