-
-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
platform: EV3Issues related to LEGO MINDSTORMS EV3Issues related to LEGO MINDSTORMS EV3platform: NXTIssues related to LEGO MINDSTORMS NXTIssues related to LEGO MINDSTORMS NXTtopic: displayIssues related to graphical displaysIssues related to graphical displays
Description
Is your feature request related to a problem? Please describe.
In our last stable EV3 release, we showed a triangle with a circle around it to indicate that a program was running.
We could come up with something more interesting this time, but maybe we can start here to have something in place.
Describe the solution you'd like
A way to draw triangles with pbio/image.
Describe alternatives you've considered
Draw a triangle with lines with code in the UI.
Additional context
This was the original Pybricks 2.0 Init Code for the display. I don't have a picture around, but you could boot Pybricks 2.0 with ev3dev and run a program to see what it looked like.
// Pybricks initialization tasks
void pybricks_init() {
GError *error = NULL;
if (!grx_set_mode_default_graphics(FALSE, &error)) {
fprintf(stderr, "Could not initialize graphics. Be sure to run using `brickrun -r -- pybricks-micropython`.\n");
exit(1);
}
grx_clear_screen(GRX_COLOR_WHITE);
// Screen center
gint cx = grx_get_width()/2;
gint cy = grx_get_height()/2;
// One side of the triangle
gint base = MIN(grx_get_width(), grx_get_height()) * 7 / 16;
// Perfect circle around triangle: r = base / (2*cos(30))
// Horizontal distance from center to circle: s = r * sin(30)
gint r = (base * 100) / 173;
gint s = r / 2;
// Draw larger circle around triangle
gint width = 5;
gint cr = r * 3 / 2;
grx_draw_filled_circle(cx, cy, cr, GRX_COLOR_BLACK);
grx_draw_filled_circle(cx, cy, cr-width, GRX_COLOR_WHITE);
GrxPoint triangle[3] = {
{
// Upper left vertex
.x = cx - s,
.y = cy - base/2
},
{
// Bottom left vertex
.x = cx - s,
.y = cy + base/2
},
{
// Right vertex
.x = cx + r,
.y = cy
}
};
grx_draw_filled_convex_polygon(3, triangle, GRX_COLOR_BLACK);
pbio_init();
pbio_light_on_with_pattern(PBIO_PORT_SELF, PBIO_LIGHT_COLOR_GREEN, PBIO_LIGHT_PATTERN_BREATHE); // TODO: define PBIO_LIGHT_PATTERN_EV3_RUN (Or, discuss if we want to use breathe for EV3, too)
pthread_create(&task_caller_thread, NULL, task_caller, NULL);
}Metadata
Metadata
Assignees
Labels
platform: EV3Issues related to LEGO MINDSTORMS EV3Issues related to LEGO MINDSTORMS EV3platform: NXTIssues related to LEGO MINDSTORMS NXTIssues related to LEGO MINDSTORMS NXTtopic: displayIssues related to graphical displaysIssues related to graphical displays