Skip to content

Commit e8235cb

Browse files
committed
formatting
1 parent ed37e3d commit e8235cb

File tree

7 files changed

+701
-348
lines changed

7 files changed

+701
-348
lines changed

main/calc.h

+15-11
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11

2-
#define LEN(arr) ((int) (sizeof (arr) / sizeof (arr)[0]))
2+
#define LEN(arr) ((int)(sizeof(arr) / sizeof(arr)[0]))
33

44
// Calculation helpers
5-
int readTPSVoltage(int voltage) {
6-
int result = map(voltage,1760,2830,0,100);
5+
int readTPSVoltage(int voltage)
6+
{
7+
int result = map(voltage, 1760, 2830, 0, 100);
78
return result;
89
}
910

10-
int readBoostVoltage(int voltage) {
11-
int result = map(voltage,1500,4000,0,100);
11+
int readBoostVoltage(int voltage)
12+
{
13+
int result = map(voltage, 1500, 4000, 0, 100);
1214
return result;
1315
}
1416

1517
//function to read 2d maps
16-
int readMap(const int theMap[14][12], int x, int y) {
18+
int readMap(const int theMap[14][12], int x, int y)
19+
{
1720
int xidx = 0; // by default near first element
1821
int xelements = LEN(theMap[0]);
1922

20-
int distance = abs(pgm_read_byte_near(&theMap[0][xidx]) - x);
23+
int distance = abs(pgm_read_byte_near(&theMap[0][xidx]) - x);
2124
for (int i = 1; i < xelements; i++)
2225
{
2326
int d = abs(pgm_read_byte_near(&theMap[0][i]) - x);
@@ -30,7 +33,7 @@ int readMap(const int theMap[14][12], int x, int y) {
3033
int yidx = 0; // by default near first element
3134
int yelements = LEN(*theMap);
3235

33-
distance = abs(pgm_read_byte_near(&theMap[yidx][0]) - y);
36+
distance = abs(pgm_read_byte_near(&theMap[yidx][0]) - y);
3437
for (int i = 1; i < yelements; i++)
3538
{
3639
int d = abs(pgm_read_byte_near(&theMap[i][0]) - y);
@@ -46,11 +49,12 @@ int readMap(const int theMap[14][12], int x, int y) {
4649
}
4750

4851
//function to read 2d maps
49-
int readMapMem(const int theMap[14][12], int x, int y) {
52+
int readMapMem(const int theMap[14][12], int x, int y)
53+
{
5054
int xidx = 0; // by default near first element
5155
int xelements = LEN(theMap[0]);
5256

53-
int distance = abs(theMap[0][xidx] - x);
57+
int distance = abs(theMap[0][xidx] - x);
5458
for (int i = 1; i < xelements; i++)
5559
{
5660
int d = abs(theMap[0][i] - x);
@@ -63,7 +67,7 @@ int readMapMem(const int theMap[14][12], int x, int y) {
6367
int yidx = 0; // by default near first element
6468
int yelements = LEN(*theMap);
6569

66-
distance = abs(theMap[yidx][0] - y);
70+
distance = abs(theMap[yidx][0] - y);
6771
for (int i = 1; i < yelements; i++)
6872
{
6973
int d = abs(theMap[i][0] - y);

main/config.h

+12-15
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,24 @@
22

33
// OUTPUT PINS
44
// SPI display setup
5-
#define OLED_MOSI 11 //D1
6-
#define OLED_CLK 13 //D0
7-
#define OLED_DC 6
8-
#define OLED_CS 7
5+
#define OLED_MOSI 11 //D1
6+
#define OLED_CLK 13 //D0
7+
#define OLED_DC 6
8+
#define OLED_CS 7
99
#define OLED_RESET 8
1010

1111
// Solenoid output pins
1212
#define y3 47
1313
#define y4 45
1414
#define y5 46
15-
// #define mpc 44
1615
#define mpc 9
17-
// #define spc 43
1816
#define spc 10
1917
#define tcc 42
2018
#define rpmMeter 12
2119
// END OUTPUT PINS
2220

2321
// INPUT PINS
24-
// Stick input
22+
// Stick input
2523
#define whitepin 27
2624
#define bluepin 29
2725
#define greenpin 26
@@ -45,11 +43,11 @@
4543
// END INPUT PINS
4644

4745
// Internals, states
48-
int gear = 2; // Start on gear 2
46+
int gear = 2; // Start on gear 2
4947
int wantedGear = gear; // Gear that is requested
50-
int newGear = 2; // Gear that is going to be changed
51-
int prevgear = 1; // Previously changed gear
52-
int cSolenoid = 0; // Change solenoid pin to be controlled.
48+
int newGear = 2; // Gear that is going to be changed
49+
int prevgear = 1; // Previously changed gear
50+
int cSolenoid = 0; // Change solenoid pin to be controlled.
5351
int vehicleSpeed = 100;
5452
unsigned long lastSensorTime = 0;
5553
int spcSetVal = 255;
@@ -62,8 +60,8 @@ int n3Speed = 0;
6260
extern unsigned int __bss_end;
6361
extern unsigned int __heap_start;
6462
extern void *__brkval;
65-
const int atfSensorFilterWeight = 16; // higher numbers = heavier filtering
66-
const int atfSensorNumReadings = 10; // number of readings
63+
const int atfSensorFilterWeight = 16; // higher numbers = heavier filtering
64+
const int atfSensorNumReadings = 10; // number of readings
6765
int atfSensorAverage = 0; // the running average
6866

6967
// End of internals
@@ -106,9 +104,8 @@ boolean health = false;
106104
boolean debugEnabled = true;
107105

108106
// Full automatic mode
109-
boolean fullAuto = true;
107+
boolean fullAuto = true;
110108

111109
boolean drive = false;
112110

113-
114111
// End of environment conf

0 commit comments

Comments
 (0)