From 4f60101b60c458c852686076eaafcb5ae611822e Mon Sep 17 00:00:00 2001 From: norbert-walter Date: Thu, 17 Mar 2022 13:55:55 +0100 Subject: [PATCH] Fix for Problems with reboots by using GPS modul --- lib/obp60task/config.json | 47 ++++++++++++++++++++++++++++++++++++- lib/obp60task/obp60task.cpp | 18 +++++++------- 2 files changed, 54 insertions(+), 11 deletions(-) diff --git a/lib/obp60task/config.json b/lib/obp60task/config.json index 4c44b38..dc91c99 100644 --- a/lib/obp60task/config.json +++ b/lib/obp60task/config.json @@ -246,7 +246,7 @@ "label": "Env. Sensor", "type": "list", "default": "off", - "description": "Use internal or external environment sensor [off|BME280|BMP280|SHT21]", + "description": "Use internal or external environment sensor via I2C bus[off|BME280|BMP280|SHT21]", "list": [ "off", "BME280", @@ -261,6 +261,51 @@ "obp60":"true" } }, + { + "name": "useRotSensor", + "label": "Rot. Sensor", + "type": "list", + "default": "off", + "description": "Use external rotation sensor via I2C bus[off|AS5600]", + "list": [ + "off", + "AS5600" + ], + "category": "OBP60 Hardware", + "capabilities": { + "obp60":"true" + } + }, + { + "name": "rotFunction", + "label": "Rot. Function", + "type": "list", + "default": "off", + "description": "Function for rotation sensor [off|Rudder|Mast]", + "list": [ + "off", + "Rudder", + "Mast" + ], + "category": "OBP60 Hardware", + "capabilities": { + "obp60":"true" + } + }, + { + "name": "rotOffset", + "label": "Rot. Offset", + "type": "number", + "default": "0", + "check": "checkMinMax", + "min": -180, + "max": 180, + "description": "Offset for rotation sensor [-180°...+180°]", + "category": "OBP60 Hardware", + "capabilities": { + "obp60":"true" + } + }, { "name": "useTempSensor", "label": "Temp. Sensor", diff --git a/lib/obp60task/obp60task.cpp b/lib/obp60task/obp60task.cpp index 5991b0a..cf7ea2e 100644 --- a/lib/obp60task/obp60task.cpp +++ b/lib/obp60task/obp60task.cpp @@ -29,12 +29,11 @@ #include "Logo_OBP_400x300_sw.h" // OBP Logo #include "OBP60QRWiFi.h" // Functions lib for WiFi QR code -#include "ObpNmea0183.h" -#include "GwNmea0183Msg.h" +#include "ObpNmea0183.h" // Bugfix lib for NMEA0183 +#include "GwNmea0183Msg.h" // Bugfix lib for NMEA0183 -tNMEA0183Msg NMEA0183Msg; -ObpNmea0183 NMEA0183; // Fixed Lib for NMEA0183 -// tNMEA0183 NMEA0183; // Old lib with problems for NMEA0183 +ObpNmea0183 NMEA0183; // Use new Lib for NMEA0183 +// tNMEA0183 NMEA0183; // Use old lib with problems for NMEA0183 Adafruit_BME280 bme280; // Evironment sensor BME280 Adafruit_BMP280 bmp280; // Evironment sensor BMP280 @@ -55,8 +54,8 @@ double airpressure = 0; // Ais pressure value from environment sensor // Timer Interrupts for hardware functions void underVoltageDetection(); -Ticker Timer1(underVoltageDetection, 1); // Start Timer1 with maximum speed with 1ms -Ticker Timer2(blinkingFlashLED, 500); +Ticker Timer1(underVoltageDetection, 1); // Start Timer1 with maximum speed with 1ms +Ticker Timer2(blinkingFlashLED, 500); // Satrt Timer2 for flash LED all 500ms // Undervoltage function for shutdown display void underVoltageDetection(){ @@ -94,7 +93,6 @@ void underVoltageDetection(){ // Hardware initialization before start all services //################################################## void OBP60Init(GwApi *api){ - GwLog *logger = api->getLogger(); api->getLogger()->logDebug(GwLog::LOG,"obp60init running"); // Start timer interrupts @@ -547,8 +545,8 @@ void OBP60Task(GwApi *api){ // Send NMEA0183 GPS data on several bus systems all 1000ms if(String(gps) == "NEO-6M" || String(gps) == "NEO-M8N"){ // If config enabled if(gps_ready == true){ - tNMEA0183Msg NMEA0183Msg; - while(NMEA0183.GetMessage(NMEA0183Msg)){ + SNMEA0183Msg NMEA0183Msg; + while(NMEA0183.GetMessageCor(NMEA0183Msg)){ api->sendNMEA0183Message(NMEA0183Msg); } }