1
1
2
- #define LEN (arr ) ((int) (sizeof (arr) / sizeof (arr)[0]))
2
+ #define LEN (arr ) ((int)(sizeof(arr) / sizeof(arr)[0]))
3
3
4
4
// 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 );
7
8
return result ;
8
9
}
9
10
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 );
12
14
return result ;
13
15
}
14
16
15
17
//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
+ {
17
20
int xidx = 0 ; // by default near first element
18
21
int xelements = LEN (theMap [0 ]);
19
22
20
- int distance = abs (pgm_read_byte_near (& theMap [0 ][xidx ]) - x );
23
+ int distance = abs (pgm_read_byte_near (& theMap [0 ][xidx ]) - x );
21
24
for (int i = 1 ; i < xelements ; i ++ )
22
25
{
23
26
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) {
30
33
int yidx = 0 ; // by default near first element
31
34
int yelements = LEN (* theMap );
32
35
33
- distance = abs (pgm_read_byte_near (& theMap [yidx ][0 ]) - y );
36
+ distance = abs (pgm_read_byte_near (& theMap [yidx ][0 ]) - y );
34
37
for (int i = 1 ; i < yelements ; i ++ )
35
38
{
36
39
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) {
46
49
}
47
50
48
51
//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
+ {
50
54
int xidx = 0 ; // by default near first element
51
55
int xelements = LEN (theMap [0 ]);
52
56
53
- int distance = abs (theMap [0 ][xidx ] - x );
57
+ int distance = abs (theMap [0 ][xidx ] - x );
54
58
for (int i = 1 ; i < xelements ; i ++ )
55
59
{
56
60
int d = abs (theMap [0 ][i ] - x );
@@ -63,7 +67,7 @@ int readMapMem(const int theMap[14][12], int x, int y) {
63
67
int yidx = 0 ; // by default near first element
64
68
int yelements = LEN (* theMap );
65
69
66
- distance = abs (theMap [yidx ][0 ] - y );
70
+ distance = abs (theMap [yidx ][0 ] - y );
67
71
for (int i = 1 ; i < yelements ; i ++ )
68
72
{
69
73
int d = abs (theMap [i ][0 ] - y );
0 commit comments