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