cosmetic changes
This commit is contained in:
21
datatypes.h
21
datatypes.h
@@ -16,6 +16,27 @@ struct TransCheck {
|
||||
char end;
|
||||
};
|
||||
|
||||
|
||||
enum ID{
|
||||
SHELL_SECTOR_1,
|
||||
DEA_SECTOR_1,
|
||||
SHELL_SECTOR_2,
|
||||
DEA_SECTOR_2,
|
||||
SHELL_SECTOR_3,
|
||||
DEA_SECTOR_3,
|
||||
};
|
||||
|
||||
enum SECTOR{
|
||||
SECTOR_1 = 1,
|
||||
SECTOR_2,
|
||||
SECTOR_3,
|
||||
};
|
||||
|
||||
enum Update{
|
||||
NO_UPDATE,
|
||||
UPDATE
|
||||
};
|
||||
|
||||
template <> struct fmt::formatter<TransStruct> {
|
||||
template <typename ParseContext> constexpr auto parse(ParseContext & ctx) {
|
||||
return ctx.begin();
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// filecontrol
|
||||
#include "datatypes.h"
|
||||
#include <boost/asio/serial_port.hpp>
|
||||
#include <cstdint>
|
||||
#include <fcntl.h>
|
||||
#include <fmt/format.h>
|
||||
#include <iostream>
|
||||
@@ -25,6 +26,9 @@
|
||||
// V2 USB Atmega8
|
||||
// V3 STM32F07
|
||||
|
||||
|
||||
#define LIGHT_BARRIERS 6u
|
||||
|
||||
// #define PORT_PATH "/dev/ttyACM0"
|
||||
// #define PORT_PATH "/dev/pts/4"
|
||||
|
||||
@@ -293,49 +297,49 @@ void HardwareSetup::run() {
|
||||
}
|
||||
cout << static_cast<char>(buffer.end) << endl;
|
||||
*/
|
||||
for (int i = 0; i < 6; i++) {
|
||||
for (uint8_t i = 0; i < LIGHT_BARRIERS; i++) {
|
||||
// fmt::print("{} ", TransStruct{buffer.data[i]}); // removed because build fails :(
|
||||
cout << "i: " << i
|
||||
<< " time: " << static_cast<int>(received->data[i].time)
|
||||
<< " update: "
|
||||
<< static_cast<int>(received->data[i].update) << endl;
|
||||
if (received->data[i].update != 0) {
|
||||
if (received->data[i].update != NO_UPDATE) {
|
||||
switch (received->data[i].id) {
|
||||
case 0:
|
||||
case SHELL_SECTOR_1:
|
||||
cout << "Shell Zeit 1: "
|
||||
<< static_cast<int>(received->data[i].time)
|
||||
<< endl;
|
||||
emit Shell(static_cast<int>(received->data[i].time), 1);
|
||||
emit Shell(static_cast<int>(received->data[i].time), SECTOR_1);
|
||||
break;
|
||||
case 1:
|
||||
case DEA_SECTOR_1:
|
||||
cout << "Dea Zeit 1: "
|
||||
<< static_cast<int>(received->data[i].time)
|
||||
<< endl;
|
||||
emit Dea(static_cast<int>(received->data[i].time), 1);
|
||||
emit Dea(static_cast<int>(received->data[i].time), SECTOR_1);
|
||||
break;
|
||||
case 2:
|
||||
case SHELL_SECTOR_2:
|
||||
cout << "Shell Zeit 2: "
|
||||
<< static_cast<int>(received->data[i].time)
|
||||
<< endl;
|
||||
emit Shell(static_cast<int>(received->data[i].time), 2);
|
||||
emit Shell(static_cast<int>(received->data[i].time), SECTOR_2);
|
||||
break;
|
||||
case 3:
|
||||
case DEA_SECTOR_2:
|
||||
cout << "Dea Zeit 2: "
|
||||
<< static_cast<int>(received->data[i].time)
|
||||
<< endl;
|
||||
emit Dea(static_cast<int>(received->data[i].time), 2);
|
||||
emit Dea(static_cast<int>(received->data[i].time), SECTOR_2);
|
||||
break;
|
||||
case 4:
|
||||
case SHELL_SECTOR_3:
|
||||
cout << "Shell Zeit 3: "
|
||||
<< static_cast<int>(received->data[i].time)
|
||||
<< endl;
|
||||
emit Shell(static_cast<int>(received->data[i].time), 3);
|
||||
emit Shell(static_cast<int>(received->data[i].time), SECTOR_3);
|
||||
break;
|
||||
case 5:
|
||||
case DEA_SECTOR_3:
|
||||
cout << "Dea Zeit 3: "
|
||||
<< static_cast<int>(received->data[i].time)
|
||||
<< endl;
|
||||
emit Dea(static_cast<int>(received->data[i].time), 3);
|
||||
emit Dea(static_cast<int>(received->data[i].time), SECTOR_3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user