new debugger and websockets

This commit is contained in:
2023-02-23 23:14:58 +01:00
parent c9a6e4c870
commit 77a94de2eb
14 changed files with 516 additions and 283 deletions

View File

@@ -1,4 +1,5 @@
#include "config.h"
#include "debugger.h"
I2C_eeprom ee(0x50, EEPROM_SIZE_BYTES);
@@ -25,45 +26,45 @@ void EEPROM_Process()
case EE_CFG_SAVE:
StoreConfig_EEPROM();
globals.requestEEAction = EE_IDLE;
Serial.println("Stored EEPROM CFG");
Debug_pushMessage("Stored EEPROM CFG\n");
break;
case EE_CFG_LOAD:
GetConfig_EEPROM();
globals.requestEEAction = EE_IDLE;
Serial.println("Loaded EEPROM CFG");
Debug_pushMessage("Loaded EEPROM CFG\n");
break;
case EE_CFG_FORMAT:
FormatConfig_EEPROM();
globals.requestEEAction = EE_IDLE;
globals.systemStatus = sysStat_Shutdown;
Serial.println("Formated EEPROM CFG");
Debug_pushMessage("Formated EEPROM CFG\n");
break;
case EE_PDS_SAVE:
StorePersistence_EEPROM();
globals.requestEEAction = EE_IDLE;
Serial.println("Stored EEPROM PDS");
Debug_pushMessage("Stored EEPROM PDS\n");
break;
case EE_PDS_LOAD:
GetPersistence_EEPROM();
globals.requestEEAction = EE_IDLE;
Serial.println("Loaded EEPROM PDS");
Debug_pushMessage("Loaded EEPROM PDS\n");
break;
case EE_PDS_FORMAT:
FormatPersistence_EEPROM();
globals.requestEEAction = EE_IDLE;
Serial.println("Formated EEPROM PDS");
Debug_pushMessage("Formated EEPROM PDS\n");
break;
case EE_FORMAT_ALL:
FormatConfig_EEPROM();
FormatPersistence_EEPROM();
globals.requestEEAction = EE_IDLE;
Serial.println("Formated EEPROM ALL");
Debug_pushMessage("Formated EEPROM ALL\n");
break;
case EE_ALL_SAVE:
StorePersistence_EEPROM();
StoreConfig_EEPROM();
globals.requestEEAction = EE_IDLE;
Serial.println("Stored EEPROM ALL");
Debug_pushMessage("Stored EEPROM ALL\n");
break;
case EE_IDLE:
default:
@@ -153,7 +154,7 @@ void GetPersistence_EEPROM()
void FormatConfig_EEPROM()
{
Serial.println("Formatting Config-Partition");
Debug_pushMessage("Formatting Config-Partition\n");
LubeConfig = LubeConfig_defaults;
LubeConfig.EEPROM_Version = eeVersion;
StoreConfig_EEPROM();
@@ -161,7 +162,7 @@ void FormatConfig_EEPROM()
void FormatPersistence_EEPROM()
{
Serial.println("Formatting Persistance-Partition");
Debug_pushMessage("Formatting Persistance-Partition\n");
memset(&PersistenceData, 0, sizeof(PersistenceData));
StorePersistence_EEPROM();
}
@@ -211,9 +212,9 @@ void dumpEEPROM(uint16_t memoryAddress, uint16_t length)
char ascii_buf[BLOCK_TO_LENGTH + 1];
sprintf(ascii_buf, "%*s", BLOCK_TO_LENGTH, "ASCII");
Serial.print(PSTR("\nAddress "));
Debug_pushMessage(PSTR("\nAddress "));
for (int x = 0; x < BLOCK_TO_LENGTH; x++)
Serial.printf("%3d", x);
Debug_pushMessage("%3d", x);
memoryAddress = memoryAddress / BLOCK_TO_LENGTH * BLOCK_TO_LENGTH;
length = (length + BLOCK_TO_LENGTH - 1) / BLOCK_TO_LENGTH * BLOCK_TO_LENGTH;
@@ -224,16 +225,16 @@ void dumpEEPROM(uint16_t memoryAddress, uint16_t length)
if (blockpoint == 0)
{
ascii_buf[BLOCK_TO_LENGTH] = 0;
Serial.printf(" %s", ascii_buf);
Serial.printf("\n0x%05X:", memoryAddress);
Debug_pushMessage(" %s", ascii_buf);
Debug_pushMessage("\n0x%05X:", memoryAddress);
}
ascii_buf[blockpoint] = ee.readByte(memoryAddress);
Serial.printf(" %02X", ascii_buf[blockpoint]);
Debug_pushMessage(" %02X", ascii_buf[blockpoint]);
if (ascii_buf[blockpoint] < 0x20 || ascii_buf[blockpoint] > 0x7E)
ascii_buf[blockpoint] = '.';
memoryAddress++;
}
Serial.println();
Debug_pushMessage("\n");
}
boolean checkEEPROMavailable()