removed feature-defines for CAN and Websockets

This commit is contained in:
Marcel Peterkau 2023-12-25 00:44:24 +01:00
parent e8a93a600e
commit 3d7e798310
10 changed files with 27 additions and 67 deletions

View File

@ -20,12 +20,8 @@ typedef enum SpeedSource_e
SOURCE_TIME,
#endif
SOURCE_IMPULSE,
#ifdef FEATURE_ENABLE_GPS
SOURCE_GPS,
#endif
#if FEATURE_ENABLE_CAN
SOURCE_CAN
#endif
} SpeedSource_t;
const char SpeedSourceString[][8] = {
@ -33,15 +29,10 @@ const char SpeedSourceString[][8] = {
"Timer",
#endif
"Impuls",
#ifdef FEATURE_ENABLE_GPS
"GPS",
#endif
#if FEATURE_ENABLE_CAN
"CAN-Bus"
#endif
};
#ifdef FEATURE_ENABLE_GPS
typedef enum GPSBaudRate_e
{
BAUD_9600,
@ -53,9 +44,7 @@ const char GPSBaudRateString[][7] = {
"115200"};
const size_t GPSBaudRateString_Elements = sizeof(GPSBaudRateString) / sizeof(GPSBaudRateString[0]);
#endif
#ifdef FEATURE_ENABLE_CAN
typedef enum CANSource_e
{
KTM_890_ADV_R_2021,
@ -67,7 +56,6 @@ const char CANSourceString[][30] = {
"KTM 1290 Superduke R (2023)"};
const size_t CANSourceString_Elements = sizeof(CANSourceString) / sizeof(CANSourceString[0]);
#endif
const size_t SpeedSourceString_Elements = sizeof(SpeedSourceString) / sizeof(SpeedSourceString[0]);
@ -96,12 +84,8 @@ typedef struct
uint32_t DistancePerRevolution_mm = 2000;
uint16_t BleedingPulses = 25;
SpeedSource_t SpeedSource = SOURCE_IMPULSE;
#ifdef FEATURE_ENABLE_GPS
GPSBaudRate_t GPSBaudRate = BAUD_115200;
#endif
#ifdef FEATURE_ENABLE_CAN
CANSource_t CANSource = KTM_890_ADV_R_2021;
#endif
bool LED_Mode_Flash = false;
uint8_t LED_Max_Brightness = 255;
uint8_t LED_Min_Brightness = 5;
@ -110,12 +94,8 @@ typedef struct
const LubeConfig_t LubeConfig_defaults = {
0, 8000, 4000, 320, DEFAULT_PUMP_DOSE, 30, 1, 150, 70, 18, 2000, 25, SOURCE_IMPULSE,
#ifdef FEATURE_ENABLE_GPS
BAUD_115200,
#endif
#ifdef FEATURE_ENABLE_CAN
KTM_890_ADV_R_2021,
#endif
false,
255,
5,

View File

@ -5,6 +5,7 @@
#include "config.h"
#include "common.h"
#include "dtc.h"
#include "debugger.h"
void Init_GPS();
uint32_t Process_GPS_WheelSpeed();

View File

@ -16,12 +16,6 @@
#endif
#endif
#ifdef CAN_DEBUG_MESSAGE
#ifndef FEATURE_ENABLE_CAN
#error "You cannot enable CAN-Debug-Message without FEATURE_ENABLE_CAN"
#endif
#endif
#ifndef ADMIN_PASSWORD
#error "You need to define ADMIN_PASSWORD for OTA-Update"
#endif

View File

@ -20,8 +20,6 @@
void initWebUI();
void Webserver_Process();
#ifdef FEATURE_ENABLE_WEBSOCKETS
void Websocket_PushLiveDebug(String Message);
#endif
#endif

View File

@ -18,6 +18,15 @@ platform = espressif8266
board = d1_mini
framework = arduino
upload_speed = 921600
upload_protocol = espota
upload_port = 10.0.1.14
upload_flags =
--port=8266
--auth=${wifi_cred.admin_password}
build_flags =
!python git_rev_macro.py
-DWIFI_SSID_CLIENT=${wifi_cred.wifi_ssid_client}
@ -52,10 +61,7 @@ build_flags =
${env.build_flags}
;-DFEATURE_ENABLE_WIFI_CLIENT
;-DFEATURE_ENABLE_TIMER
;-DFEATURE_ENABLE_GPS
-DFEATURE_ENABLE_OLED
-DFEATURE_ENABLE_WEBSOCKETS
-DFEATURE_ENABLE_CAN
-DCAN_DEBUG_MESSAGE
-DPCB_REV=${this.custom_pcb_revision}

View File

@ -1,4 +1,3 @@
#ifdef FEATURE_ENABLE_CAN
#include "can.h"
MCP_CAN CAN0(GPIO_CS_CAN);
@ -149,4 +148,3 @@ void sendCANDebugMessage()
}
}
#endif
#endif

View File

@ -347,22 +347,18 @@ uint32_t ConfigSanityCheck(bool autocorrect)
LubeConfig.SpeedSource = LubeConfig_defaults.SpeedSource;
}
#ifdef FEATURE_ENABLE_GPS
if (!(LubeConfig.GPSBaudRate >= 0) || !(LubeConfig.GPSBaudRate < GPSBaudRateString_Elements))
{
SET_BIT(setting_reset_bits, 12);
if (autocorrect)
LubeConfig.GPSBaudRate = LubeConfig_defaults.GPSBaudRate;
}
#endif
#ifdef FEATURE_ENABLE_CAN
if (!(LubeConfig.CANSource >= 0) || !(LubeConfig.CANSource < CANSourceString_Elements))
{
SET_BIT(setting_reset_bits, 13);
if (autocorrect)
LubeConfig.CANSource = LubeConfig_defaults.CANSource;
}
#endif
return setting_reset_bits;
}

