Updated Debugging-Stuff and WebUI Backend

This commit is contained in:
2023-04-13 00:35:24 +02:00
parent 4507c80eba
commit aeab80d5a8
11 changed files with 489 additions and 46 deletions

View File

@@ -40,28 +40,10 @@
#define I2C_POWER_ADDRESS 0x40
#define I2C_EEPROM_ADDRESS 0x50
#define SW_VERSION 1.0
#define FLASH_FS_VERSION 1.0
#ifndef OTA_DELAY
#define OTA_DELAY 50 // ticks -> 10ms / tick
#endif
#ifndef ADMIN_PASSWORD
#error "You need to define ADMIN_PASSWORD for OTA-Update"
#endif
#ifndef WIFI_PASSWORD
#error "You must define an WIFI_PASSWORD for OTA-Update"
#endif
#ifndef WIFI_SSID
#error "You must define an WIFI_SSID for OTA-Update"
#endif
#ifndef WIFI_AP_SSID
#warning "No WIFI_AP_SSID defined. Using DeviceName"
#define WIFI_AP_SSID DEVICE_NAME
#endif
#ifndef WIFI_AP_PASSWORD
#error "You must define an WIFI_AP_PASSWORD for Standalone AP-Mode"
#endif
#endif

View File

@@ -43,6 +43,8 @@ const char BatteryString[][10]{
"LiPo 3S"
};
const size_t BatteryString_Elements = sizeof(BatteryString) / sizeof(BatteryString[0]);
typedef struct
{
uint8_t EEPROM_Version = 1;

View File

@@ -0,0 +1,46 @@
#ifndef _DEBUGGER_H_
#define _DEBUGGER_H_
#include <Arduino.h>
#include "webui.h"
const char PROGMEM helpCmd[] = "sysinfo - System Info\n"
"netinfo - WiFi Info\n"
"formatPDS - Format Persistence EEPROM Data\n"
"formatCFG - Format Configuration EEPROM Data\n"
"checkEE - Check EEPROM with checksum\n"
"dumpEE1k - dump the first 1kb of EEPROM to Serial\n"
"dumpEE - dump the whole EPPROM to Serial\n"
"resetPageEE - Reset the PersistenceData Page\n"
"dumpCFG - print Config struct\n"
"dumpPDS - print PersistanceStruct\n"
"saveEE - save EE-Data\n"
"showdtc - Show all DTCs\n"
"dumpGlobals - print globals\n";
typedef enum DebugStatus_e
{
disabled,
enabled
} DebugStatus_t;
typedef enum DebugPorts_e
{
dbg_Serial,
dbg_Webui,
dbg_cntElements
} DebugPorts_t;
const char sDebugPorts[dbg_cntElements][7] = {
"Serial",
"WebUI"};
extern DebugStatus_t DebuggerStatus[dbg_cntElements];
void initDebugger();
void pushCANDebug(uint32_t id, uint8_t dlc, uint8_t *data);
void Debug_pushMessage(const char *format, ...);
void SetDebugportStatus(DebugPorts_t port, DebugStatus_t status);
void Debug_Process();
#endif

View File

@@ -17,14 +17,16 @@ typedef enum DTCNums_e
DTC_EEPROM_CFG_SANITY,
DTC_NO_LORA_FOUND,
DTC_NO_BATMNON_FOUND,
DTC_BAT_LOW,
DTC_BAT_CRITICAL,
DTC_LAST_DTC
} DTCNums_t;
typedef enum DTCActive_e
{
DTC_NONE,
DTC_ACTIVE,
DTC_PREVIOUS,
DTC_NONE
DTC_PREVIOUS
} DTCActive_t;
typedef enum DTCSeverity_e
@@ -48,6 +50,7 @@ void ClearDTC(DTCNums_t DTC_no);
void ClearAllDTC();
DTCNums_t getlastDTC(boolean only_active);
DTCNums_t getlastDTC_Severity(boolean only_active, DTCSeverity_t severity);
void DTC_Process();
extern DTCEntry_s DTCStorage[MAX_DTC_STORAGE];
#endif

View File

@@ -41,5 +41,21 @@ typedef struct Globals_s
} Globals_t;
extern Globals_t globals;
typedef struct Constants_s
{
uint8_t FW_Version_major;
uint8_t FW_Version_minor;
uint8_t Required_Flash_Version_major;
uint8_t Required_Flash_Version_minor;
char GitHash[11];
} Constants_t;
const Constants_t constants PROGMEM = {
1,1, // Firmware_Version
1,1, // Required Flash Version
GIT_REV // Git-Hash-String
};
void initGlobals();
#endif

View File

@@ -0,0 +1,21 @@
#ifndef _SANITYCHECK_H_
#define _SANITYCHECK_H_
#ifndef ADMIN_PASSWORD
#error "You need to define ADMIN_PASSWORD for OTA-Update"
#endif
#ifndef WIFI_PASSWORD
#error "You must define an WIFI_PASSWORD for OTA-Update"
#endif
#ifndef WIFI_SSID
#error "You must define an WIFI_SSID for OTA-Update"
#endif
#ifndef WIFI_AP_SSID
#warning "No WIFI_AP_SSID defined. Using DeviceName"
#define WIFI_AP_SSID DEVICE_NAME
#endif
#ifndef WIFI_AP_PASSWORD
#error "You must define an WIFI_AP_PASSWORD for Standalone AP-Mode"
#endif
#endif //_SANITYCHECK_H_

View File

@@ -15,7 +15,10 @@
#include "globals.h"
#include "dtc.h"
#include "common.h"
#include "debugger.h"
void initWebUI();
void Webserver_Process();
void Websocket_PushLiveDebug(String Message);
#endif