AirPlay co-existence improvements, couple of display issues

This commit is contained in:
philippe44
2020-02-18 00:57:33 -08:00
parent fe5f9feeaf
commit 4e7ff0a37a
9 changed files with 203 additions and 142 deletions

View File

@@ -301,16 +301,19 @@ void displayer_control(enum displayer_cmd_e cmd, ...) {
displayer.string[0] = '\0';
displayer.elapsed = displayer.duration = 0;
displayer.offset = displayer.boundary = 0;
display_bus(&displayer, DISPLAY_BUS_TAKE);
vTaskResume(displayer.task);
break;
}
case DISPLAYER_SUSPEND:
// task will display the line 2 from beginning and suspend
displayer.state = DISPLAYER_IDLE;
display_bus(&displayer, DISPLAY_BUS_GIVE);
break;
case DISPLAYER_SHUTDOWN:
// let the task self-suspend (we might be doing i2c_write)
displayer.state = DISPLAYER_DOWN;
display_bus(&displayer, DISPLAY_BUS_GIVE);
break;
case DISPLAYER_TIMER_RUN:
if (!displayer.timer) {

View File

@@ -28,6 +28,9 @@
So it can conflict with other display direct writes that have been made during
sleep. Note that if DISPLAY_SHUTDOWN has been called meanwhile, it (almost)
never happens
The display_bus() shall be subscribed by other displayers so that at least
when this one (the main) wants to take control over display, it can signal
that to others
*/
#define DISPLAY_CLEAR 0x01
@@ -67,7 +70,10 @@ extern struct display_s {
void (*draw_box)( int x1, int y1, int x2, int y2, bool fill);
} *display;
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_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);
void displayer_timer(enum displayer_time_e mode, int elapsed, int duration);

View File

@@ -167,8 +167,8 @@ static void clear(bool full, ...) {
va_end(args);
}
SSD13x6_display.dirty = true;
if (commit) update();
else SSD13x6_display.dirty = true;
}
/****************************************************************************************
@@ -247,9 +247,9 @@ static bool line(int num, int x, int attribute, char *text) {
ESP_LOGD(TAG, "displaying %s line %u (x:%d, attr:%u)", text, num+1, x, attribute);
// update whole display if requested
SSD13x6_display.dirty = true;
if (attribute & DISPLAY_UPDATE) update();
else SSD13x6_display.dirty = true;
return width + x < Display.Width;
}
@@ -340,8 +340,9 @@ static void text(enum display_font_e font, enum display_pos_e pos, int attribute
ESP_LOGD(TAG, "SSDD13x6 displaying %s at %u with attribute %u", text, Anchor, attribute);
SSD13x6_FontDrawAnchoredString( &Display, Anchor, text, SSD_COLOR_WHITE );
SSD13x6_display.dirty = true;
if (attribute & DISPLAY_UPDATE) update();
else SSD13x6_display.dirty = true;
va_end(args);
}