#include #include #include #include #include #include "datamodel.h" #include "Controller.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; } // 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); DataModel model; // create data model instance Controller bbr; // create controller instance bbr.initialize(&model); // loop endlessly until keybord hit qDebug() << "Press any key to stop ..."; while(!kbhit()) { qDebug() << "Perform 'temperature is rising'"; bbr.step(); usleep(200000); // 200ms delay model.getInputs()->data()->analog.Istwert_Temperatur += 0.1; } return 0; // todo uj 30.03.26 - uncomment if needed // return QCoreApplication::exec(); }