адаптация. в Serial выводятся PPS/SQW и на LCD печатается время
This commit is contained in:
135
2024-07-21 20:30:17 +03:00
parent 43a7b6307c
commit b56f705f05
5 changed files with 271 additions and 10 deletions

View File

@@ -11,8 +11,12 @@
#include "GPS_com.h"
#include "RTC_com.h" // to set the RTC
#define cfg_pin_GPS_PPS 2;
#define cfg_pin_GPS_Rx 4;
#define cfg_pin_GPS_Tx 5;
// add the static modifier to limit visibility of these variables to just this file
static byte GPS_PPS_PIN = 2; // Pin 2 = NANO INT0, GPS PPS interrupt signal on this Pin
static byte GPS_PPS_PIN = cfg_pin_GPS_PPS; // Pin 2 = NANO INT0, GPS PPS interrupt signal on this Pin
static bool gps_on; // flag for GPS ON/OFF
static int pulse_count = 0;
static time_t gps_seconds_t = 0; // GPS time
@@ -21,14 +25,17 @@ volatile bool GPS_sec = false; // flag for GPS-PPS
// set interrupt flag
void gps_interrupt() {
Serial.println("DEBUG[INT] GPS interrupt");
GPS_sec = true;
}
NMEAGPS gps; // This parses the GPS characters
gps_fix fix; // This holds on to the latest values
//#include <GPSport.h> // use only for soft-serial
#define gpsPort Serial
#define GPS_PORT_NAME "Serial"
#include <NeoSWSerial.h>
NeoSWSerial gpsPort(4, 5);
//#define gpsPort Serial
#define GPS_PORT_NAME "NeoSWSerial(4, 5)"
#define DEBUG_PORT Serial
/***** Notice ********************************************
@@ -89,6 +96,7 @@ void GPS_PPS() { // do something on the flip of the GPS second
}
void GPS_read_seconds() {
//Serial.println("DEBUG[GPS_read_second()] Start");
while (gps.available(gpsPort)) {
fix = gps.read();
if (fix.valid.time && fix.valid.date) {