used ChatGPT to add comments and proper Headers to all SourceFiles

This commit is contained in:
2024-01-09 12:54:05 +01:00
parent 62cc2bf982
commit f52f4103f6
21 changed files with 945 additions and 99 deletions

View File

@@ -1,3 +1,17 @@
/**
* @file config.h
*
* @brief Header file for configuration settings and EEPROM operations in the ChainLube application.
*
* This file defines configuration settings for the ChainLube project, including default values,
* EEPROM structures, and functions for EEPROM operations. It also defines enums for different sources
* of speed input, GPS baud rates, and CAN bus sources. Additionally, it includes functions for EEPROM handling
* such as storing, retrieving, and formatting configuration data.
*
* @author Marcel Peterkau
* @date 09.01.2024
*/
#ifndef _CONFIG_H_
#define _CONFIG_H_
@@ -14,6 +28,7 @@
#define EEPROM_SIZE_BYTES I2C_DEVICESIZE_24LC256
#endif
// Enum for different sources of speed input
typedef enum SpeedSource_e
{
#ifdef FEATURE_ENABLE_TIMER
@@ -24,6 +39,7 @@ typedef enum SpeedSource_e
SOURCE_CAN
} SpeedSource_t;
// String representation of SpeedSource enum
const char SpeedSourceString[][8] = {
#ifdef FEATURE_ENABLE_TIMER
"Timer",
@@ -33,32 +49,37 @@ const char SpeedSourceString[][8] = {
"CAN-Bus"
};
const size_t SpeedSourceString_Elements = sizeof(SpeedSourceString) / sizeof(SpeedSourceString[0]);
// Enum for GPS baud rates
typedef enum GPSBaudRate_e
{
BAUD_9600,
BAUD_115200
} GPSBaudRate_t;
// String representation of GPSBaudRate enum
const char GPSBaudRateString[][7] = {
"9600",
"115200"};
const size_t GPSBaudRateString_Elements = sizeof(GPSBaudRateString) / sizeof(GPSBaudRateString[0]);
// Enum for CAN bus sources
typedef enum CANSource_e
{
KTM_890_ADV_R_2021,
KTM_1290_SD_R_2023
} CANSource_t;
// String representation of CANSource enum
const char CANSourceString[][30] = {
"KTM 890 Adventure R (2021)",
"KTM 1290 Superduke R (2023)"};
const size_t CANSourceString_Elements = sizeof(CANSourceString) / sizeof(CANSourceString[0]);
const size_t SpeedSourceString_Elements = sizeof(SpeedSourceString) / sizeof(SpeedSourceString[0]);
// Structure for persistence data stored in EEPROM
typedef struct
{
uint16_t writeCycleCounter = 0;
@@ -69,6 +90,7 @@ typedef struct
uint32_t checksum = 0;
} persistenceData_t;
// Structure for configuration settings stored in EEPROM
typedef struct
{
uint8_t EEPROM_Version = 0;
@@ -92,6 +114,7 @@ typedef struct
uint32_t checksum = 0;
} LubeConfig_t;
// Default configuration settings
const LubeConfig_t LubeConfig_defaults = {
0, 8000, 4000, 320, DEFAULT_PUMP_DOSE, 30, 1, 150, 70, 18, 2000, 25, SOURCE_IMPULSE,
BAUD_115200,
@@ -117,4 +140,4 @@ uint32_t ConfigSanityCheck(bool autocorrect = false);
extern LubeConfig_t LubeConfig;
extern persistenceData_t PersistenceData;
extern uint16_t eePersistenceMarker;
#endif // _CONFIG_H_
#endif // _CONFIG_H_