Fix SatsInView
This commit is contained in:
parent
6b1889d8f2
commit
285ef0bb93
2 changed files with 6 additions and 10 deletions
|
@ -2,11 +2,10 @@
|
||||||
|
|
||||||
byte CFG_RST[12] = {0xb5, 0x62, 0x06, 0x04, 0x04, 0x00, 0x00, 0x00, 0x01,0x00, 0x0F, 0x66};
|
byte CFG_RST[12] = {0xb5, 0x62, 0x06, 0x04, 0x04, 0x00, 0x00, 0x00, 0x01,0x00, 0x0F, 0x66};
|
||||||
|
|
||||||
void Gps::init()
|
Gps::Gps() {
|
||||||
{
|
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
Serial.setTimeout(2);
|
Serial.setTimeout(2);
|
||||||
Serial.write(CFG_RST, sizeof(CFG_RST)); // Soft Reset GPS on Start
|
// Serial.write(CFG_RST, sizeof(CFG_RST)); // Soft Reset GPS on Start
|
||||||
satsInView.begin(tGps, "GPGSV", 3); // NMEA Sentence GPGSV, Element 3 (Sat in View)
|
satsInView.begin(tGps, "GPGSV", 3); // NMEA Sentence GPGSV, Element 3 (Sat in View)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,10 +17,7 @@ void Gps::encode()
|
||||||
while((previousMillis + 100) > millis())
|
while((previousMillis + 100) > millis())
|
||||||
{
|
{
|
||||||
while (Serial.available() )
|
while (Serial.available() )
|
||||||
{
|
tGps.encode((char)Serial.read());
|
||||||
char data = Serial.read();
|
|
||||||
tGps.encode(data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//Serial.println("");
|
//Serial.println("");
|
||||||
}
|
}
|
||||||
|
@ -52,7 +48,7 @@ bool Gps::buildPacket(uint8_t txBuffer[9])
|
||||||
void Gps::gdisplay(uint16_t dispBuffer[])
|
void Gps::gdisplay(uint16_t dispBuffer[])
|
||||||
{
|
{
|
||||||
dispBuffer[0] = tGps.hdop.value()/10;
|
dispBuffer[0] = tGps.hdop.value()/10;
|
||||||
dispBuffer[1] = TinyGPSPlus::parseDecimal(satsInView.value());
|
dispBuffer[1] = atoi(satsInView.value());
|
||||||
dispBuffer[2] = tGps.satellites.value();
|
dispBuffer[2] = tGps.satellites.value();
|
||||||
dispBuffer[3] = tGps.altitude.meters();
|
dispBuffer[3] = tGps.altitude.meters();
|
||||||
dispBuffer[4] = tGps.speed.kmph();
|
dispBuffer[4] = tGps.speed.kmph();
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
class Gps
|
class Gps
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void init();
|
Gps();
|
||||||
bool checkGpsFix();
|
bool checkGpsFix();
|
||||||
bool buildPacket(uint8_t txBuffer[]);
|
bool buildPacket(uint8_t txBuffer[]);
|
||||||
void gdisplay(uint16_t dispBuffer[]);
|
void gdisplay(uint16_t dispBuffer[]);
|
||||||
|
@ -17,7 +17,7 @@ class Gps
|
||||||
uint16_t altitudeGps;
|
uint16_t altitudeGps;
|
||||||
uint8_t hdopGps;
|
uint8_t hdopGps;
|
||||||
TinyGPSPlus tGps;
|
TinyGPSPlus tGps;
|
||||||
TinyGPSCustom satsInView;
|
TinyGPSCustom satsInView;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in a new issue