Code cleaning

This commit is contained in:
norbert-walter 2024-08-20 10:59:42 +02:00
parent e27de07af1
commit ba59d6b4cc
5 changed files with 17 additions and 21 deletions

View File

@ -10,7 +10,7 @@
#include "OBP60Hardware.h" #include "OBP60Hardware.h"
#include "OBP60Extensions.h" #include "OBP60Extensions.h"
// Please dont forget to declarate the fonts in OBP60ExtensionPort.h // Character sets
#include "Ubuntu_Bold8pt7b.h" #include "Ubuntu_Bold8pt7b.h"
#include "Ubuntu_Bold12pt7b.h" #include "Ubuntu_Bold12pt7b.h"
#include "Ubuntu_Bold16pt7b.h" #include "Ubuntu_Bold16pt7b.h"

View File

@ -8,7 +8,7 @@
// Touch keypad over ESP32 touch sensor inputs // Touch keypad over ESP32 touch sensor inputs
int keypad[9]; // Raw data array from TTP229 int keypad[9]; // Raw data array for keys
int key; // Value of key [0|1], 0 = touched, 1 = not touched int key; // Value of key [0|1], 0 = touched, 1 = not touched
int keycode = 0; // Keycode of pressed key [0...8], 0 = nothing touched int keycode = 0; // Keycode of pressed key [0...8], 0 = nothing touched
int keycode2 = 0; // Keycode of very short pressed key [0...8], 0 = nothing touched int keycode2 = 0; // Keycode of very short pressed key [0...8], 0 = nothing touched

View File

@ -6,20 +6,20 @@
#include <HTU21D.h> // Lib for SHT21/HTU21 #include <HTU21D.h> // Lib for SHT21/HTU21
#include "AS5600.h" // Lib for magnetic rotation sensor AS5600 #include "AS5600.h" // Lib for magnetic rotation sensor AS5600
#include <INA226.h> // Lib for power management IC INA226 #include <INA226.h> // Lib for power management IC INA226
#include <Ticker.h> // Timer Lib for timer interrupts #include <Ticker.h> // Timer Lib for timer
#include <RTClib.h> // DS1388 RTC #include <RTClib.h> // DS1388 RTC
#include <OneWire.h> // 1Wire Lib #include <OneWire.h> // 1Wire Lib
#include <DallasTemperature.h> // Lib for DS18B20 #include <DallasTemperature.h> // Lib for DS18B20
#include "OBPSensorTask.h" #include "OBPSensorTask.h" // Lib for sensor reading
#include "OBP60Hardware.h" #include "OBP60Hardware.h" // Hardware definitions
#include "N2kMessages.h" #include "N2kMessages.h" // Lib for NMEA2000
#include "NMEA0183.h" #include "NMEA0183.h" // Lib for NMEA0183
#include "ObpNmea0183.h" #include "ObpNmea0183.h" // Check NMEA0183 sentence for uncorrect content
#include "OBP60Extensions.h" #include "OBP60Extensions.h" // Lib for hardware extensions
#include "movingAvg.h" // Lib for moving average building #include "movingAvg.h" // Lib for moving average building
// Timer Interrupts for hardware functions // Timer for hardware functions
Ticker Timer1(blinkingFlashLED, 500); // Satrt Timer2 for flash LED all 500ms Ticker Timer1(blinkingFlashLED, 500); // Satrt Timer1 for flash LED all 500ms
// Initialization for all sensors (RS232, I2C, 1Wire, IOs) // Initialization for all sensors (RS232, I2C, 1Wire, IOs)
//#################################################################################### //####################################################################################
@ -67,12 +67,8 @@ void sensorTask(void *param){
batV.begin(); batV.begin();
batC.begin(); batC.begin();
// Start timer interrupts // Start timer
bool uvoltage = api->getConfig()->getConfigItem(api->getConfig()->underVoltage,true)->asBoolean(); Timer1.start(); // Start Timer1 for blinking LED
if(uvoltage == true){
Timer1.start(); // Start Timer1 for undervoltage detection
}
Timer1.start(); // Start Timer2 for blinking LED
// Direction settings for NMEA0183 // Direction settings for NMEA0183
String nmea0183Mode = api->getConfig()->getConfigItem(api->getConfig()->serialDirection, true)->asString(); String nmea0183Mode = api->getConfig()->getConfigItem(api->getConfig()->serialDirection, true)->asString();
@ -426,6 +422,7 @@ void sensorTask(void *param){
if(millis() > starttime12 + 500){ if(millis() > starttime12 + 500){
starttime12 = millis(); starttime12 = millis();
if(rtcOn == "DS1388" && RTC_ready == true && GPS_ready == false){ if(rtcOn == "DS1388" && RTC_ready == true && GPS_ready == false){
// Convert RTC time to Unix system time
// https://de.wikipedia.org/wiki/Unixzeit // https://de.wikipedia.org/wiki/Unixzeit
const short daysOfYear[12] = {0,31,59,90,120,151,181,212,243,273,304,334}; const short daysOfYear[12] = {0,31,59,90,120,151,181,212,243,273,304,334};
long unixtime = ds1388.now().get(); long unixtime = ds1388.now().get();

View File

@ -1,6 +1,6 @@
#ifdef BOARD_OBP60S3 #ifdef BOARD_OBP60S3
#include "obp60task.h" #include "obp60task.h"
#include "Pagedata.h" #include "Pagedata.h" // Data exchange for pages
#include "OBP60Hardware.h" // PIN definitions #include "OBP60Hardware.h" // PIN definitions
#include <Wire.h> // I2C connections #include <Wire.h> // I2C connections
#include <RTClib.h> // DS1388 RTC #include <RTClib.h> // DS1388 RTC

View File

@ -4,7 +4,6 @@
#by uncommenting the next line #by uncommenting the next line
default_envs = obp60_s3 default_envs = obp60_s3
[env:obp60_s3] [env:obp60_s3]
;platform = espressif32@6.3.2
platform = espressif32@6.8.1 platform = espressif32@6.8.1
-D board_build.f_cpu = 160000000L -D board_build.f_cpu = 160000000L
board_build.variants_dir = variants board_build.variants_dir = variants
@ -26,8 +25,8 @@ lib_deps =
blemasle/MCP23017@2.0.0 blemasle/MCP23017@2.0.0
adafruit/Adafruit BusIO@1.5.0 adafruit/Adafruit BusIO@1.5.0
adafruit/Adafruit GFX Library@1.11.9 adafruit/Adafruit GFX Library@1.11.9
#zinggjm/GxEPD2@1.5.6 zinggjm/GxEPD2@1.5.6
https://github.com/ZinggJM/GxEPD2 #https://github.com/ZinggJM/GxEPD2
sstaub/Ticker@4.4.0 sstaub/Ticker@4.4.0
adafruit/Adafruit BMP280 Library@2.6.2 adafruit/Adafruit BMP280 Library@2.6.2
adafruit/Adafruit BME280 Library@2.2.2 adafruit/Adafruit BME280 Library@2.2.2