View File

@ -242,12 +242,8 @@ void Debug_dumpConfig()
Debug_pushMessage("DistancePerRevolution_mm: %d\n", LubeConfig.DistancePerRevolution_mm);
Debug_pushMessage("BleedingPulses: %d\n", LubeConfig.BleedingPulses);
Debug_pushMessage("SpeedSource: %d\n", LubeConfig.SpeedSource);
#ifdef FEATURE_ENABLE_GPS
Debug_pushMessage("GPSBaudRate: %d\n", LubeConfig.GPSBaudRate);
#endif
#ifdef FEATURE_ENABLE_CAN
Debug_pushMessage("CANSource: %d\n", LubeConfig.CANSource);
#endif
Debug_pushMessage("checksum: 0x%08X\n", LubeConfig.checksum);
}

View File

@ -1,4 +1,3 @@
#ifdef FEATURE_ENABLE_GPS
#include "gps.h"
TinyGPSPlus gps;
@ -50,10 +49,7 @@ uint32_t Process_GPS_WheelSpeed()
lastRecTimestamp = millis();
}
}
MaintainDTC(DTC_NO_GPS_SERIAL,DTC_CRITICAL, (millis() > lastRecTimestamp + 10000));
MaintainDTC(DTC_NO_GPS_SERIAL, (millis() > lastRecTimestamp + 10000));
return 0;
}
#endif

View File

@ -18,12 +18,8 @@
#include "config.h"
#include "globals.h"
#include "debugger.h"
#ifdef FEATURE_ENABLE_CAN
#include "can.h"
#endif
#ifdef FEATURE_ENABLE_GPS
#include "gps.h"
#endif
#include "dtc.h"
#include "led_colors.h"
@ -99,20 +95,24 @@ void setup()
leds.begin();
Serial.print("\nLED-Init done");
switch (LubeConfig.SpeedSource)
{
case SOURCE_CAN:
Init_CAN();
Serial.print("\nCAN-Init done");
break;
case SOURCE_GPS:
Init_GPS();
Serial.print("\nGPS-Init done");
break;
case SOURCE_IMPULSE:
pinMode(GPIO_TRIGGER, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(GPIO_TRIGGER), trigger_ISR, FALLING);
Serial.print("\nPulse-Input Init done");
#ifdef FEATURE_ENABLE_GPS
Init_GPS();
Serial.print("\nGPS-Init done");
#endif
#ifdef FEATURE_ENABLE_CAN
if (LubeConfig.SpeedSource != SOURCE_IMPULSE)
{
Init_CAN();
Serial.print("\nCAN-Init done");
break;
default:
break;
}
#endif
Serial.print("\nSource-Init done");
pinMode(GPIO_BUTTON, INPUT_PULLUP);
@ -167,32 +167,27 @@ void loop()
case SOURCE_IMPULSE:
wheelDistance = Process_Impulse_WheelSpeed();
break;
#ifdef FEATURE_ENABLE_CAN
case SOURCE_CAN:
wheelDistance = Process_CAN_WheelSpeed();
break;
#endif
#ifdef FEATURE_ENABLE_TIMER
case SOURCE_TIME:
break;
#endif
#ifdef FEATURE_ENABLE_GPS
case SOURCE_GPS:
wheelDistance = Process_GPS_WheelSpeed();
break;
#endif
}
RunLubeApp(wheelDistance);
#ifdef FEATURE_ENABLE_OLED
Display_Process();
#endif
#ifdef FEATURE_ENABLE_CAN
if (LubeConfig.SpeedSource != SOURCE_IMPULSE)
{
CAN_Process();
}
#endif
Button_Process();
LED_Process();
EEPROM_Process();