From 662ee4237400aaffe43bcf8ba2f4ca4df5dbb944 Mon Sep 17 00:00:00 2001 From: Robert Borzecki Date: Sat, 8 Jun 2019 07:16:30 +0200 Subject: [PATCH] Fixed half screen flickering on startup. Optymized drawing of the rectangle. --- .../application-clock/ApplicationClock.cpp | 9 +- module-gui/gui/core/Renderer.cpp | 122 +++++++++++------- module-services/service-eink/ServiceEink.cpp | 73 +++++------ 3 files changed, 113 insertions(+), 91 deletions(-) diff --git a/module-apps/application-clock/ApplicationClock.cpp b/module-apps/application-clock/ApplicationClock.cpp index 4221b0552..24e8a3297 100644 --- a/module-apps/application-clock/ApplicationClock.cpp +++ b/module-apps/application-clock/ApplicationClock.cpp @@ -117,29 +117,30 @@ void ApplicationClock::createUserInterface() { uint32_t xOffset = 0; uint32_t yOffset = 0; - hourLabel = new gui::Label(clockWin, 100,300-160,280,150); + hourLabel = new gui::Label(clockWin, 100+xOffset,300-160+yOffset,280,150); hourLabel->setFilled( false ); hourLabel->setBorderColor( gui::ColorNoColor ); hourLabel->setFont("gt_pressura_regular_140"); hourLabel->setText("00"); hourLabel->setAlignement( gui::Alignment(gui::Alignment::ALIGN_HORIZONTAL_CENTER, gui::Alignment::ALIGN_VERTICAL_CENTER)); - minuteLabel = new gui::Label(clockWin, 100,310,280,150); + minuteLabel = new gui::Label(clockWin, 100+xOffset,310+yOffset,280,150); minuteLabel->setFilled( false ); minuteLabel->setBorderColor( gui::ColorNoColor ); minuteLabel->setFont("gt_pressura_regular_140"); minuteLabel->setText("00"); minuteLabel->setAlignement( gui::Alignment(gui::Alignment::ALIGN_HORIZONTAL_CENTER, gui::Alignment::ALIGN_VERTICAL_CENTER)); - progressBar = new gui::Progress(clockWin, 480/2-90, 300-6, 180, 12 ); + progressBar = new gui::Progress(clockWin, 480/2-90+xOffset, 300-6+yOffset, 180, 12 ); progressBar->setTotalProgress(59); progressBar->setCurrentProgress(0); /* gui::Rect* rect = new gui::Rect( clockWin, 480/2-30, 300-4, 60, 8 ); rect->setFillColor( gui::ColorFullBlack ); rect->setFilled( true );*/ - gui::Rect* rectCircle = new gui::Rect( clockWin, 10, 70, 460, 460 ); + gui::Rect* rectCircle = new gui::Rect( clockWin, 0, 70+yOffset, 480, 480 ); rectCircle->setRadius(230); + rectCircle->setBorderColor( gui::ColorFullWhite ); rectCircle->setFilled( false ); diff --git a/module-gui/gui/core/Renderer.cpp b/module-gui/gui/core/Renderer.cpp index 4bcc38030..ceee6759a 100644 --- a/module-gui/gui/core/Renderer.cpp +++ b/module-gui/gui/core/Renderer.cpp @@ -106,70 +106,82 @@ void Renderer::drawRectangle( Context* ctx, CommandRectangle* cmd ) { } //get copy of original context using x,y of draw coordinates and original zie of the widget - Context* drawCtx = ctx->get( cmd->x, cmd->y, cmd->areaW, cmd->areaH ); - //draw rectangle using provided flags + Context* drawCtx; + bool copyContext = false; + int16_t wgtX = 0,wgtY = 0; + uint16_t wgtW = cmd->areaW, wgtH=cmd->areaH; + //check if there is a need or making copy of context to use is as background + if( (cmd->areaW == cmd->w) && (cmd->areaH == cmd->h)) { + drawCtx = ctx; + wgtX = cmd->x; + wgtY = cmd->y; + } + else { + copyContext = true; + drawCtx= ctx->get( cmd->x, cmd->y, cmd->areaW, cmd->areaH ); + } //if rounding of corners is 0 if( cmd->radius == 0 ) { //fill field inside the rectangle if fill flag is set if( cmd->filled ) { - uint32_t offset = 0; + uint32_t offset = wgtY*drawCtx->getW() + wgtX; for( int32_t y=0; yareaH;y++) { - memset( drawCtx->getData()+offset, cmd->fillColor.intensivity, cmd->areaW ); - offset += cmd->areaW; + memset( drawCtx->getData() + offset, cmd->fillColor.intensivity, wgtW ); + offset += drawCtx->getW(); } } if( cmd->edges & RectangleEdgeFlags::GUI_RECT_EDGE_TOP ) - drawHorizontalLine( drawCtx, 0, 0, drawCtx->getW(), cmd->penWidth, cmd->borderColor, LineExpansionDirection::LINE_EXPAND_DOWN ); + drawHorizontalLine( drawCtx, wgtX, wgtY, wgtW, cmd->penWidth, cmd->borderColor, LineExpansionDirection::LINE_EXPAND_DOWN ); if( cmd->edges & RectangleEdgeFlags::GUI_RECT_EDGE_BOTTOM ) - drawHorizontalLine( drawCtx, 0, cmd->areaH-1, drawCtx->getW(), cmd->penWidth, cmd->borderColor, LineExpansionDirection::LINE_EXPAND_UP ); + drawHorizontalLine( drawCtx, wgtX, wgtY + cmd->areaH-1, wgtW, cmd->penWidth, cmd->borderColor, LineExpansionDirection::LINE_EXPAND_UP ); if( cmd->edges & RectangleEdgeFlags::GUI_RECT_EDGE_LEFT ) - drawVerticalLine( drawCtx, 0, 0, drawCtx->getH(), cmd->penWidth, cmd->borderColor, LineExpansionDirection::LINE_EXPAND_RIGHT ); + drawVerticalLine( drawCtx, wgtX, wgtY, wgtH, cmd->penWidth, cmd->borderColor, LineExpansionDirection::LINE_EXPAND_RIGHT ); if( cmd->edges & RectangleEdgeFlags::GUI_RECT_EDGE_RIGHT ) - drawVerticalLine( drawCtx, cmd->areaW, 0, drawCtx->getH(), cmd->penWidth, cmd->borderColor, LineExpansionDirection::LINE_EXPAND_LEFT ); + drawVerticalLine( drawCtx, wgtX + cmd->areaW, wgtY, wgtH, cmd->penWidth, cmd->borderColor, LineExpansionDirection::LINE_EXPAND_LEFT ); } else { //calculate centers of circle for all corners - int16_t xcTopRight = cmd->w - cmd->radius; - int16_t xcTopLeft = cmd->radius; - int16_t xcBottomRight = xcTopRight; - int16_t xcBottomLeft = xcTopLeft; + int16_t xcTopRight = wgtX+cmd->w - cmd->radius; + int16_t xcTopLeft = wgtX+cmd->radius; + int16_t xcBottomRight = wgtX+xcTopRight; + int16_t xcBottomLeft = wgtX+xcTopLeft; - int16_t ycTopRight = cmd->radius+1; - int16_t ycTopLeft = cmd->radius+1; - int16_t ycBottomRight = cmd->h - cmd->radius -1; - int16_t ycBottomLeft = cmd->h - cmd->radius -1; + int16_t ycTopRight = wgtY+cmd->radius+1; + int16_t ycTopLeft = wgtY+cmd->radius+1; + int16_t ycBottomRight = wgtY+cmd->h - cmd->radius -1; + int16_t ycBottomLeft = wgtY+cmd->h - cmd->radius -1; int x = cmd->radius, y = 0; //top right corner if( (cmd->corners & RectangleCornerFlags::GUI_RECT_CORNER_TOP_RIGHT) && !(cmd->flatEdges & RectangleFlatFlags::GUI_RECT_FLAT_TOP_RIGHT)) { - drawHorizontalLine( drawCtx, xcTopRight + x - cmd->penWidth, ycTopRight - y, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_DOWN ); - drawVerticalLine( drawCtx, xcTopRight + y, ycTopRight - x, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_LEFT ); + drawHorizontalLine( drawCtx, wgtX + xcTopRight + x - cmd->penWidth, wgtY + ycTopRight - y, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_DOWN ); + drawVerticalLine( drawCtx, wgtX +xcTopRight + y, wgtY + ycTopRight - x, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_LEFT ); } //bottom right corner if( (cmd->corners & RectangleCornerFlags::GUI_RECT_CORNER_BOTTOM_RIGHT) && !(cmd->flatEdges & RectangleFlatFlags::GUI_RECT_FLAT_BOTTOM_RIGHT)) { - drawHorizontalLine( drawCtx, xcBottomRight + x - cmd->penWidth, ycBottomRight + y, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_DOWN ); - drawVerticalLine( drawCtx, xcBottomRight - y, ycBottomRight + x - cmd->penWidth + 1, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_LEFT ); + drawHorizontalLine( drawCtx, wgtX + xcBottomRight + x - cmd->penWidth, wgtY + ycBottomRight + y, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_DOWN ); + drawVerticalLine( drawCtx, wgtX + xcBottomRight - y, wgtY + ycBottomRight + x - cmd->penWidth + 1, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_LEFT ); } //upper left corner if( (cmd->corners & RectangleCornerFlags::GUI_RECT_CORNER_TOP_LEFT) && !(cmd->flatEdges & RectangleFlatFlags::GUI_RECT_FLAT_TOP_LEFT)) { - drawHorizontalLine( drawCtx, xcTopLeft - x, ycTopLeft - y, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_DOWN ); - drawVerticalLine( drawCtx, xcTopLeft + y + 1, ycTopLeft - x, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_LEFT ); + drawHorizontalLine( drawCtx, wgtX + xcTopLeft - x, wgtY + ycTopLeft - y, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_DOWN ); + drawVerticalLine( drawCtx, wgtX + xcTopLeft + y + 1, wgtY + ycTopLeft - x, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_LEFT ); } //Lower left corner if( (cmd->corners & RectangleCornerFlags::GUI_RECT_CORNER_BOTTOM_LEFT) && !(cmd->flatEdges & RectangleFlatFlags::GUI_RECT_FLAT_BOTTOM_LEFT)) { - drawHorizontalLine( drawCtx, xcBottomLeft - x, ycBottomLeft - y, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_DOWN ); - drawVerticalLine( drawCtx, xcBottomLeft + y + 1, ycBottomLeft + x + 1 - cmd->penWidth, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_LEFT ); + drawHorizontalLine( drawCtx, wgtX + xcBottomLeft - x, wgtY + ycBottomLeft - y, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_DOWN ); + drawVerticalLine( drawCtx, wgtX + xcBottomLeft + y + 1, wgtY + ycBottomLeft + x + 1 - cmd->penWidth, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_LEFT ); } // Initialising the value of P @@ -201,9 +213,9 @@ void Renderer::drawRectangle( Context* ctx, CommandRectangle* cmd ) { } else { //classic rounded corner - drawHorizontalLine( drawCtx, xcTopRight + x - cmd->penWidth, ycTopRight - y, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_DOWN ); + drawHorizontalLine( drawCtx, wgtX+xcTopRight + x - cmd->penWidth, wgtY+ycTopRight - y, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_DOWN ); if (x != y) - drawVerticalLine( drawCtx, xcTopRight + y, ycTopRight - x, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_LEFT ); + drawVerticalLine( drawCtx, wgtX+xcTopRight + y, wgtY+ycTopRight - x, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_LEFT ); } } @@ -214,9 +226,9 @@ void Renderer::drawRectangle( Context* ctx, CommandRectangle* cmd ) { } else { //classic rounded corner - drawHorizontalLine( drawCtx, xcBottomRight + x - cmd->penWidth, ycBottomRight + y, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_DOWN ); + drawHorizontalLine( drawCtx, wgtX+xcBottomRight + x - cmd->penWidth, wgtY+ycBottomRight + y, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_DOWN ); if (x != y) - drawVerticalLine( drawCtx, xcBottomRight + y, ycBottomRight + x - cmd->penWidth + 1, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_LEFT ); + drawVerticalLine( drawCtx, wgtX+xcBottomRight + y, wgtY+ycBottomRight + x - cmd->penWidth + 1, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_LEFT ); } } @@ -227,9 +239,9 @@ void Renderer::drawRectangle( Context* ctx, CommandRectangle* cmd ) { void drawText( Context* ctx, CommandText* cmd ); } else { //classic rounded corner - drawHorizontalLine( drawCtx, xcTopLeft - x, ycTopLeft - y, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_DOWN ); + drawHorizontalLine( drawCtx, wgtX+xcTopLeft - x, wgtY+ycTopLeft - y, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_DOWN ); if (x != y) - drawVerticalLine( drawCtx, xcTopLeft - y + 1, ycTopLeft - x, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_LEFT ); + drawVerticalLine( drawCtx, wgtX+xcTopLeft - y + 1, wgtY+ycTopLeft - x, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_LEFT ); } } @@ -240,9 +252,9 @@ void Renderer::drawRectangle( Context* ctx, CommandRectangle* cmd ) { } else { //classic rounded corner - drawHorizontalLine( drawCtx, xcBottomLeft - x, ycBottomLeft + y, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_DOWN ); + drawHorizontalLine( drawCtx, wgtX+xcBottomLeft - x, wgtY+ycBottomLeft + y, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_DOWN ); if (x != y) - drawVerticalLine( drawCtx, xcBottomLeft - y + 1, ycBottomLeft + x - cmd->penWidth + 1, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_LEFT ); + drawVerticalLine( drawCtx, wgtX+xcBottomLeft - y + 1, wgtY+ycBottomLeft + x - cmd->penWidth + 1, cmd->penWidth, 1, cmd->borderColor, gui::LineExpansionDirection::LINE_EXPAND_LEFT ); } } } @@ -250,36 +262,40 @@ void Renderer::drawRectangle( Context* ctx, CommandRectangle* cmd ) { //render edges between corners int16_t xe, ye,le; if( cmd->edges & RectangleEdgeFlags::GUI_RECT_EDGE_TOP ) { - xe = cmd->radius*( !(cmd->flatEdges & RectangleFlatFlags::GUI_RECT_FLAT_TOP_LEFT)); - ye = 0; - le = drawCtx->getW() - xe - cmd->radius*( !(cmd->flatEdges & RectangleFlatFlags::GUI_RECT_FLAT_TOP_RIGHT)); + xe = wgtX+cmd->radius*( !(cmd->flatEdges & RectangleFlatFlags::GUI_RECT_FLAT_TOP_LEFT)); + ye = wgtY; + le = wgtW - xe - cmd->radius*( !(cmd->flatEdges & RectangleFlatFlags::GUI_RECT_FLAT_TOP_RIGHT)); drawHorizontalLine( drawCtx, xe, ye, le, cmd->penWidth, cmd->borderColor, LineExpansionDirection::LINE_EXPAND_DOWN ); } if( cmd->edges & RectangleEdgeFlags::GUI_RECT_EDGE_BOTTOM ) { - xe = cmd->radius*( !(cmd->flatEdges & RectangleFlatFlags::GUI_RECT_FLAT_BOTTOM_LEFT)); - ye = drawCtx->getH()-1; - le = drawCtx->getW() - xe - cmd->radius*( !(cmd->flatEdges & RectangleFlatFlags::GUI_RECT_FLAT_BOTTOM_RIGHT)); + xe = wgtX+cmd->radius*( !(cmd->flatEdges & RectangleFlatFlags::GUI_RECT_FLAT_BOTTOM_LEFT)); + ye = wgtH-1; + le = wgtW - xe - cmd->radius*( !(cmd->flatEdges & RectangleFlatFlags::GUI_RECT_FLAT_BOTTOM_RIGHT)); drawHorizontalLine( drawCtx, xe, ye, le, cmd->penWidth, cmd->borderColor, LineExpansionDirection::LINE_EXPAND_UP ); } if( cmd->edges & RectangleEdgeFlags::GUI_RECT_EDGE_LEFT ) { xe = 0; ye = cmd->radius*( !(cmd->flatEdges & RectangleFlatFlags::GUI_RECT_FLAT_TOP_LEFT )); - le = drawCtx->getH() - ye - cmd->radius*(!(cmd->flatEdges & RectangleFlatFlags::GUI_RECT_FLAT_BOTTOM_LEFT)); + le = wgtH - ye - cmd->radius*(!(cmd->flatEdges & RectangleFlatFlags::GUI_RECT_FLAT_BOTTOM_LEFT)); drawVerticalLine( drawCtx, xe, ye, le, cmd->penWidth, cmd->borderColor, LineExpansionDirection::LINE_EXPAND_RIGHT ); } if( cmd->edges & RectangleEdgeFlags::GUI_RECT_EDGE_RIGHT ) { xe = cmd->areaW; ye = cmd->radius*( !(cmd->flatEdges & RectangleFlatFlags::GUI_RECT_FLAT_TOP_RIGHT )); - le = drawCtx->getH() - ye - cmd->radius*(!(cmd->flatEdges & RectangleFlatFlags::GUI_RECT_FLAT_BOTTOM_RIGHT)); + le = wgtH - ye - cmd->radius*(!(cmd->flatEdges & RectangleFlatFlags::GUI_RECT_FLAT_BOTTOM_RIGHT)); drawVerticalLine( drawCtx, xe, ye, le, cmd->penWidth, cmd->borderColor, LineExpansionDirection::LINE_EXPAND_LEFT ); } } - //reinsert drawCtx into bast context - ctx->insert( cmd->x, cmd->y, drawCtx ); - //remove draw context - delete drawCtx; + //if drawing was performed in temporary context + if( copyContext) { + //reinsert drawCtx into bast context + ctx->insert( cmd->x, cmd->y, drawCtx ); + //remove draw context + delete drawCtx; + } + } void Renderer::drawChar( Context* context, const int16_t x, const int16_t y, @@ -308,7 +324,18 @@ void Renderer::drawText( Context* ctx, CommandText* cmd ) { return; } - //get copy of original context using x,y of draw coordinates and original size of the widget +// Context* drawCtx; +// bool copyContext = false; +// //check if there is a need or making copy of context to use is as background +// if( (cmd->areaW == cmd->w) && (cmd->areaH == cmd->h)) { +// drawCtx = ctx; +// } +// //get copy of original context using x,y of draw coordinates and original size of the widget +// else { +// copyContext = true; +// drawCtx= ctx->get( cmd->x, cmd->y, cmd->areaW, cmd->areaH ); +// } + Context* drawCtx = ctx->get( cmd->x, cmd->y, cmd->areaW, cmd->areaH ); //retrieve font used to draw text @@ -364,7 +391,8 @@ void Renderer::drawText( Context* ctx, CommandText* cmd ) { ctx->insert( cmd->x, cmd->y, drawCtx ); //remove draw context - delete drawCtx; +// if( copyContext ) + delete drawCtx; } void Renderer::drawImage( Context* ctx, CommandImage* cmd ) { diff --git a/module-services/service-eink/ServiceEink.cpp b/module-services/service-eink/ServiceEink.cpp index 86c1d1b7f..6a9c7b383 100644 --- a/module-services/service-eink/ServiceEink.cpp +++ b/module-services/service-eink/ServiceEink.cpp @@ -61,39 +61,6 @@ static void s_EinkServiceDMAMemcpyCallback(edma_handle_t *handle, void *param, b } } -//void EinkWorkerFunction( void * params ) -//{ -// ServiceEink* service = reinterpret_cast( params ); -// LOG_INFO("Eink worker thread started"); -// -// QueueSetMemberHandle_t activeMember; -// uint32_t command; -// while( service->getWorkerLoop() ) { -// -// activeMember = xQueueSelectFromSet( service->getQueueSet(), portMAX_DELAY); -// //message from service -// if (activeMember == service->getWorkerQueue() ) { -// xQueueReceive( activeMember, &command, 0); -// if( command == static_cast(EinkWorkerCommands::Initialize)) { -// LOG_INFO("Received command: Initialize"); -// EinkMemcpyDmaInit( s_EinkServiceDMAMemcpyCallback ); -// auto msg = std::make_shared( static_cast(EinkWorkerCommands::Initialized) ); -// sys::Bus::SendUnicast(msg, "ServiceEink", service ); -// } -// } -// else if (activeMember == service->getWorkerIRQQueue() ) { -// xQueueReceive(activeMember, &command, 0); -// LOG_INFO("[EinkWorker] DMA callback"); -// } -// else { -// LOG_ERROR("undefined trigger received."); -// } -// } -//// EinkMemcpyDmaInit( s_EinkServiceDMAMemcpyCallback ); -// -// LOG_INFO("Eink worker thread ended"); -//} - ServiceEink::ServiceEink(const std::string& name) : sys::Service(name), timerID { 0 }, @@ -362,14 +329,40 @@ bool ServiceEink::deepClearScreen(int8_t temperature) { EinkWaveforms_e wv = waveformSettings.mode; - changeWaveform( EinkWaveforms_e::EinkWaveformA2, temperature ); - EinkFillScreenWithColor(EinkDisplayColorWhite); - EinkFillScreenWithColor(EinkDisplayColorBlack); - EinkFillScreenWithColor(EinkDisplayColorWhite); - EinkFillScreenWithColor(EinkDisplayColorBlack); - EinkFillScreenWithColor(EinkDisplayColorWhite); +// changeWaveform( EinkWaveforms_e::EinkWaveformA2, temperature ); +// EinkFillScreenWithColor(EinkDisplayColorWhite); +// EinkFillScreenWithColor(EinkDisplayColorBlack); +// EinkFillScreenWithColor(EinkDisplayColorWhite); +// EinkFillScreenWithColor(EinkDisplayColorBlack); +// EinkFillScreenWithColor(EinkDisplayColorWhite); - changeWaveform(wv, temperature); + EinkPowerOn(); + changeWaveform( EinkWaveforms_e::EinkWaveformA2, temperature ); + + EinkStatus_e ret; + memset( einkRenderBuffer, 15, 480*600 ); + ret = EinkUpdateFrame ( 0,0, 480, 600, einkRenderBuffer, Eink4Bpp, EinkDisplayColorModeStandard ); + if( ret != EinkOK ) LOG_FATAL("Failed to update frame"); + ret = EinkRefreshImage (0, 0, 480, 600, EinkDisplayTimingsFastRefreshMode ); + if( ret != EinkOK ) LOG_FATAL("Failed to refresh frame"); + + for( uint32_t i=0; i<2; i++) { + memset( einkRenderBuffer, 0, 480*600 ); + ret = EinkUpdateFrame ( 0,0, 480, 600, einkRenderBuffer, Eink4Bpp, EinkDisplayColorModeStandard ); + if( ret != EinkOK ) LOG_FATAL("Failed to update frame"); + ret = EinkRefreshImage (0, 0, 480, 600, EinkDisplayTimingsFastRefreshMode ); + if( ret != EinkOK ) LOG_FATAL("Failed to refresh frame"); + + memset( einkRenderBuffer, 15, 480*600 ); + ret = EinkUpdateFrame ( 0,0, 480, 600, einkRenderBuffer, Eink4Bpp, EinkDisplayColorModeStandard ); + if( ret != EinkOK ) LOG_FATAL("Failed to update frame"); + ret = EinkRefreshImage (0, 0, 480, 600, EinkDisplayTimingsFastRefreshMode ); + if( ret != EinkOK ) LOG_FATAL("Failed to refresh frame"); + } + + changeWaveform(wv, temperature); + + EinkPowerOff(); return true; }