diff --git a/liloled b/liloled index f4d5530..cc86e5e 100644 --- a/liloled +++ b/liloled @@ -165,37 +165,38 @@ display: } else if (id(page) == 5) { - // Media Title and Artist - std::string media_title = id(media_title_sensor).state.c_str(); - std::string media_artist = id(media_artist_sensor).state.c_str(); + // Media Title and Artist + std::string media_title = id(media_title_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" - if (media_title.empty() || media_artist.empty()) { - media_title = "No music playing"; // Default message if no music is playing - media_artist.clear(); // Clear artist to prevent extra text - } - - // Display media title - if (media_title.length() > 16) { - it.print(0, 0, id(font2), media_title.substr(0, 16).c_str()); - it.print(0, 20, id(font2), media_title.substr(16).c_str()); - } else { - it.print(0, 0, id(font2), media_title.c_str()); - } - - // Display media artist if it's not empty - if (!media_artist.empty()) { - if (media_artist.length() > 16) { - it.print(0, 40, id(font2), media_artist.substr(0, 16).c_str()); - it.print(0, 60, id(font2), media_artist.substr(16).c_str()); - } else { - it.print(0, 40, id(font2), media_artist.c_str()); + // Check if either media title or media artist is empty and display "No music playing" + if (media_title.empty() || media_artist.empty()) { + media_title = "No music playing"; // Default message if no music is playing + media_artist.clear(); // Clear artist to prevent extra text + } + + // Display media title + if (media_title.length() > 24) { + it.print(0, 0, id(font3), media_title.substr(0, 16).c_str()); + it.print(0, 10, id(font3), media_title.substr(16).c_str()); // Reduced from 20 to 10 + } else { + it.print(0, 0, id(font3), media_title.c_str()); + } + + // Display media artist if it's not empty + if (!media_artist.empty()) { + if (media_artist.length() > 24) { + it.print(0, 20, id(font3), media_artist.substr(0, 16).c_str()); // Reduced from 40 to 20 + it.print(0, 30, id(font3), media_artist.substr(16).c_str()); // Reduced from 60 to 30 + } else { + it.print(0, 20, id(font3), media_artist.c_str()); // Reduced from 40 to 20 + } } - } } + # Define Font for OLED font: - file: "gfonts://Roboto" @@ -242,4 +243,4 @@ interval: - interval: 5s then: - lambda: |- - id(page) = (id(page) + 1) % 6; + id(page) = (id(page) + 1) % 6; \ No newline at end of file