Rev 411 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 411 | Rev 413 | ||
---|---|---|---|
Line 12... | Line 12... | ||
12 | #include "menu.h" |
12 | #include "menu.h" |
13 | #include "printf_P.h" |
13 | #include "printf_P.h" |
14 | #include "analog.h" |
14 | #include "analog.h" |
15 | #include "gps.h" |
15 | #include "gps.h" |
16 | #include "button.h" |
16 | #include "button.h" |
17 | //#include "logging.h" |
17 | #include "logging.h" |
18 | #include "settings.h" |
18 | #include "settings.h" |
Line 19... | Line 19... | ||
19 | 19 | ||
20 | #define FOLLOWME_INTERVAL 1000 // 1 second update |
20 | #define FOLLOWME_INTERVAL 1000 // 1 second update |
Line 24... | Line 24... | ||
24 | int16_t UBat = 120; |
24 | int16_t UBat = 120; |
25 | int16_t Zellenzahl = 0; |
25 | int16_t Zellenzahl = 0; |
26 | int16_t PowerOn = 0; |
26 | int16_t PowerOn = 0; |
27 | int16_t i = 0; |
27 | int16_t i = 0; |
28 | int16_t delay = 0; |
28 | int16_t delay = 0; |
29 | int16_t FollowMe_active = 0; |
- | |
30 | #endif |
29 | #endif |
Line 31... | Line 30... | ||
31 | 30 | ||
32 | uint16_t Error = 0; |
- | |
33 | - | ||
34 | typedef enum |
- | |
35 | { |
31 | uint16_t Error = 0; |
36 | STATE_UNDEFINED, |
- | |
37 | STATE_IDLE, |
- | |
38 | STATE_SEND_FOLLOWME |
- | |
Line 39... | Line 32... | ||
39 | } SysState_t; |
32 | SysState_t SysState = STATE_UNDEFINED; |
40 | 33 | ||
41 | int main (void) |
34 | int main (void) |
42 | { |
- | |
Line 43... | Line 35... | ||
43 | static uint16_t FollowMe_Timer = 0; |
35 | { |
44 | static SysState_t SysState = STATE_UNDEFINED; |
36 | static uint16_t FollowMe_Timer = 0; |
Line 45... | Line 37... | ||
45 | 37 | ||
Line 70... | Line 62... | ||
70 | Fat16_Init(); |
62 | Fat16_Init(); |
Line 71... | Line 63... | ||
71 | 63 | ||
72 | // initialize the settings |
64 | // initialize the settings |
73 | Settings_Init(); |
65 | Settings_Init(); |
74 | // initialize logging (needs settings) |
66 | // initialize logging (needs settings) |
Line 75... | Line 67... | ||
75 | //Logging_Init(); |
67 | Logging_Init(); |
76 | 68 | ||
77 | #ifdef USE_SDLOGGER |
69 | #ifdef USE_SDLOGGER |
78 | printf("\r\n\r\nHW: SD-Logger"); |
70 | printf("\r\n\r\nHW: SD-Logger"); |
Line 94... | Line 86... | ||
94 | while (1) |
86 | while (1) |
95 | { |
87 | { |
96 | // get gps data to update the follow me position |
88 | // get gps data to update the follow me position |
97 | GPS_Update(); |
89 | GPS_Update(); |
Line -... | Line 90... | ||
- | 90 | ||
- | 91 | // update logging |
|
- | 92 | Logging_Update(); |
|
98 | 93 | ||
99 | // check for button action and change state resectively |
94 | // check for button action and change state resectively |
100 | if(GetButton()) |
95 | if(GetButton()) |
101 | { |
96 | { |
Line 141... | Line 136... | ||
141 | else // now new position avalable (maybe bad gps signal condition) |
136 | else // now new position avalable (maybe bad gps signal condition) |
142 | { |
137 | { |
143 | FollowMe_Timer = SetDelay(FOLLOWME_INTERVAL/4); // reset timer on higer frequency |
138 | FollowMe_Timer = SetDelay(FOLLOWME_INTERVAL/4); // reset timer on higer frequency |
144 | } |
139 | } |
145 | LEDGRN_TOGGLE; // indication of active follow me |
140 | LEDGRN_TOGGLE; // indication of active follow me |
146 | FollowMe_active = 1; |
- | |
147 | } |
141 | } |
148 | break; |
142 | break; |
Line 149... | Line 143... | ||
149 | 143 | ||
150 | case STATE_IDLE: |
144 | case STATE_IDLE: |
151 | // do nothing |
145 | // do nothing |
152 | LEDGRN_ON; |
- | |
153 | FollowMe_active = 0; |
146 | LEDGRN_ON; |
Line 154... | Line 147... | ||
154 | break; |
147 | break; |
155 | 148 | ||
156 | default: |
149 | default: |