Removed folder 'Testing' - not needed yet
This commit is contained in:
60
app/main.cpp
60
app/main.cpp
@@ -1,30 +1,58 @@
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
#include <termios.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
// evaluate keyboard hits
|
||||
// return 0 - no keyboard hit detected
|
||||
// return 1 - keyboard hit detected
|
||||
int kbhit() {
|
||||
struct termios oldt, newt;
|
||||
int ch;
|
||||
int oldf;
|
||||
|
||||
tcgetattr(STDIN_FILENO, &oldt);
|
||||
newt = oldt;
|
||||
newt.c_lflag &= ~(ICANON | ECHO);
|
||||
tcsetattr(STDIN_FILENO, TCSANOW, &newt);
|
||||
oldf = fcntl(STDIN_FILENO, F_GETFL, 0);
|
||||
fcntl(STDIN_FILENO, F_SETFL, oldf | O_NONBLOCK);
|
||||
|
||||
ch = getchar();
|
||||
|
||||
tcsetattr(STDIN_FILENO, TCSANOW, &oldt);
|
||||
fcntl(STDIN_FILENO, F_SETFL, oldf);
|
||||
|
||||
if (ch != EOF) {
|
||||
ungetc(ch, stdin);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#include "Controller.hpp"
|
||||
|
||||
|
||||
// entry point for controller app
|
||||
// no arguments used (yet)
|
||||
// program stops on any keyboard hit
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication a(argc, argv);
|
||||
|
||||
// Set up code that uses the Qt event loop here.
|
||||
// Call QCoreApplication::quit() or QCoreApplication::exit() to quit the application.
|
||||
// A not very useful example would be including
|
||||
// #include <QTimer>
|
||||
// near the top of the file and calling
|
||||
// QTimer::singleShot(5000, &a, &QCoreApplication::quit);
|
||||
// which quits the application after 5 seconds.
|
||||
|
||||
// If you do not need a running Qt event loop, remove the call
|
||||
// to QCoreApplication::exec() or use the Non-Qt Plain C++ Application template.
|
||||
|
||||
Controller bbr;
|
||||
|
||||
|
||||
qDebug() << "Perform one bbr setp";
|
||||
bbr.step();
|
||||
Controller bbr; // create controller instance
|
||||
|
||||
// loop endlessly until keybord hit
|
||||
qDebug() << "Press any key to stop ...";
|
||||
while(!kbhit())
|
||||
{
|
||||
qDebug() << "Perform bbr setp";
|
||||
bbr.step();
|
||||
usleep(200000); // 200ms delay
|
||||
}
|
||||
return 0;
|
||||
|
||||
// todo uj 30.03.26 - uncomment if needed
|
||||
// return QCoreApplication::exec();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user