Skip to content

Commit 63295c0

Browse files
author
Ezra Boley
committed
Merge branch 'embedded-statemachine-dev' of https://github.com/badgerloop-software/pod into embedded-statemachine-dev
2 parents 3e49ea4 + 8cf5328 commit 63295c0

File tree

11 files changed

+229
-136
lines changed

11 files changed

+229
-136
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,3 +257,6 @@ $RECYCLE.BIN/
257257
#Dashboard Assets
258258
**/public/fonts
259259
**/public/images
260+
261+
/.vscode
262+
.vscode/

embedded/app/src/init.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ int initData() {
5959
}
6060

6161
int initMetaData() {
62-
if ((data = (data_t *) malloc(sizeof(data_t))) == NULL) { return 1; }
63-
if ((data->pressure = (pressure_t *) malloc(sizeof(pressure_t))) == NULL) { return 1; }
64-
if ((data->motion = (motion_t *)malloc(sizeof(motion_t))) == NULL) { return 1; }
65-
if ((data->bms = (bms_t *) malloc(sizeof(bms_t))) == NULL) { return 1; }
66-
if ((data->rms = (rms_t *) malloc(sizeof(rms_t))) == NULL) { return 1; }
67-
if ((data->flags = (flags_t *) malloc(sizeof(flags_t))) == NULL) { return 1; }
68-
if ((data->timers = (timers_t *) malloc(sizeof(timers_t))) == NULL) { return 1; }
62+
if ((data = (data_t *) malloc(sizeof(data_t))) == NULL) { return 1; }
63+
if ((data->pressure = (pressure_t *) malloc(sizeof(pressure_t))) == NULL) { return 1; }
64+
if ((data->motion = (motion_t *)malloc(sizeof(motion_t))) == NULL) { return 1; }
65+
if ((data->bms = (bms_t *) malloc(sizeof(bms_t))) == NULL) { return 1; }
66+
if ((data->rms = (rms_t *) malloc(sizeof(rms_t))) == NULL) { return 1; }
67+
if ((data->flags = (flags_t *) malloc(sizeof(flags_t))) == NULL) { return 1; }
68+
if ((data->timers = (timers_t *) malloc(sizeof(timers_t))) == NULL) { return 1; }
6969
data->state = 0;
7070
return 0;
7171
}

embedded/app/src/states.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,9 @@ stateTransition_t * safeToApproachAction() {
437437
data->state = 10;
438438
return NULL;
439439
}
440-
440+
//
441+
// We're removing pre and post faults and making them non run faults.
442+
// When you change this make 11 the non run fault action. Ty - EU
441443
stateTransition_t * preFaultAction() {
442444
//TODO
443445
data->state = 11;

embedded/drivers/src/i2c.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ int i2c_begin(i2c_settings *i2c) {
1212
i2c->fd = open(filename, i2c->openMode);
1313
if (i2c->fd < 0) {
1414
fprintf(stderr, "Error - Could not open file\n");
15-
return -1;
15+
// Commenting out the returns allows the tests to proceed on my laptop where I do not have an I2C driver
16+
// return -1; // Uncomment this when doing Bone Dev - EU
1617
}
1718

1819
if (ioctl(i2c->fd, I2C_SLAVE, i2c->deviceAddress) < 0) {
1920
fprintf(stderr, "Error - Could not set I2C Address\n");
20-
return -1;
21+
// return -1; // Uncomment this when doing Bone Dev - EU
2122
}
2223
return 0;
2324
}
@@ -48,4 +49,4 @@ int read_i2c(i2c_settings *i2c, unsigned char *readBuffer, int bufferSize) {
4849
return 1;
4950
}
5051
return 0;
51-
}
52+
}

embedded/examples/dashTest.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include <stdio.h>
2+
#include <stdlib.h>
3+
#include <signal.h>
4+
#include <HVTelemetry_Loop.h>
5+
#include <LVTelemetry_Loop.h>
6+
extern "C"
7+
{
8+
#include "motor.h"
9+
#include "hv_iox.h"
10+
#include "motor.h"
11+
#include "proc_iox.h"
12+
#include "data.h"
13+
#include "can_devices.h"
14+
#include "state_machine.h"
15+
}
16+
17+
18+
19+
int init() {
20+
initData();
21+
SetupHVTelemetry((char *) "127.0.0.1", 33333);
22+
SetupLVTelemetry((char *) "127.0.0.1", 33333);
23+
}
24+
int main() {
25+
init();
26+
while (1);
27+
}

embedded/examples/navTest.c

Lines changed: 0 additions & 21 deletions
This file was deleted.

embedded/examples/navTest.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
extern "C"
2+
{
3+
#include <stdio.h>
4+
#include <data.h>
5+
#include <retro.h>
6+
#include <imu.h>
7+
#include <string.h>
8+
#include <nav.h>
9+
}
10+
#include <LVTelemetry_Loop.h>
11+
12+
#define ROLL "roll"
13+
#define EXP "exp"
14+
#define RAW "raw"
15+
16+
extern void initNav();
17+
18+
int main(int argc, char *argv[])
19+
{
20+
initData();
21+
SetupIMU();
22+
initRetros();
23+
initNav();
24+
25+
joinRetroThreads();
26+
27+
28+
SetupLVTelemetry((char *)"127.0.0.1", 33333);
29+
while(1);
30+
}

embedded/peripherals/include/braking.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,11 @@ void showPressures(void);
3131

3232
int joinPressureMonitor(void);
3333

34+
void brakePrimary(void);
35+
36+
void brakeSecondary(void);
37+
38+
void brakePrimaryRelease(void);
39+
40+
void brakeSecondaryRelease(void);
41+

embedded/peripherals/include/hv_iox.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,6 @@ int isEStopOn(void);
4545

4646
int getMasterSwFeedback(void);
4747

48+
int setMCUHVEnabled(int val);
49+
4850
#endif

0 commit comments

Comments
 (0)