Skip to content

Commit f942ee6

Browse files
committed
formatted files
1 parent ae1fc27 commit f942ee6

27 files changed

Lines changed: 2090 additions & 2171 deletions

.cproject

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,4 +403,4 @@
403403
</storageModule>
404404
<storageModule moduleId="refreshScope"/>
405405
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
406-
</cproject>
406+
</cproject>

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
run: |
5151
git config --global --add safe.directory '*'
5252
git submodule update --init --depth 1
53-
./deps/ST-LIB/tools/init-submodules.sh
53+
./deps/ST-LIB/tools/init-submodules.sh
5454
shell: bash
5555

5656
- name: Setup Python environment

.mxproject

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,3 @@ SourcePath#0=..\LWIP\App
3131
SourcePath#1=..\LWIP\Target
3232
SourcePath#2=..\Core\Src
3333
SourceFiles=;
34-

.vscode/c_cpp_properties.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
}
1010
],
1111
"version": 4
12-
}
12+
}
Lines changed: 106 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,123 @@
11
#pragma once
22
#include "ST-LIB.hpp"
33

4-
/*Data packets for {{board}}
4+
/*Data packets for {{board}}
55
-AUTOGENERATED CODE, DO NOT MODIFY-*/
6-
class DataPackets{
6+
class DataPackets {
77
public:
8-
{% for enum in enums -%}
9-
enum class {{enum.name}} : uint8_t
8+
{% for enum in enums -%
9+
}
10+
enum class {{enum.name}} : uint8_t
1011
{
1112
{%- for value in enum["values"] %}
1213
{{value}} = {{loop.index0}},
1314
{%- endfor %}
1415
};
15-
{% endfor %}
16-
17-
{% for packet in packets -%}
18-
static void {{packet.name}}_init({% for variable in packet.variables %}{{variable.type}} &{{variable.name}}{% if not loop.last %}, {% endif %}{% endfor %})
19-
{
20-
{{packet.name}}_packet = new HeapPacket(static_cast<uint16_t>({{packet.id}}){% if packet.variables %}, {% for variable in packet.variables %}&{{variable.name}}{% if not loop.last %}, {% endif %}{% endfor %}{% endif %});
16+
{ % endfor % }
17+
18+
{% for packet in packets -%
2119
}
22-
23-
{% endfor -%}
24-
25-
public:
26-
{%for packet in packets -%}
27-
inline static HeapPacket *{{packet.name}}_packet{nullptr};
28-
{% endfor %}
29-
{% for socket in sockets -%}
30-
inline static {{socket.type}} *{{socket.name}}{nullptr};
31-
{% endfor %}
32-
33-
static void start()
34-
{
35-
{% for packet in packets -%}
36-
if ({{packet.name}}_packet == nullptr) {
37-
ErrorHandler("Packet {{packet.name}} not initialized");
20+
static void {
21+
{ packet.name }
22+
}
23+
_init(
24+
{ % for variable in packet.variables % } {{variable.type}} &
25+
{
26+
{ variable.name }
27+
} { % if not loop.last % },
28+
{ % endif % } { % endfor % }
29+
) {
30+
{
31+
{ packet.name }
3832
}
39-
{% endfor %}
33+
_packet = new HeapPacket(
34+
static_cast<uint16_t>({{packet.id}}) { % if packet.variables % },
35+
{ % for variable in packet.variables % } &
36+
{
37+
{ variable.name }
38+
} { % if not loop.last % },
39+
{ % endif % } { % endfor % } { % endif % }
40+
);
41+
}
42+
43+
{ % endfor - % }
4044

41-
{% for socket in ServerSockets -%}
42-
{{socket.name}} = new ServerSocket("{{socket.board_ip}}",{{socket.port}});
43-
{%- endfor %}
44-
{% for socket in DatagramSockets -%}
45-
{{socket.name}} = new DatagramSocket("{{socket.board_ip}}",{{socket.port}},"{{socket.remote_ip}}",{{socket.port}});
46-
{% endfor %}
47-
{% for socket in Sockets -%}
48-
{{socket.name}} = new Socket("{{socket.board_ip}}",{{socket.local_port}},"{{socket.remote_ip}}",{{socket.remote_port}});
49-
{% endfor %}
50-
51-
{%- for packet in sending_packets %}
52-
Scheduler::register_task({% if packet.period_type == "ms" %}{{ (packet.period*1000)|round|int }}{% else %}{{ packet.period|round|int }}{% endif %}, +[](){
53-
{% if packet.name is string -%}
54-
DataPackets::{{packet.socket}}->send_packet(*DataPackets::{{packet.name}}_packet);
55-
{% else %}
56-
{% for name in packet.name -%}
57-
DataPackets::{{packet.socket}}->send_packet(*DataPackets::{{name}}_packet);
58-
{% endfor -%}
59-
{%- endif %}
60-
}); {%- endfor %}
45+
public:
46+
{%for packet in packets -%
47+
}
48+
inline static HeapPacket* {
49+
{ packet.name }
50+
}
51+
_packet{nullptr};
52+
{ % endfor % }
53+
{% for socket in sockets -%
6154
}
55+
inline static {{socket.type}}* {
56+
{ socket.name }
57+
}
58+
{nullptr};
59+
{ % endfor % }
60+
61+
static void start() {
62+
{% for packet in packets -%
63+
}
64+
if ({
65+
{ packet.name }
66+
} _packet == nullptr) {
67+
ErrorHandler("Packet {{packet.name}} not initialized");
68+
}
69+
{ % endfor % }
6270

71+
{% for socket in ServerSockets -%
72+
}
73+
{{socket.name}} = new ServerSocket("{{socket.board_ip}}", {{socket.port}});
74+
{ % -endfor % }
75+
{% for socket in DatagramSockets -%
76+
}
77+
{{socket.name}} = new DatagramSocket(
78+
"{{socket.board_ip}}",
79+
{{socket.port}},
80+
"{{socket.remote_ip}}",
81+
{{socket.port}}
82+
);
83+
{ % endfor % }
84+
{% for socket in Sockets -%
85+
}
86+
{{socket.name}} = new Socket(
87+
"{{socket.board_ip}}",
88+
{{socket.local_port}},
89+
"{{socket.remote_ip}}",
90+
{{socket.remote_port}}
91+
);
92+
{ % endfor % }
6393

64-
94+
{%- for packet in sending_packets %
95+
}
96+
Scheduler::register_task(
97+
{ % if packet.period_type == "ms" % } {
98+
{ (packet.period * 1000) | round | int }
99+
} { % else % } {
100+
{ packet.period | round | int }
101+
} { % endif % },
102+
+[]() {
103+
{ % if packet.name is string - % }
104+
DataPackets::{
105+
{ packet.socket }
106+
} -> send_packet(*DataPackets::{
107+
{ packet.name }
108+
} _packet);
109+
{ % else % }
110+
{% for name in packet.name -%
111+
}
112+
DataPackets::{
113+
{ packet.socket }
114+
} -> send_packet(*DataPackets::{
115+
{ name }
116+
} _packet);
117+
{ % endfor - % }
118+
{ % -endif % }
119+
}
120+
);
121+
{ % -endfor % }
122+
}
65123
};
Lines changed: 60 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,79 @@
11
#pragma once
22
#include "ST-LIB.hpp"
33

4-
/*Order packets for {{board}}
4+
/*Order packets for {{board}}
55
-AUTOGENERATED CODE, DO NOT MODIFY- */
66

7-
8-
class OrderPackets{
7+
class OrderPackets {
98
public:
10-
{% for enum in enums -%}
11-
enum class {{enum.name}} : uint8_t
9+
{% for enum in enums -%
10+
}
11+
enum class {{enum.name}} : uint8_t
1212
{
1313
{%- for value in enum["values"] %}
1414
{{value}} = {{loop.index0}},
1515
{%- endfor %}
1616
};
17-
{% endfor %}
17+
{ % endfor % }
1818

19-
{% for packet in packets -%}
20-
inline static bool {{packet.name}}_flag{false};
21-
{% endfor %}
19+
{% for packet in packets -%
20+
}
21+
inline static bool {
22+
{ packet.name }
23+
}
24+
_flag{false};
25+
{ % endfor % }
2226

2327
OrderPackets() = default;
2428

25-
{% for packet in packets -%}
26-
inline static HeapOrder *{{packet.name}}_order{nullptr};
27-
{% endfor %}
28-
29-
{% for packet in packets -%}
30-
static void {{packet.name}}_init({% for variable in packet.variables %}{{variable.type}} &{{variable.name}}{% if not loop.last %}, {% endif %}{% endfor %})
31-
{
32-
{{packet.name}}_order = new HeapOrder({{packet.id}}, &{{packet.name}}_cb{% if packet.variables %}, {% for variable in packet.variables %}&{{variable.name}}{% if not loop.last %}, {% endif %}{% endfor %}{% endif %});
29+
{% for packet in packets -%
30+
}
31+
inline static HeapOrder* {
32+
{ packet.name }
3333
}
34-
{% endfor %}
34+
_order{nullptr};
35+
{ % endfor % }
36+
37+
{% for packet in packets -%
38+
}
39+
static void {
40+
{ packet.name }
41+
}
42+
_init(
43+
{ % for variable in packet.variables % } {{variable.type}} &
44+
{
45+
{ variable.name }
46+
} { % if not loop.last % },
47+
{ % endif % } { % endfor % }
48+
) {
49+
{
50+
{ packet.name }
51+
}
52+
_order = new HeapOrder(
53+
{{packet.id}},
54+
&{
55+
{ packet.name }
56+
} _cb { % if packet.variables % },
57+
{ % for variable in packet.variables % } &
58+
{
59+
{ variable.name }
60+
} { % if not loop.last % },
61+
{ % endif % } { % endfor % } { % endif % }
62+
);
63+
}
64+
{ % endfor % }
3565

3666
private:
37-
{% for packet in packets -%}
38-
static void {{packet.name}}_cb()
39-
{
40-
{{packet.name}}_flag = true;
67+
{% for packet in packets -%
68+
}
69+
static void {
70+
{ packet.name }
71+
}
72+
_cb() {
73+
{
74+
{ packet.name }
75+
}
76+
_flag = true;
4177
}
42-
{% endfor %}
43-
};
78+
{ % endfor % }
79+
};

0 commit comments

Comments
 (0)