Fix SatsInView

This commit is contained in:
seiichiro 2021-06-20 18:35:13 +02:00
parent 6b1889d8f2
commit 285ef0bb93
2 changed files with 6 additions and 10 deletions

View File

@ -2,11 +2,10 @@
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.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)
}
@ -18,10 +17,7 @@ void Gps::encode()
while((previousMillis + 100) > millis())
{
while (Serial.available() )
{
char data = Serial.read();
tGps.encode(data);
}
tGps.encode((char)Serial.read());
}
//Serial.println("");
}
@ -52,7 +48,7 @@ bool Gps::buildPacket(uint8_t txBuffer[9])
void Gps::gdisplay(uint16_t dispBuffer[])
{
dispBuffer[0] = tGps.hdop.value()/10;
dispBuffer[1] = TinyGPSPlus::parseDecimal(satsInView.value());
dispBuffer[1] = atoi(satsInView.value());
dispBuffer[2] = tGps.satellites.value();
dispBuffer[3] = tGps.altitude.meters();
dispBuffer[4] = tGps.speed.kmph();

View File

@ -6,7 +6,7 @@
class Gps
{
public:
void init();
Gps();
bool checkGpsFix();
bool buildPacket(uint8_t txBuffer[]);
void gdisplay(uint16_t dispBuffer[]);
@ -17,7 +17,7 @@ class Gps
uint16_t altitudeGps;
uint8_t hdopGps;
TinyGPSPlus tGps;
TinyGPSCustom satsInView;
TinyGPSCustom satsInView;
};
#endif