Add debug MemDump

This commit is contained in:
Theo Arends 2022-01-03 14:02:18 +01:00
parent 3515bd3251
commit 3916709d5f
2 changed files with 24 additions and 6 deletions

View File

@ -42,6 +42,7 @@
* Debug commands
\*********************************************************************************************/
#define D_CMND_MEMDUMP "MemDump"
#define D_CMND_CFGDUMP "CfgDump"
#define D_CMND_CFGPEEK "CfgPeek"
#define D_CMND_CFGPOKE "CfgPoke"
@ -60,7 +61,7 @@
#define D_CMND_SERBUFF "SerBufSize"
const char kDebugCommands[] PROGMEM = "|" // No prefix
D_CMND_CFGDUMP "|" D_CMND_CFGPEEK "|" D_CMND_CFGPOKE "|"
D_CMND_MEMDUMP "|" D_CMND_CFGDUMP "|" D_CMND_CFGPEEK "|" D_CMND_CFGPOKE "|"
#ifdef USE_WEBSERVER
D_CMND_CFGXOR "|"
#endif
@ -75,7 +76,7 @@ const char kDebugCommands[] PROGMEM = "|" // No prefix
;
void (* const DebugCommand[])(void) PROGMEM = {
&CmndCfgDump, &CmndCfgPeek, &CmndCfgPoke,
&CmndMemDump, &CmndCfgDump, &CmndCfgPeek, &CmndCfgPoke,
#ifdef USE_WEBSERVER
&CmndCfgXor,
#endif
@ -313,8 +314,8 @@ void DebugDump(uint32_t start, uint32_t size) {
uint32_t col;
char *p;
uint8_t *buffer = (uint8_t *)&start;
maxrow = ((start + size + CFG_COLS) / CFG_COLS);
uint8_t *buffer = (uint8_t *)(start);
maxrow = ((size + CFG_COLS) / CFG_COLS);
uint32_t srow = 0;
uint32_t mrow = maxrow;
@ -334,7 +335,7 @@ void DebugDump(uint32_t start, uint32_t size) {
char log_data[150]; // 020: C7 2B 2E AB 70 E8 09 AE C8 88 3D EA 7C FF 48 2F 0E A7 D7 BF 02 0E D7 7D C9 6F B9 3A 1D 01 3F 28 | +. p = | H/ } o : ?(|
for (row = srow; row < maxrow; row++) {
idx = row * CFG_COLS;
snprintf_P(log_data, sizeof(log_data), PSTR("%03X:"), idx);
snprintf_P(log_data, sizeof(log_data), PSTR("%08X:"), start + idx);
for (col = 0; col < CFG_COLS; col++) {
if (!(col%4)) {
snprintf_P(log_data, sizeof(log_data), PSTR("%s "), log_data);
@ -354,6 +355,7 @@ void DebugDump(uint32_t start, uint32_t size) {
}
}
void DebugCfgDump(char* parms)
{
uint32_t CFG_COLS = 16;
@ -489,6 +491,19 @@ void CmndRtcDump(void)
ResponseCmndDone();
}
void CmndMemDump(void) {
// MemDump 0x3fff1aa8 200
if (XdrvMailbox.payload >= 0) {
char *p;
uint32_t start = strtol(XdrvMailbox.data, &p, 16);
uint32_t size = strtol(p, &p, 10);
if (0 == size) { size = 32; }
DebugDump(start, size);
}
ResponseCmndDone();
}
void CmndCfgDump(void)
{
DebugCfgDump(XdrvMailbox.data);

View File

@ -22,6 +22,9 @@
* Hydreon RG-15
* See https://rainsensors.com/products/rg-15/
* https://rainsensors.com/rg-9-15-protocol/
*
* Rule for Domoticz Rain sensor index 418:
* on tele-rg-15#flowrate do var1 %value% endon on tele-rg-15#event do dzsend1 418,%var1%;%value% endon
\*********************************************************************************************/
#define XSNS_90 90
@ -199,7 +202,7 @@ bool Rg15Command(void) {
HydreonSerial->flush(); // Flush receive buffer
HydreonSerial->println(send);
if ('K' == send) {
if ('K' == send) { // Restart RG-15 reading DIP switches
Rg15.init_step = 5; // Perform RG-15 init
}