Subversion Repositories Projects

Rev

Rev 340 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 340 Rev 356
Line 15... Line 15...
15
#include "gps.h"
15
#include "gps.h"
16
#include "button.h"
16
#include "button.h"
Line 17... Line 17...
17
 
17
 
18
 
18
 
Line 19... Line 19...
19
#define FOLLOWME_INTERVAL 1000 // 1 second update
19
#define FOLLOWME_INTERVAL 1000 // 1 second update
20
#define CELLUNDERVOLTAGE 31 // lowest allowed voltage/cell; 31 = 3.1V
20
#define CELLUNDERVOLTAGE 32 // lowest allowed voltage/cell; 32 = 3.2V
21
 
21
 
22
#ifdef USE_FOLLOWME
22
#ifdef USE_FOLLOWME
23
int16_t UBat = 120;
23
int16_t UBat = 120;
24
int16_t Zellenzahl = 0;
24
int16_t Zellenzahl = 0;
-
 
25
int16_t PowerOn = 0;
25
int16_t PowerOn = 0;
26
int16_t i = 0;
Line 26... Line 27...
26
int16_t i = 0;
27
int16_t delay = 0;
Line 27... Line 28...
27
int16_t delay = 0;
28
int16_t FollowMe_active = 0;
Line 136... Line 137...
136
                                        else // now new position avalable (maybe bad gps signal condition)
137
                                        else // now new position avalable (maybe bad gps signal condition)
137
                                        {
138
                                        {
138
                                                FollowMe_Timer = SetDelay(FOLLOWME_INTERVAL/4);  // reset timer on higer frequency
139
                                                FollowMe_Timer = SetDelay(FOLLOWME_INTERVAL/4);  // reset timer on higer frequency
139
                                        }
140
                                        }
140
                                        LEDGRN_TOGGLE;                                          // indication of active follow me
141
                                        LEDGRN_TOGGLE;                                          // indication of active follow me
-
 
142
                                        FollowMe_active = 1;
141
                                }
143
                                }
142
                                break;
144
                                break;
Line 143... Line 145...
143
 
145
 
144
                        case STATE_IDLE:
146
                        case STATE_IDLE:
145
                                // do nothing
147
                                // do nothing
-
 
148
                                LEDGRN_ON;
146
                                LEDGRN_ON;
149
                                FollowMe_active = 0;
Line 147... Line 150...
147
                                break;
150
                                break;
148
 
151
 
149
                        default:
152
                        default:
Line 192... Line 195...
192
                                i++;
195
                                i++;
193
                                delay = 0;
196
                                delay = 0;
194
                        }
197
                        }
195
                        if(delay < 1500) delay++;
198
                        if(delay < 1500) delay++;
Line 196... Line 199...
196
 
199
 
197
                        // monitor battery undervoltage
200
                        // monitor battery undervoltage [...||(UBat<74) as temporary workaround to protect 2s lipo packs]
198
                        if((UBat < Zellenzahl * CELLUNDERVOLTAGE) && (PowerOn >= 100))
201
                        if(((UBat < Zellenzahl * CELLUNDERVOLTAGE)||(UBat < 74)) && (PowerOn >= 100))
199
                        {   // sound for low battery
202
                        {   // sound for low battery
200
                                BeepModulation = 0x0300;
203
                                BeepModulation = 0x0300;
201
                                if(!BeepTime)
204
                                if(!BeepTime)
202
                                {
205
                                {