mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-07 12:07:09 +03:00
add 'pause'
This commit is contained in:
@@ -39,6 +39,7 @@ static void Update( struct GDS_Device* Device ) {
|
||||
// not sure the compiler does not have to redo all calculation in for loops, so local it is
|
||||
int width = Device->Width, rows = Device->Height / 8;
|
||||
uint8_t *optr = Device->Shadowbuffer, *iptr = Device->Framebuffer;
|
||||
int CurrentRow = -1, FirstCol = -1, LastCol = -1;
|
||||
|
||||
// by row, find first and last columns that have been updated
|
||||
for (int r = 0; r < rows; r++) {
|
||||
@@ -53,8 +54,22 @@ static void Update( struct GDS_Device* Device ) {
|
||||
|
||||
// now update the display by "byte rows"
|
||||
if (first--) {
|
||||
SetColumnAddress( Device, first, last );
|
||||
SetPageAddress( Device, r, r);
|
||||
|
||||
// only set column when useful, saves a fair bit of CPU
|
||||
if (first > FirstCol && first <= FirstCol + 4 && last < LastCol && last >= LastCol - 4) {
|
||||
first = FirstCol;
|
||||
last = LastCol;
|
||||
} else {
|
||||
SetColumnAddress( Device, first, last );
|
||||
FirstCol = first;
|
||||
LastCol = last;
|
||||
}
|
||||
|
||||
// Set row only when needed, otherwise let auto-increment work
|
||||
if (r != CurrentRow) SetPageAddress( Device, r, Device->Height / 8 - 1 );
|
||||
CurrentRow = r + 1;
|
||||
|
||||
// actual write
|
||||
Device->WriteData( Device, Device->Shadowbuffer + r*width + first, last - first + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,13 +289,14 @@ void displayer_metadata(char *artist, char *album, char *title) {
|
||||
/****************************************************************************************
|
||||
*
|
||||
*/
|
||||
void displayer_scroll(char *string, int speed) {
|
||||
void displayer_scroll(char *string, int speed, int pause) {
|
||||
// need a display!
|
||||
if (!display) return;
|
||||
|
||||
xSemaphoreTake(displayer.mutex, portMAX_DELAY);
|
||||
|
||||
if (speed) displayer.speed = speed;
|
||||
if (pause) displayer.pause = pause;
|
||||
displayer.offset = 0;
|
||||
strncpy(displayer.string, string, SCROLLABLE_SIZE);
|
||||
displayer.string[SCROLLABLE_SIZE] = '\0';
|
||||
|
||||
@@ -42,7 +42,7 @@ enum displayer_time_e { DISPLAYER_ELAPSED, DISPLAYER_REMAINING };
|
||||
enum display_bus_cmd_e { DISPLAY_BUS_TAKE, DISPLAY_BUS_GIVE };
|
||||
bool (*display_bus)(void *from, enum display_bus_cmd_e cmd);
|
||||
|
||||
void displayer_scroll(char *string, int speed);
|
||||
void displayer_scroll(char *string, int speed, int pause);
|
||||
void displayer_control(enum displayer_cmd_e cmd, ...);
|
||||
void displayer_metadata(char *artist, char *album, char *title);
|
||||
void displayer_timer(enum displayer_time_e mode, int elapsed, int duration);
|
||||
|
||||
Reference in New Issue
Block a user