Working for data transfer from process

This commit is contained in:
Eric Teunis de Boone 2017-02-04 23:35:03 +01:00
parent 5926538616
commit c0ad31810f
6 changed files with 328 additions and 194 deletions

View file

@ -11,51 +11,46 @@ void layout(unsigned int tick) {
display.setTextColor(WHITE);
display.setTextWrap(false);
updateLine1(tick);
updateLine2(tick);
updateLine3(tick);
updateLine4(tick);
if ( playing || tick % 3 ) {
display.setCursor(0, 0);
// First line (20)
if (volume < 100 ) display.print(' ');
display.print(volume);
display.print(F("% || "));
if (repeat_bool) display.print('r');
else display.print(' ');
if (random_bool) display.print('x');
else display.print(' ');
if (single_bool) display.print('s');
else display.print(' ');
if (consume_bool) display.print('c');
else display.print(' ');
if (shuffle_bool) display.print('z');
else display.print(' ');
if (updating_bool) display.print('u');
else display.print(' ');
display.print(" || ");
display.print(progress);
display.print("% ");
}
display.display();
}
void updateLine1(unsigned int tick) {
//reset line
display.drawRect(0, 0, display.width(), 8, BLACK);
display.setCursor(0, 0);
// First line (20)
if (volume < 100 ) display.print(' ');
display.print(volume);
display.print(F("% "));
display.print(F("|mm:ss/mm:ss|"));
display.print(F(" "));
if (repeat) display.print('r');
else display.print('-');
if (shuffle) display.print('z');
else display.print('-');
}
void updateLine2(unsigned int tick) {
//reset line
display.drawRect(0, 8, display.width(), 16, BLACK);
//line 2
display.setCursor(0, 8);
display.print(textscroll(title,tick));
display.startscrollleft(0x06, 0x0F);
}
void updateLine3(unsigned int tick) {
//reset line
display.drawRect(0, 16, display.width(), 24, BLACK);
//line 3
display.setCursor(0, 16);
display.print(textscroll(artist, tick));
}
void updateLine4(unsigned int tick) {
//reset line
display.drawRect(0, 24, display.width(), 32, BLACK);
//line 4
display.setCursor(0, 24);
display.print(textscroll(album, tick));
display.display();
}
String textscroll(String text, unsigned int tick) {
int chars = 21;
int len = text.length();
@ -72,5 +67,7 @@ String textscroll(String text, unsigned int tick) {
int calcMaxTicks() {
maxticks = title.length() * artist.length() * album.length();
Serial.print("MT:");
Serial.println(maxticks);
return maxticks;
}