Removed RemoteDebugging Library

This commit is contained in:
Marcel Peterkau 2022-07-15 13:35:57 +02:00
parent 790261b6b7
commit 893a57707d
3 changed files with 8 additions and 217 deletions

View File

@ -34,7 +34,6 @@ build_type = debug
build_flags=
!python git_rev_macro.py
-DSERIAL_DEBUG
-DREMOTE_DEBUG
;-DWIFI_CLIENT
;-DCAPTIVE
-DWIFI_AP_IP_GW=10,0,1,1

View File

@ -19,14 +19,6 @@
#include "dtc.h"
#include "common.h"
#ifdef REMOTE_DEBUG
#include <RemoteDebug.h>
#include "rmtdbghelp.h"
#else
#define debugV Serial.println
#define debugE Serial.println
#endif
#ifdef WIFI_CLIENT
#include <ESP8266WiFiMulti.h>
@ -48,20 +40,6 @@ void SetBatteryType(batteryType_t type);
void ProcessKeyCombos();
void OverrideDisplay(const uint8_t *message, uint32_t time);
#ifdef REMOTE_DEBUG
RemoteDebug Debug;
String IpAddress2String(const IPAddress &ipAddress);
void processCmdRemoteDebug();
void RemoteDebug_formatCFG();
void RemoteDebug_formatPersistence();
void RemotDebug_printSystemInfo();
void RemoteDebug_printWifiInfo();
void RemoteDebug_CheckEEPOM();
void RemoteDebug_dumpConfig();
void RemoteDebug_dumpPersistance();
void RemoteDebug_ShowDTCs();
#endif
#ifdef WIFI_CLIENT
void wifiMaintainConnectionTicker_callback();
Ticker WiFiMaintainConnectionTicker(wifiMaintainConnectionTicker_callback, 1000, 0, MILLIS);
@ -114,22 +92,6 @@ void setup()
pinMode(DIO_FAC_2_TRG, INPUT_PULLUP);
pinMode(DIO_FAC_3_TRG, INPUT);
#ifdef REMOTE_DEBUG
if (MDNS.begin(globals.DeviceName_ID))
MDNS.addService("telnet", "tcp", 23);
Debug.begin(globals.DeviceName_ID);
Debug.setResetCmdEnabled(true);
Debug.showProfiler(false);
Debug.showColors(true);
Debug.setPassword(QUOTE(ADMIN_PASSWORD));
Debug.setSerialEnabled(true);
Debug.showDebugLevel(true);
Debug.setHelpProjectsCmds(helpCmd);
Debug.setCallBackProjectCmds(&processCmdRemoteDebug);
#endif
#ifdef SERIAL_DEBUG
Serial.setDebugOutput(true);
#endif
@ -224,9 +186,6 @@ void loop()
#ifdef CAPTIVE
dnsServer.processNextRequest();
#endif
#ifdef REMOTE_DEBUG
Debug.handle();
#endif
#ifdef WIFI_CLIENT
WiFiMaintainConnectionTicker.update();
#endif
@ -374,12 +333,12 @@ void powerMonitorTicker_callback()
break;
}
debugV("Battery Level: %d %%", globals.battery_level);
debugV("Bus Voltage: %f V", busvoltage);
debugV("Shunt Voltage: %f mV", shuntvoltage);
debugV("Load Voltage: %f V", globals.loadvoltage);
debugV("Current: %f mA", current_mA);
debugV("Power: %f mW", power_mW);
Serial.printf("Battery Level: %d %%\n", globals.battery_level);
Serial.printf("Bus Voltage: %f V\n", busvoltage);
Serial.printf("Shunt Voltage: %f mV\n", shuntvoltage);
Serial.printf("Load Voltage: %f V\n", globals.loadvoltage);
Serial.printf("Current: %f mA\n", current_mA);
Serial.printf("Power: %f mW\n", power_mW);
}
void EEPROMCyclicPDS_callback()
@ -433,164 +392,13 @@ void SystemShutdown()
ESP.restart();
}
#ifdef REMOTE_DEBUG
void processCmdRemoteDebug()
{
String lastCmd = Debug.getLastCommand();
if (lastCmd == "sysinfo")
RemotDebug_printSystemInfo();
else if (lastCmd == "netinfo")
RemoteDebug_printWifiInfo();
else if (lastCmd == "formatCFG")
RemoteDebug_formatCFG();
else if (lastCmd == "formatPDS")
RemoteDebug_formatPersistence();
else if (lastCmd == "checkEE")
RemoteDebug_CheckEEPOM();
else if (lastCmd == "dumpEE1k")
dumpEEPROM(0, 1024);
else if (lastCmd == "dumpEE")
dumpEEPROM(0, EEPROM_SIZE_BYTES);
else if (lastCmd == "resetPageEE")
MovePersistencePage_EEPROM(true);
else if (lastCmd == "dumpCFG")
RemoteDebug_dumpConfig();
else if (lastCmd == "dumpPDS")
RemoteDebug_dumpPersistance();
else if (lastCmd == "saveEE")
StoreConfig_EEPROM();
else if (lastCmd == "showdtc")
RemoteDebug_ShowDTCs();
else if (lastCmd == "bat_3s")
SetBatteryType(BATTERY_LIPO_3S);
else if (lastCmd == "bat_2s")
SetBatteryType(BATTERY_LIPO_2S);
}
void RemoteDebug_formatCFG()
{
debugA("Formatting Config-EEPROM and reseting to default");
FormatConfig_EEPROM();
}
void RemoteDebug_formatPersistence()
{
debugA("Formatting Persistence-EEPROM and reseting to default");
FormatPersistence_EEPROM();
}
void RemotDebug_printSystemInfo()
{
debugA("DE Timer Mk1");
debugA("Hostname: %s", globals.DeviceName_ID);
FlashMode_t ideMode = ESP.getFlashChipMode();
debugA("Sdk version: %s", ESP.getSdkVersion());
debugA("Core Version: %s", ESP.getCoreVersion().c_str());
debugA("Boot Version: %u", ESP.getBootVersion());
debugA("Boot Mode: %u", ESP.getBootMode());
debugA("CPU Frequency: %u MHz", ESP.getCpuFreqMHz());
debugA("Reset reason: %s", ESP.getResetReason().c_str());
debugA("Flash Size: %d", ESP.getFlashChipRealSize());
debugA("Flash Size IDE: %d", ESP.getFlashChipSize());
debugA("Flash ide mode: %s", (ideMode == FM_QIO ? "QIO" : ideMode == FM_QOUT ? "QOUT"
: ideMode == FM_DIO ? "DIO"
: ideMode == FM_DOUT ? "DOUT"
: "UNKNOWN"));
debugA("OTA-Pass: %s", QUOTE(ADMIN_PASSWORD));
debugA("Git-Revison: %s", GIT_REV);
debugA("I2C EEPROM Size: %d", GetEESize());
}
void RemoteDebug_dumpConfig()
{
debugA("EEPROM_Version: %d", ConfigData.EEPROM_Version);
debugA("BatteryType: %d", ConfigData.batteryType);
debugA("checksum: 0x%08X", ConfigData.checksum);
}
void RemoteDebug_dumpPersistance()
{
debugA("writeCycleCounter: %d", PersistenceData.writeCycleCounter);
debugA("faction_1_timer: %d", PersistenceData.faction_1_timer);
debugA("faction_2_timer: %d", PersistenceData.faction_2_timer);
debugA("faction_2_timer: %d", PersistenceData.faction_3_timer);
debugA("activeFaction: %d", PersistenceData.activeFaction);
debugA("checksum: %d", PersistenceData.checksum);
debugA("PSD Adress: 0x%04X", getPersistanceAddress());
}
void RemoteDebug_printWifiInfo()
{
}
void RemoteDebug_CheckEEPOM()
{
uint32_t checksum = PersistenceData.checksum;
PersistenceData.checksum = 0;
if (Checksum_EEPROM((uint8_t *)&PersistenceData, sizeof(PersistenceData)) == checksum)
{
debugA("PersistenceData EEPROM Checksum OK\n");
}
else
{
debugA("PersistenceData EEPROM Checksum BAD\n");
}
PersistenceData.checksum = checksum;
checksum = ConfigData.checksum;
ConfigData.checksum = 0;
if (Checksum_EEPROM((uint8_t *)&ConfigData, sizeof(ConfigData)) == checksum)
{
debugA("ConfigData EEPROM Checksum OK\n");
}
else
{
debugA("ConfigData EEPROM Checksum BAD\n");
}
ConfigData.checksum = checksum;
}
void RemoteDebug_ShowDTCs()
{
char buff_timestamp[16]; // Format: DD-hh:mm:ss:xxx
char buff_active[9];
for (uint32_t i = 0; i < MAX_DTC_STORAGE; i++)
{
if (DTCStorage[i].Number > 0)
{
sprintf(buff_timestamp, "%02d-%02d:%02d:%02d:%03d",
DTCStorage[i].timestamp / 86400000, // Days
DTCStorage[i].timestamp / 360000 % 24, // Hours
DTCStorage[i].timestamp / 60000 % 60, // Minutes
DTCStorage[i].timestamp / 1000 % 60, // Seconds
DTCStorage[i].timestamp % 1000); // milliseconds
if (DTCStorage[i].active == DTC_ACTIVE)
strcpy(buff_active, "active");
else if (DTCStorage[i].active == DTC_PREVIOUS)
strcpy(buff_active, "previous");
else
strcpy(buff_active, "none");
debugA("%s \t %6d \t %s", buff_timestamp, DTCStorage[i].Number, buff_active);
}
}
}
#endif
void SetBatteryType(batteryType_t type)
{
if (ConfigData.batteryType != type)
{
ConfigData.batteryType = type;
globals.requestEEAction = EE_CFG_SAVE;
debugV("Set Batterytype to %s", type == BATTERY_LIPO_2S ? "2s Lipo" : "3s LiPo");
Serial.printf("Set Batterytype to %s\n", type == BATTERY_LIPO_2S ? "2s Lipo" : "3s LiPo");
}
}
@ -635,7 +443,7 @@ void ProcessKeyCombos()
if (digitalRead(DIO_FAC_3_TRG) != FAC_3_TRG_PRESSED && keyStatus_Fac3 == KEY_PRESSED)
{
debugV("KeyCombo 1: %d | 2: %d", keyCount_Fac1, keyCount_Fac2);
Serial.printf("KeyCombo 1: %d | 2: %d\n", keyCount_Fac1, keyCount_Fac2);
if (keyCount_Fac1 == 2 && keyCount_Fac2 == 2)
{

View File

@ -1,16 +0,0 @@
const char helpCmd[] = "sysinfo - System Info\r\n"
"netinfo - WiFi Info\r\n"
"showdtc - Show all DTCs\r\n"
"cleardtc - Clear all DTCs\r\n"
"formatPDS - Format Persistence EEPROM Data\r\n"
"formatCFG - Format Configuration EEPROM Data\r\n"
"checkEE - Check EEPROM with checksum\r\n"
"dumpEE1k - dump the first 1kb of EEPROM to Serial\r\n"
"dumpEE - dump the whole EPPROM to Serial\r\n"
"resetPageEE - Reset the PersistenceData Page\r\n"
"dumpCFG - print Config struct\r\n"
"dumpPDS - print PersistanceStruct\r\n"
"saveEE - save EE-Data\r\n"
"bat_3s - set BatteryType to 3S LiPo\r\n"
"bat_2s - set BatteryType to 2S LiPo\r\n"
;