Hi team,
In a program derived from your 5228.GUIApp_draw_shapes_PEHMI1_130.zip file I get different behaviors of the function gx_system_canvas_refresh ().
The following subroutines is defined in window3 | Draw Function property of GUIX Studio:
VOID window3_draw(GX_WINDOW *cur_window)
{
GX_RECTANGLE rect;
GX_POINT pixelpos;
GX_VALUE ix,iy;
UINT status;
ioport_level_t s1btn;
/* Invoke GUIX window drawing function. */
//status = gx_window_draw(widget); // Produces compile errors
gx_window_draw(cur_window); // Correctly compiled
/* Define the brush of the current screen context. */
status = gx_context_brush_define(GX_COLOR_ID_SELECTED_FILL,
GX_COLOR_ID_SELECTED_FILL,
GX_BRUSH_ALIAS | GX_BRUSH_SOLID_FILL);
/* Draw 1 pixels frame around the display. */
status = gx_context_brush_width_set(1);
status = gx_context_brush_define(GX_COLOR_ID_RED, GX_COLOR_ID_RED, GX_BRUSH_OUTLINE);
rect.gx_rectangle_left = 0;
rect.gx_rectangle_top= 0;
rect.gx_rectangle_right = 799;
rect.gx_rectangle_bottom = 599;
status = gx_canvas_rectangle_draw(&rect);
/* Set 3 pixels brush width. */
status = gx_context_brush_width_set(3);
/* Draw empty shapes */
status = gx_context_brush_define(GX_COLOR_ID_BLUE, GX_COLOR_ID_RED, GX_BRUSH_OUTLINE);
status = gx_canvas_line_draw(10, 10, 110, 70);
rect.gx_rectangle_left = 10;
rect.gx_rectangle_top= 100;
rect.gx_rectangle_right = 110;
rect.gx_rectangle_bottom = 130;
status = gx_canvas_rectangle_draw(&rect);
status = gx_canvas_circle_draw(60, 200, 50);
status = gx_canvas_arc_draw(60, 320, 50, 0, 90);
status = gx_canvas_ellipse_draw(60, 400, 10, 50);
status = gx_canvas_pie_draw(60, 540, 50, 0, 90);
/* Draw filled shapes */
status = gx_context_brush_define(GX_COLOR_ID_BLUE, GX_COLOR_ID_RED, GX_BRUSH_SOLID_FILL);
status = gx_canvas_line_draw(210, 10, 310, 70);
rect.gx_rectangle_left = 210;
rect.gx_rectangle_top= 100;
rect.gx_rectangle_right = 310;
rect.gx_rectangle_bottom = 130;
status = gx_canvas_rectangle_draw(&rect);
status = gx_canvas_circle_draw(260, 200, 50);
status = gx_canvas_arc_draw(260, 320, 50, 0, 90);
status = gx_canvas_ellipse_draw(260, 400, 10, 50);
status = gx_canvas_pie_draw(260, 540, 50, 0, 90);
/* Draw a square using single points */
for (ix=400; ix<450; ix++)
{
for (iy=10; iy<60; iy++)
{
pixelpos.gx_point_x=ix;
pixelpos.gx_point_y=iy;
status = gx_canvas_pixel_draw(pixelpos);
}
}
/* Draw texts */
status = gx_context_font_set(GX_FONT_ID_VERABD06);
status = gx_canvas_text_draw(400, 100, "MPAutomation", 12);
status = gx_context_font_set(GX_FONT_ID_VERABD08);
status = gx_canvas_text_draw(400, 150, "MPAutomation", 12);
status = gx_context_font_set(GX_FONT_ID_VERABD16);
status = gx_canvas_text_draw(400, 200, "MPAutomation", 12);
status = gx_context_font_set(GX_FONT_ID_VERA16);
status = gx_canvas_text_draw(400, 250, "MPAutomation", 12);
status = gx_context_font_set(GX_FONT_ID_VERABL16);
status = gx_canvas_text_draw(400, 300, "MPAutomation", 12);
status = gx_context_font_set(GX_FONT_ID_VERALT16);
status = gx_canvas_text_draw(400, 350, "MPAutomation", 12);
status = gx_context_font_set(GX_FONT_ID_VERABD24);
status = gx_canvas_text_draw(400, 400, "MPAutomation", 12);
status = gx_context_font_set(GX_FONT_ID_VERABD32);
status = gx_canvas_text_draw(400, 450, "MPAutomation", 12);
status = gx_context_font_set(GX_FONT_ID_VERABD40);
status = gx_canvas_text_draw(400, 500, "MPAutomation", 12);
status = gx_system_canvas_refresh(); // 11111111111111111111111111111
s1btn = IOPORT_LEVEL_HIGH; // On DK-S7G2 Main board S5 must be ON
do
g_ioport.p_api->pinRead(IOPORT_PORT_00_PIN_06, &s1btn);
while (IOPORT_LEVEL_HIGH == s1btn); // Wait S1 pressed
do
g_ioport.p_api->pinRead(IOPORT_PORT_00_PIN_06, &s1btn);
while (IOPORT_LEVEL_LOW == s1btn); // Wait S1 released
status = gx_context_brush_define(GX_COLOR_ID_WHITE, GX_COLOR_ID_WHITE, GX_BRUSH_SOLID_FILL);
rect.gx_rectangle_left = 0;
rect.gx_rectangle_top= 0;
rect.gx_rectangle_right = 799;
rect.gx_rectangle_bottom = 599;
status = gx_canvas_rectangle_draw(&rect); // Clear display
status = gx_context_font_set(GX_FONT_ID_VERABD16);
status = gx_canvas_text_draw(50, 50, "MPAutomation", 12);
status = gx_system_canvas_refresh(); //2222222222222222222222222222222
s1btn = IOPORT_LEVEL_HIGH;
do
g_ioport.p_api->pinRead(IOPORT_PORT_00_PIN_06, &s1btn);
while (IOPORT_LEVEL_HIGH == s1btn); // Wait S1 pressed
}
It works perfectly up to first call of gx_system_canvas_refresh() // 11111111111111111111111111111).
But after I do not see the other few representations despite with the debug I see the code executed and I always get correct results (status always = 0). The second call of gx_system_canvas_refresh(); //2222222222222222222222222222222 has no effect.
is it a threads problem?
I add the reason for this code. I should quickly bring on Synergy S7G2 another old firmware that used elementary graphic functions (lines, rectangles, text, etc.) to represent different windows, depending on external events (state of digital inputs and actions on the touch screen).
Any help will be really appreciated.
Thanks in advance and best regards.
MPGA