Bmag incl gps rettelse
Dependencies: mbed WDT MODSERIAL BME280
Diff: main.cpp
- Revision:
- 13:45b333983206
- Parent:
- 12:2b46960a5d41
- Child:
- 14:400ecb93c6a2
--- a/main.cpp Wed Apr 05 13:00:10 2017 +0000 +++ b/main.cpp Fri Apr 07 08:28:28 2017 +0000 @@ -4,6 +4,9 @@ //After this duration, an error indication will occur if fix is not present. #define GPSACQTIMELIMITINSECONDS 60 +//to change battery low indication change this value +#define BATTERYLOWLIMIT 10.5 + //change BARCODE string inside double quotes to barcode of BMAG equipment char BARCODE[6] = "12345"; @@ -149,6 +152,12 @@ bmag.rxBufferFlush(); } + if((0.00036621652)*battery.read_u16() < BATTERYLOWLIMIT){ + dispTxtHandler.setErrorState(BATTERY_LOW); + redLed = 1; + greenLed = 0; + } + if(BMAG_Data_Rdy){ //if mag data is present but gps data is not @@ -378,10 +387,11 @@ if((GGA_Fix_Present && GpsCntWithoutMagData < 20) || (magTimeSetManually && GpsCntWithoutMagData < 20)){ - //GGA fix LED indicator / time set manually - greenLed = 1; - redLed = 0; - + //GGA fix LED indicator / time set manually unless battery is low + if(getErrorState() != BATTERY_LOW){ + greenLed = 1; + redLed = 0; + } }