From f504c87250a2c87b4f10bf9c1032cb6018b70908 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frakn=C3=B3i=20Tam=C3=A1s?= <fraknoitamas@gmail.com> Date: Sat, 12 Jun 2021 22:05:39 +0200 Subject: [PATCH] Exit on input --- test_anim/minimatrixrpi.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test_anim/minimatrixrpi.cpp b/test_anim/minimatrixrpi.cpp index 005c7e3..972e625 100644 --- a/test_anim/minimatrixrpi.cpp +++ b/test_anim/minimatrixrpi.cpp @@ -8,7 +8,7 @@ #include <unistd.h> #include <stdio.h> #include <string> - +#include <poll.h> int main() { @@ -19,17 +19,18 @@ int main() printf("Going idle\n"); while (1) { + struct pollfd mypoll = {STDIN_FILENO, POLLIN | POLLPRI}; ola_run_once(); if (matrixserver.receive()) { spisender.updateFrame(matrixserver.getFrame()); } + if (poll(&mypoll, 1, 0)) + { + break; + } } - - - char k; - scanf("%c", &k); printf("Ending\n"); ola_deinit(); } -- GitLab