adapt GPS-stuff for ESP32

This commit is contained in:
Staars 2020-04-13 16:20:49 +02:00
parent 16ca5cb103
commit 5588d1dda0
4 changed files with 23 additions and 2 deletions

View File

@ -87,7 +87,7 @@ bool NtpServer::processOneRequest(uint32_t utc, uint32_t millisecs)
packet.swapEndian();
timeServerPort_.beginPacket(timeServerPort_.remoteIP(), timeServerPort_.remotePort());
timeServerPort_.write(packet.packet(), NtpPacket::PACKET_SIZE);
timeServerPort_.write((const uint8_t *)packet.packet(), NtpPacket::PACKET_SIZE);
timeServerPort_.endPacket();
processed = true;

View File

@ -102,4 +102,3 @@ lib_ignore =
ILI9488
SSD3115
cc1101
ArduinoNTPd

View File

@ -37,6 +37,7 @@
\*********************************************************************************************/
#ifdef USE_FLOG
#ifdef ESP8266
class FLOG
@ -429,4 +430,5 @@ void FLOG::stopRecording(void){
_initBuffer();
}
#endif // ESP8266
#endif // USE_FLOG

View File

@ -18,6 +18,10 @@
*/
#ifdef USE_GPS
#if defined(ESP32) && defined(USE_FLOG)
#undef USE_FLOG
#warning FLOG deactivated on ESP32
#endif //ESP32
/*********************************************************************************************\
--------------------------------------------------------------------------------------------
Version Date Action Description
@ -115,6 +119,10 @@ rule3 on tele-FLOG#sec do DisplayText [f0c1l4]SAV:%value% endon on tele-FLOG#r
#include "NTPServer.h"
#include "NTPPacket.h"
#ifdef ESP32
#include <HardwareSerial.h>
#endif
/*********************************************************************************************\
* constants
\*********************************************************************************************/
@ -291,7 +299,11 @@ enum UBXMsgType {
#ifdef USE_FLOG
FLOG *Flog = nullptr;
#endif //USE_FLOG
#ifdef ESP8266
TasmotaSerial *UBXSerial;
#else
HardwareSerial *UBXSerial;
#endif
NtpServer timeServer(PortUdp);
@ -351,13 +363,21 @@ void UBXDetect(void)
{
UBX.mode.init = 0;
if ((pin[GPIO_GPS_RX] < 99) && (pin[GPIO_GPS_TX] < 99)) {
#ifdef ESP8266
UBXSerial = new TasmotaSerial(pin[GPIO_GPS_RX], pin[GPIO_GPS_TX], 1, 0, UBX_SERIAL_BUFFER_SIZE); // 64 byte buffer is NOT enough
if (UBXSerial->begin(9600)) {
#else
UBXSerial = new HardwareSerial(2);
UBXSerial->begin(9600,SERIAL_8N1,pin[GPIO_GPS_RX], pin[GPIO_GPS_TX]);
{
#endif
DEBUG_SENSOR_LOG(PSTR("UBX: started serial"));
#ifdef ESP8266
if (UBXSerial->hardwareSerial()) {
ClaimSerial();
DEBUG_SENSOR_LOG(PSTR("UBX: claim HW"));
}
#endif
}
}
else {