added debug-Function for EE-Sanity-Check
This commit is contained in:
parent
f92f6a23c7
commit
fbe5f0b202
@ -15,18 +15,18 @@
|
||||
|
||||
DebugStatus_t DebuggerStatus[dbg_cntElements];
|
||||
|
||||
String IpAddress2String(const IPAddress &ipAddress);
|
||||
void processCmdDebug(String command);
|
||||
void Debug_formatCFG();
|
||||
void Debug_formatPersistence();
|
||||
void Debug_printSystemInfo();
|
||||
void Debug_printWifiInfo();
|
||||
void Debug_CheckEEPOM();
|
||||
void Debug_CheckEEPOM(bool autocorrect);
|
||||
void Debug_dumpConfig();
|
||||
void Debug_dumpPersistance();
|
||||
void Debug_ShowDTCs();
|
||||
void Debug_dumpGlobals();
|
||||
void Debug_printHelp();
|
||||
const char *uint32_to_binary_string(uint32_t num);
|
||||
|
||||
/**
|
||||
* @brief Initializes the debugger by setting the initial status for different debug ports.
|
||||
@ -236,7 +236,9 @@ void processCmdDebug(String command)
|
||||
else if (command == "formatPDS")
|
||||
Debug_formatPersistence();
|
||||
else if (command == "checkEE")
|
||||
Debug_CheckEEPOM();
|
||||
Debug_CheckEEPOM(false);
|
||||
else if (command == "checkEEfix")
|
||||
Debug_CheckEEPOM(true);
|
||||
else if (command == "dumpEE1k")
|
||||
dumpEEPROM(0, 1024);
|
||||
else if (command == "dumpEE")
|
||||
@ -377,14 +379,14 @@ void Debug_dumpPersistance()
|
||||
*/
|
||||
void Debug_printWifiInfo()
|
||||
{
|
||||
// Add relevant code here if needed
|
||||
Debug_pushMessage("IP Adress: %s\n", WiFi.localIP().toString().c_str());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Checks the EEPROM data integrity by calculating and comparing checksums.
|
||||
* Prints the result to the debug output.
|
||||
*/
|
||||
void Debug_CheckEEPOM()
|
||||
void Debug_CheckEEPOM(bool autocorrect)
|
||||
{
|
||||
// Check PersistenceData EEPROM checksum
|
||||
uint32_t checksum = PersistenceData.checksum;
|
||||
@ -414,6 +416,17 @@ void Debug_CheckEEPOM()
|
||||
Debug_pushMessage("LubeConfig EEPROM Checksum BAD\n");
|
||||
}
|
||||
LubeConfig.checksum = checksum;
|
||||
|
||||
uint32_t sanitycheck = ConfigSanityCheck(autocorrect);
|
||||
|
||||
if (sanitycheck == 0)
|
||||
{
|
||||
Debug_pushMessage("LubeConfig Sanity Check OK\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug_pushMessage("LubeConfig Sanity Check BAD: %s\n", uint32_to_binary_string(sanitycheck));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -474,3 +487,29 @@ void Debug_printHelp()
|
||||
Debug_pushMessage(buff);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert a uint32_t value to a binary string with nibbles separated by a space.
|
||||
*
|
||||
* This function takes a uint32_t value and converts it to a binary string
|
||||
* representation. The binary string is stored in a static buffer and returned
|
||||
* as a const char pointer. Each nibble (4 bits) in the binary representation
|
||||
* is separated by a space. The buffer is overwritten on subsequent calls to
|
||||
* this function.
|
||||
*
|
||||
* @param num The uint32_t value to convert.
|
||||
* @return A pointer to a const char string containing the binary representation
|
||||
* of the input number with nibbles separated by a space.
|
||||
*/
|
||||
const char* uint32_to_binary_string(uint32_t num) {
|
||||
static char binary_str[65]; // 32 bits + 31 spaces + null terminator
|
||||
int i, j;
|
||||
for (i = 31, j = 0; i >= 0; i--, j++) {
|
||||
binary_str[j] = ((num >> i) & 1) ? '1' : '0';
|
||||
if (i % 4 == 0 && i != 0) {
|
||||
binary_str[++j] = ' '; // Insert space after every nibble
|
||||
}
|
||||
}
|
||||
binary_str[j] = '\0'; // Null terminator
|
||||
return binary_str;
|
||||
}
|
@ -266,24 +266,6 @@ void loop()
|
||||
yield();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Converts an IPAddress object to a String representation.
|
||||
*
|
||||
* This function takes an IPAddress object and converts it into a String representing
|
||||
* the IPv4 address. Each octet of the address is separated by a dot.
|
||||
*
|
||||
* @param ipAddress The IPAddress object to be converted.
|
||||
* @return A String representing the IPv4 address.
|
||||
*/
|
||||
String IpAddress2String(const IPAddress &ipAddress)
|
||||
{
|
||||
// Concatenate each octet of the IPAddress with dots in between
|
||||
return String(ipAddress[0]) + String(".") +
|
||||
String(ipAddress[1]) + String(".") +
|
||||
String(ipAddress[2]) + String(".") +
|
||||
String(ipAddress[3]);
|
||||
}
|
||||
|
||||
#ifdef FEATURE_ENABLE_WIFI_CLIENT
|
||||
/**
|
||||
* @brief Callback function for maintaining WiFi connection and handling connection failures.
|
||||
|
Loading…
x
Reference in New Issue
Block a user