diff --git a/simulation/VirtualLedBoard/VirtualLedBoard.pro b/simulation/VirtualLedBoard/VirtualLedBoard.pro index 4ba635f..208ce2e 100644 --- a/simulation/VirtualLedBoard/VirtualLedBoard.pro +++ b/simulation/VirtualLedBoard/VirtualLedBoard.pro @@ -16,6 +16,7 @@ SOURCES += \ HEADERS += \ mainwindow.h \ + settings.h \ udpserver.h FORMS += \ diff --git a/simulation/VirtualLedBoard/mainwindow.h b/simulation/VirtualLedBoard/mainwindow.h index d96514a..d17aeb9 100644 --- a/simulation/VirtualLedBoard/mainwindow.h +++ b/simulation/VirtualLedBoard/mainwindow.h @@ -5,17 +5,7 @@ #include #include "udpserver.h" - -#define MAXIMUM_PANELSIZE 5 -#define PANEL_WIDTH 32 -#define PANEL_HEIGHT 40 - -#define LED_DIAMETER 8 -#define LED_DISTANCE (LED_DIAMETER + 3) - -#define DEFAULT_WIDTH (LED_DISTANCE * MAXIMUM_PANELSIZE * PANEL_WIDTH) -#define DEFAULT_HEIGHT (LED_DISTANCE * PANEL_HEIGHT) - +#include "settings.h" #define COLOR_BACKGROUND Qt::black #define COLOR_FOREGROUND QColor(255, 127, 0, 255) diff --git a/simulation/VirtualLedBoard/settings.h b/simulation/VirtualLedBoard/settings.h new file mode 100644 index 0000000..c1b23ef --- /dev/null +++ b/simulation/VirtualLedBoard/settings.h @@ -0,0 +1,14 @@ + +#define PACKET_LENGTH 801 +#define PACKET_INDEX_BRIGHTNESS 0 +#define PACKET_INDEX_PANEL0 1 + +#define MAXIMUM_PANELSIZE 5 +#define PANEL_WIDTH 32 +#define PANEL_HEIGHT 40 + +#define LED_DIAMETER 8 +#define LED_DISTANCE (LED_DIAMETER + 3) + +#define DEFAULT_WIDTH (LED_DISTANCE * MAXIMUM_PANELSIZE * PANEL_WIDTH) +#define DEFAULT_HEIGHT (LED_DISTANCE * PANEL_HEIGHT) diff --git a/simulation/VirtualLedBoard/udpserver.cpp b/simulation/VirtualLedBoard/udpserver.cpp index 9887cea..a814395 100644 --- a/simulation/VirtualLedBoard/udpserver.cpp +++ b/simulation/VirtualLedBoard/udpserver.cpp @@ -1,4 +1,5 @@ #include "udpserver.h" +#include "settings.h" #include #include @@ -29,7 +30,7 @@ void UdpLedServer ::readPendingDatagrams() } void UdpLedServer::processTheDatagram(QNetworkDatagram datagram) { - if (datagram.isValid()) { + if (datagram.isValid() && datagram.data().length() == PACKET_LENGTH) { qDebug() << "Received datagram:" << datagram.data().size(); } }