Update liloled
This commit is contained in:
parent
7012d53d86
commit
602ca19c3b
53
liloled
53
liloled
|
|
@ -165,37 +165,38 @@ display:
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (id(page) == 5) {
|
else if (id(page) == 5) {
|
||||||
// Media Title and Artist
|
// Media Title and Artist
|
||||||
std::string media_title = id(media_title_sensor).state.c_str();
|
std::string media_title = id(media_title_sensor).state.c_str();
|
||||||
std::string media_artist = id(media_artist_sensor).state.c_str();
|
std::string media_artist = id(media_artist_sensor).state.c_str();
|
||||||
|
|
||||||
// Check if either media title or media artist is empty and display "No music playing"
|
// Check if either media title or media artist is empty and display "No music playing"
|
||||||
if (media_title.empty() || media_artist.empty()) {
|
if (media_title.empty() || media_artist.empty()) {
|
||||||
media_title = "No music playing"; // Default message if no music is playing
|
media_title = "No music playing"; // Default message if no music is playing
|
||||||
media_artist.clear(); // Clear artist to prevent extra text
|
media_artist.clear(); // Clear artist to prevent extra text
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display media title
|
// Display media title
|
||||||
if (media_title.length() > 16) {
|
if (media_title.length() > 24) {
|
||||||
it.print(0, 0, id(font2), media_title.substr(0, 16).c_str());
|
it.print(0, 0, id(font3), media_title.substr(0, 16).c_str());
|
||||||
it.print(0, 20, id(font2), media_title.substr(16).c_str());
|
it.print(0, 10, id(font3), media_title.substr(16).c_str()); // Reduced from 20 to 10
|
||||||
} else {
|
} else {
|
||||||
it.print(0, 0, id(font2), media_title.c_str());
|
it.print(0, 0, id(font3), media_title.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display media artist if it's not empty
|
// Display media artist if it's not empty
|
||||||
if (!media_artist.empty()) {
|
if (!media_artist.empty()) {
|
||||||
if (media_artist.length() > 16) {
|
if (media_artist.length() > 24) {
|
||||||
it.print(0, 40, id(font2), media_artist.substr(0, 16).c_str());
|
it.print(0, 20, id(font3), media_artist.substr(0, 16).c_str()); // Reduced from 40 to 20
|
||||||
it.print(0, 60, id(font2), media_artist.substr(16).c_str());
|
it.print(0, 30, id(font3), media_artist.substr(16).c_str()); // Reduced from 60 to 30
|
||||||
} else {
|
} else {
|
||||||
it.print(0, 40, id(font2), media_artist.c_str());
|
it.print(0, 20, id(font3), media_artist.c_str()); // Reduced from 40 to 20
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Define Font for OLED
|
# Define Font for OLED
|
||||||
font:
|
font:
|
||||||
- file: "gfonts://Roboto"
|
- file: "gfonts://Roboto"
|
||||||
|
|
@ -242,4 +243,4 @@ interval:
|
||||||
- interval: 5s
|
- interval: 5s
|
||||||
then:
|
then:
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
id(page) = (id(page) + 1) % 6;
|
id(page) = (id(page) + 1) % 6;
|
||||||
Loading…
Reference in New Issue