Skip to content

Commit 546a289

Browse files
committed
Moved braking from HV to LV
1 parent 24968b3 commit 546a289

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

middleware/src/HVTCPSocket.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ extern "C"
1515
#include "data.h"
1616
#include "state_machine.h"
1717
#include "hv_iox.h"
18-
#include <braking.h>
1918
}
2019

2120

@@ -133,23 +132,6 @@ void *TCPLoop(void *arg)
133132
data->flags->emergencyBrake = 1;
134133
}
135134

136-
if (!strncmp(buffer, "primBrakeOff", MAX_COMMAND_SIZE))
137-
{
138-
brakePrimaryRelease();
139-
}
140-
if (!strncmp(buffer, "primBrakeOn", MAX_COMMAND_SIZE))
141-
{
142-
brakePrimary();
143-
}
144-
if (!strncmp(buffer, "secBrakeOff", MAX_COMMAND_SIZE))
145-
{
146-
brakeSecondaryRelease();
147-
}
148-
if (!strncmp(buffer, "secBrakeOn", MAX_COMMAND_SIZE))
149-
{
150-
brakeSecondary();
151-
}
152-
153135
if (!strncmp(buffer, "hvEnable", MAX_COMMAND_SIZE))
154136
{
155137
setMCUHVEnabled(true);

middleware/src/LVTCPSocket.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
#include "data.h"
1212
#include "connStat.h"
1313

14+
extern "C" {
15+
#include <braking.h>
16+
}
17+
1418
pthread_t LVTCPThread;
1519

1620

@@ -90,6 +94,23 @@ void *LVTCPLoop(void *arg){
9094
data->flags->shouldBrake = true;
9195
}
9296

97+
if (!strncmp(buffer, "primBrakeOff", MAX_COMMAND_SIZE))
98+
{
99+
brakePrimaryRelease();
100+
}
101+
if (!strncmp(buffer, "primBrakeOn", MAX_COMMAND_SIZE))
102+
{
103+
brakePrimary();
104+
}
105+
if (!strncmp(buffer, "secBrakeOff", MAX_COMMAND_SIZE))
106+
{
107+
brakeSecondaryRelease();
108+
}
109+
if (!strncmp(buffer, "secBrakeOn", MAX_COMMAND_SIZE))
110+
{
111+
brakeSecondary();
112+
}
113+
93114
// HEARTBEAT
94115
if(!strncmp(buffer, "ping", MAX_COMMAND_SIZE)){
95116
// Send acknowledge packet back

0 commit comments

Comments
 (0)