removed SoftwareSerial
This commit is contained in:
parent
d940d7aa78
commit
16ec5d6e6d
@ -1,6 +1,5 @@
|
|||||||
#include "gps.h"
|
#include "gps.h"
|
||||||
|
|
||||||
SoftwareSerial swSerGps;
|
|
||||||
TinyGPSPlus gps;
|
TinyGPSPlus gps;
|
||||||
|
|
||||||
void Init_GPS()
|
void Init_GPS()
|
||||||
@ -20,16 +19,7 @@ void Init_GPS()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Serial.printf(PSTR("Init GPS with Baud %d\n"), baudrate);
|
Serial.printf(PSTR("Init GPS with Baud %d\n"), baudrate);
|
||||||
|
Serial.begin(baudrate);
|
||||||
swSerGps.begin(baudrate, SWSERIAL_8N1, GPIO_TRIGGER, -1, false, 256);
|
|
||||||
swSerGps.enableRx(true);
|
|
||||||
// high speed half duplex, turn off interrupts during tx
|
|
||||||
swSerGps.enableIntTx(false);
|
|
||||||
swSerGps.enableTx(false);
|
|
||||||
|
|
||||||
// swSerGps.enableTx(true);
|
|
||||||
// swSerGps.write("Test");
|
|
||||||
// swSerGps.enableTx(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Process_GPS_WheelSpeed()
|
uint32_t Process_GPS_WheelSpeed()
|
||||||
@ -38,9 +28,9 @@ uint32_t Process_GPS_WheelSpeed()
|
|||||||
static uint32_t lastValidSpeedTimestamp;
|
static uint32_t lastValidSpeedTimestamp;
|
||||||
uint16_t RearWheelSpeed_kmh;
|
uint16_t RearWheelSpeed_kmh;
|
||||||
|
|
||||||
while (swSerGps.available() > 0)
|
while (Serial.available() > 0)
|
||||||
{
|
{
|
||||||
uint8_t incoming = swSerGps.read();
|
uint8_t incoming = Serial.read();
|
||||||
if (gps.encode(incoming))
|
if (gps.encode(incoming))
|
||||||
{
|
{
|
||||||
RearWheelSpeed_kmh = gps.speed.isValid() ? gps.speed.kmph() : 0;
|
RearWheelSpeed_kmh = gps.speed.isValid() ? gps.speed.kmph() : 0;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#ifndef _GPS_H_
|
#ifndef _GPS_H_
|
||||||
#define _GPS_H_
|
#define _GPS_H_
|
||||||
|
|
||||||
#include <SoftwareSerial.h>
|
|
||||||
#include <TinyGPSPlus.h>
|
#include <TinyGPSPlus.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user