From 1498259712f695922bc9b2793dda3c4d3e599fe7 Mon Sep 17 00:00:00 2001 From: Ralf9 Date: Sat, 27 Jun 2020 21:11:02 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20Manchester=20Decoder=20for=20long=20MU-ms?= =?UTF-8?q?g,=20add=20a=20new=20debug=20option=20for=20crashes=20-=20Bei?= =?UTF-8?q?=20der=20signalDecoder4=20Routine=20"isManchester()"=20und=20"d?= =?UTF-8?q?oDecode()"=20konnte=20es=20bei=20sehr=20langen=20MU=20Nachricht?= =?UTF-8?q?en=20Abst=C3=BCrze=20geben.=20=20=20Die=20"isManchester()"=20Ro?= =?UTF-8?q?utine=20f=C3=BCr=20sehr=20lange=20MU=20Nachrichten=20gefixt=20u?= =?UTF-8?q?nd=20optimiert,=20debug=20Log=20Ausgaben=20angepasst=20und=20er?= =?UTF-8?q?weitert.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - die Befehle CDR und CER wurden auskommentiert, da die Datenkomprimierung für MS- und MU-Nachrichten (config: Mred=1) nicht mehr notwendig ist. - Es gibt ein neues "#define DEBUG_BackupReg 1" damit ist bei einem Absturz eine Eingrenzung möglich Es werden in einigen Stellen verschiedene Werte ins Backupregister geschrieben. In der Setup Routine wird der Wert des Backupregister dann ausgegeben und gemerkt. Der gemerkte Wert steht dann auch in der Version z.B." -7-" 1 FifoReceive begin 2 FifoReceive end 3 processMessage begin 4 print MS Nachricht 5 print MC Nachricht 6 print MU Nachricht 7 processMessage end 8 HandleCommand begin 9 HandleCommand end --- SIGNALDuino.ino | 114 ++++++----- .../signalDecoder/src/signalDecoder4.cpp | 177 +++++++++++++----- .../signalDecoder/src/signalDecoder4.h | 12 +- 3 files changed, 197 insertions(+), 106 deletions(-) diff --git a/SIGNALDuino.ino b/SIGNALDuino.ino index 4b0fc9b..fdc2801 100644 --- a/SIGNALDuino.ino +++ b/SIGNALDuino.ino @@ -43,6 +43,7 @@ //#define LAN_WIZ 1 #define MAPLE_WATCHDOG 1 +//#define DEBUG_BackupReg 1 // bitte auch das "#define DEBUG_BackupReg 1" in der SignalDecoder.h beachten //#define DEBUG_SERIAL 2 // debug level #define SerialNr USART1 // serial2 = USART2 @@ -56,7 +57,7 @@ // bitte auch das "#define CMP_CC1101" in der SignalDecoder.h beachten #define PROGNAME "RF_RECEIVER" -#define PROGVERS "4.1.1-dev200611" +#define PROGVERS "4.1.1-dev200627" #define VERSION_1 0x41 #define VERSION_2 0x0d @@ -66,9 +67,6 @@ #ifdef ARDUINO_ATMEGA328P_MINICUL #define CMP_CC1101 #endif -#ifdef ARDUINO_AVR_ICT_BOARDS_ICT_BOARDS_AVR_RADINOCC1101 - #define CMP_CC1101 -#endif #ifdef MAPLE_SDUINO #define MAPLE_Mini #define CMP_CC1101 @@ -128,6 +126,12 @@ #include #endif +#ifdef DEBUG_BackupReg + #include + uint8_t sichBackupReg = 0; +#endif + + //--------------------------------------------------------------------------------------------- #include "cc1101.h" @@ -184,10 +188,11 @@ SignalDetectorClass musterDec; #define defStatRadio 0xFF // EEProm Address #define EE_MAGIC_OFFSET 0 -#define addr_togglesec 0x3C +//#define addr_togglesec 0x3C #define addr_ccN 0x3D #define addr_ccmode 0x3E //#define addr_featuresB 0x3F +#define addr_bankdescr 0x40 // 0x40-0x47 bis Bank 9 0x88-0x8F # Bank 0 bis Bank 9, Kurzbeschreibungen (max 8 Zeichen) #define addr_rxRes 0xE9 // bei 0xA5 ist rx nach dem Reset disabled // #define addr 0xEA res #define addr_statRadio 0xEB // A=EB B=EC C=ED D=EE Bit 0-3 Bank, 1F-Init, Bit 6 = 1 - Fehler bei Erkennung, Bit 6&7 = 1 - Miso Timeout, FF-deaktiviert @@ -249,7 +254,7 @@ void cmd_readEEPROM(); void cmd_freeRam(); void cmd_send(); void cmd_uptime(); -void cmd_toggleBank(); +void cmd_test(); void cmd_Version(); void cmd_writeEEPROM(); void cmd_writePatable(); @@ -278,7 +283,7 @@ void (*cmdFP[])(void) = { cmd_freeRam, // R cmd_send, // S cmd_uptime, // t - cmd_toggleBank, // T + cmd_test, // T cmd_Version, // V cmd_writeEEPROM,// W cmd_writePatable,// x @@ -379,6 +384,9 @@ void setup() { digitalWrite(PIN_WIZ_RST, HIGH); #endif #endif +#ifdef DEBUG_BackupReg + sichBackupReg = (uint8_t)getBackupRegister(RTC_BKP_INDEX); +#endif tools::EEbufferFill(); getEthernetConfig(); pinAsOutput(PIN_LED); @@ -414,6 +422,11 @@ pinAsOutput(PIN_LED); #ifdef DEBUG_SERIAL HwSerial.println(F("serial init ok")); #endif +#endif +#ifdef DEBUG_BackupReg + MSG_PRINT(F("BackupReg = ")); + MSG_PRINTLN(sichBackupReg); + setBackupReg(0); #endif if (musterDec.MdebEnabled) { DBG_PRINTLN(F("Using sFIFO")); @@ -577,6 +590,15 @@ void cronjob() { } +#ifdef DEBUG_BackupReg +void setBackupReg(uint32_t n) { + enableBackupDomain(); + setBackupRegister(RTC_BKP_INDEX, n); + disableBackupDomain(); +} +#endif + + void loop() { static int16_t aktVal=0; bool state; @@ -648,6 +670,9 @@ void getRxFifo(uint16_t Boffs) { bool dup; // true bei identischen Wiederholungen bei readRXFIFO if (isHigh(pinReceive[radionr])) { // wait for CC1100_FIFOTHR given bytes to arrive in FIFO +#ifdef DEBUG_BackupReg + setBackupReg(1); +#endif if (LEDenabled) { blinkLED=true; } @@ -724,6 +749,9 @@ void getRxFifo(uint16_t Boffs) { } } } +#ifdef DEBUG_BackupReg + setBackupReg(2); +#endif } } @@ -1019,20 +1047,20 @@ void send_cmd() command[cmdNo].datastart = startdata; command[cmdNo].dataend = start_pos-2; #ifdef DEBUGSENDCMD - MSG_PRINT("D="); + MSG_PRINT(F("D=")); MSG_PRINTLN(cmdstring.substring(startdata, start_pos-1)); #endif } else if (msg_cmd0 == 'C') { command[cmdNo].sendclock = cmdstring.substring(startdata, start_pos-1).toInt(); extraDelay = true; #ifdef DEBUGSENDCMD - MSG_PRINT("C="); + MSG_PRINT(F("C=")); MSG_PRINTLN(command[cmdNo].sendclock); #endif } else if (msg_cmd0 == 'F') { ccParamAnz = (start_pos - startdata) / 2; #ifdef DEBUGSENDCMD - MSG_PRINT("F="); + MSG_PRINT(F("F=")); #endif if (ccParamAnz > 0 && ccParamAnz <= 5 && hasCC1101 && ccmode == 0) { uint8_t hex; @@ -1211,6 +1239,9 @@ void HandleCommand() // uint8_t val; uint8_t i; +#ifdef DEBUG_BackupReg + setBackupReg(8); +#endif for (i=0; i < cmdAnz; i++) { if (cmdstring.charAt(0) == cmd0[i]) { if (cmd1[i] == ' ' || (cmdstring.charAt(1) == cmd1[i])) { @@ -1247,6 +1278,9 @@ void HandleCommand() HwSerial.println(F("wr: ok")); #endif } +#ifdef DEBUG_BackupReg + setBackupReg(9); +#endif } @@ -1507,7 +1541,7 @@ void print_bank_sum() // bs - Banksummary } else { for (j = 0; j < 8; j++) { - ch = tools::EEread(0x40 + (i * 8) + j); + ch = tools::EEread(addr_bankdescr + (i * 8) + j); if ((ch >= 32 && ch <= 122) || ch == 0) { // space to z bankStr[j] = ch; if (ch == 0) { // end @@ -1645,6 +1679,10 @@ void cmd_Version() // V: Version if (tools::EEread(addr_rxRes) == 0xA5) { MSG_PRINT(F("irx0 ")); } +#ifdef DEBUG_BackupReg + MSG_PRINT(F("-")); + MSG_PRINT(sichBackupReg,HEX); +#endif MSG_PRINTLN(F("- compiled at " __DATE__ " " __TIME__)); } @@ -1680,49 +1718,9 @@ void cmd_uptime() // t: Uptime MSG_PRINTLN(getUptime()); } -void cmd_toggleBank() // T +void cmd_test() { - /*uint8_t setBank; - uint8_t sec; - uint16_t bankOffs; - - if (cmdstring.charAt(1) == '?') { - MSG_PRINT(F("Toggle=")); - for (uint8_t i = 0; i <= 9; i++) { - bankOffs = getBankOffset(i); - MSG_PRINT(F(" ")); - sec = tools::EEbankRead(addr_togglesec); - if (sec > 99) { - sec = 0; - tools::EEbankWrite(addr_togglesec, sec); - tools::EEstore(); - } - MSG_PRINT(sec * 10); - } - MSG_PRINTLN(""); - } - else if (isDigit(cmdstring.charAt(1)) && isHexadecimalDigit(cmdstring.charAt(2)) && isDigit(cmdstring.charAt(3))) { - uint8_t high; - uint8_t digit; - - setBank = (uint8_t)cmdstring.charAt(1); - setBank = tools::hex2int(setBank); - bankOffs = getBankOffset(setBank); - MSG_PRINT(F("setToggle b=")); - MSG_PRINTLN(setBank); - digit = (uint8_t)cmdstring.charAt(2); - high = tools::hex2int(digit); - digit = (uint8_t)cmdstring.charAt(3); - sec = high * 10 + tools::hex2int(digit); - tools::EEbankWrite(addr_togglesec, sec); - tools::EEstore(); - MSG_PRINT(F(" sec=")); - MSG_PRINTLN(sec * 10); - } - else {*/ - unsuppCmd = true; -// } - + unsuppCmd = true; } void ccRegWrite() // CW cc register write @@ -2082,9 +2080,9 @@ inline void configCMD() } else if (cmdstring.charAt(2) == 'C') { //MC bptr=&musterDec.MCenabled; - } - else if (cmdstring.charAt(2) == 'R') { //Mreduce - bptr=&musterDec.MredEnabled; +// } +// else if (cmdstring.charAt(2) == 'R') { //Mreduce +// bptr=&musterDec.MredEnabled; } else if (cmdstring.charAt(2) == 'D') { //Mdebug bptr=&musterDec.MdebEnabled; @@ -2342,9 +2340,9 @@ void serialEvent() HwSerial.println(""); #endif #if DEBUG_SERIAL - HwSerial.print("cmd("); + HwSerial.print(F("cmd(")); HwSerial.print(cmdstring.length()); - HwSerial.print(") = "); + HwSerial.print(F(") = ")); HwSerial.println(cmdstring); #endif command_available=true; diff --git a/src/_micro-api/libraries/signalDecoder/src/signalDecoder4.cpp b/src/_micro-api/libraries/signalDecoder/src/signalDecoder4.cpp index dedf90a..c5b0645 100644 --- a/src/_micro-api/libraries/signalDecoder/src/signalDecoder4.cpp +++ b/src/_micro-api/libraries/signalDecoder/src/signalDecoder4.cpp @@ -395,6 +395,14 @@ bool SignalDetectorClass::compress_pattern() return ret; } +#ifdef DEBUG_BackupReg +void SignalDetectorClass::setBackupRegSD(uint32_t n) { + enableBackupDomain(); + setBackupRegister(RTC_BKP_INDEX, n); + disableBackupDomain(); +} +#endif + void SignalDetectorClass::processMessage(const uint8_t p_valid) { //p_valid: 0 - Nachrichtenende erkannt @@ -402,6 +410,9 @@ void SignalDetectorClass::processMessage(const uint8_t p_valid) // 2 - Patternpuffer overflow //yield(); +#ifdef DEBUG_BackupReg + setBackupRegSD(3); +#endif if (p_valid > 0) { m_truncated = true; @@ -546,6 +557,9 @@ void SignalDetectorClass::processMessage(const uint8_t p_valid) MsEqSkip = 0; } if (MsMoveCount < MsMoveCountmax && MsEqSkip == 0) { +#ifdef DEBUG_BackupReg + setBackupRegSD(4); +#endif /* Output raw message Data */ if (MredEnabled) { int16_t patternInt; @@ -790,7 +804,9 @@ void SignalDetectorClass::processMessage(const uint8_t p_valid) if (MCenabled && state != syncfound) { //DBG_PRINT(" mc: "); - +#ifdef DEBUG_BackupReg + setBackupRegSD(5); +#endif static ManchesterpatternDecoder mcdecoder(this); // Init Manchester Decoder class if (mcDetected == false) @@ -948,6 +964,9 @@ void SignalDetectorClass::processMessage(const uint8_t p_valid) #if DEBUGDECODE > 1 DBG_PRINT(" MU found: "); #endif // DEBUGDECODE +#ifdef DEBUG_BackupReg + setBackupRegSD(6); +#endif bool m_endfound = false; bool isMuRepeat = false; @@ -1165,6 +1184,9 @@ void SignalDetectorClass::processMessage(const uint8_t p_valid) reset(); } //MSG_PRINTLN("process finished"); +#ifdef DEBUG_BackupReg + setBackupRegSD(7); +#endif } @@ -1710,7 +1732,12 @@ const bool ManchesterpatternDecoder::doDecode() { pdec->mcValid = true; if (pdec->mcDetected == false || ManchesterBits.valcount == 0) { - while (i < pdec->messageLen-1) + uint8_t mcStartMax = maxMCmstart - minbitlen; // maxMCmstart = 254 + if (mcStartMax > (pdec->messageLen - minbitlen)) + { + mcStartMax = pdec->messageLen - minbitlen; + } + while (i < mcStartMax) { // Start vom MC Signal suchen, dazu long suchen. Vor dem longlow darf kein Puls groesser long sein pulseid = pdec->message[i]; @@ -1723,7 +1750,7 @@ const bool ManchesterpatternDecoder::doDecode() { i++; } - if (i >= pdec->messageLen-1) // kein long gefunden, duerfte eigentlich nicht vorkommen + if (i >= mcStartMax) // kein long gefunden, duerfte eigentlich nicht vorkommen { pdec->mcValid = false; return false; @@ -1984,27 +2011,27 @@ const bool ManchesterpatternDecoder::isManchester() const uint8_t minHistocnt = round(pdec->messageLen*0.04); // 3 1 0 2 uint8_t sortedPattern[pdec->cMaxNumPattern]; // 1300,-1300,-734,..800 - uint8_t p=0; + uint8_t p = 0; for (uint8_t i = 0; i < pdec->patternLen; i++) { if (pdec->histo[i] < minHistocnt) continue; // Skip this pattern, due to less occurence in our message #if MCDEBUGDETECT >= 1 - MSG_PRINT(p); + MSG_PRINT("p"); #endif uint8_t ptmp = p; - while ( p!= 0 && pdec->pattern[i] < pdec->pattern[sortedPattern[p-1]]) + while (p != 0 && pdec->pattern[i] < pdec->pattern[sortedPattern[p - 1]]) { - sortedPattern[p] = sortedPattern[p-1]; + sortedPattern[p] = sortedPattern[p - 1]; p--; } #if MCDEBUGDETECT >= 1 DBG_PRINT("="); DBG_PRINT(i); DBG_PRINT(","); #endif sortedPattern[p] = i; - p = ptmp+1; + p = ptmp + 1; } #if MCDEBUGDETECT >= 3 DBG_PRINT("Sorted:"); @@ -2015,10 +2042,9 @@ const bool ManchesterpatternDecoder::isManchester() DBG_PRINT(";"); #endif - - for (uint8_t i = 0; i

pattern[sortedPattern[i]] <=0) continue; + if (pdec->pattern[sortedPattern[i]] <= 0) continue; #if MCDEBUGDETECT >= 2 DBG_PRINT("CLK="); DBG_PRINT(sortedPattern[i]); DBG_PRINT(":"); #endif @@ -2026,7 +2052,7 @@ const bool ManchesterpatternDecoder::isManchester() longhigh = -1; shortlow = -1; shorthigh = -1; - pos_cnt=0; + pos_cnt = 0; neg_cnt = 0; tstclock = -1; equal_cnt = 0; @@ -2035,6 +2061,7 @@ const bool ManchesterpatternDecoder::isManchester() for (uint8_t x = 0; x < p; x++) { #if MCDEBUGDETECT >= 1 + DBG_PRINT("i"); DBG_PRINT(i); DBG_PRINT(" x"); DBG_PRINT(x); DBG_PRINT(" ") DBG_PRINT(sortedPattern[x]); #endif @@ -2049,13 +2076,13 @@ const bool ManchesterpatternDecoder::isManchester() //else if (pdec->inTol(clockpulse*2, abs(aktpulse), clockpulse*0.80)) plong = true; - #if MCDEBUGDETECT >= 3 +#if MCDEBUGDETECT >= 3 DBG_PRINT("^=(PS="); DBG_PRINT(pshort); DBG_PRINT(";"); DBG_PRINT("PL="); DBG_PRINT(plong); DBG_PRINT(";)"); - #endif - #if MCDEBUGDETECT >= 1 +#endif +#if MCDEBUGDETECT >= 1 DBG_PRINT(","); - #endif +#endif if (aktpulse > 0) { @@ -2092,18 +2119,24 @@ const bool ManchesterpatternDecoder::isManchester() int16_t z = 0; while (z < pdec->messageLen) { - const uint16_t mpz = pdec->message[z]; // Store pattern for further processing + const uint8_t mpz = pdec->message[z]; // Store pattern for further processing - if (((isLong(mpz) == false) && (isShort(mpz) == false)) || (z == (pdec->messageLen-1))) + if (((isLong(mpz) == false) && (isShort(mpz) == false)) || (z == (pdec->messageLen - 1))) { #if MCDEBUGDETECT >= 1 DBG_PRINT(z); DBG_PRINT("=")DBG_PRINT(mpz); DBG_PRINT(";") DBG_PRINT("Long"); DBG_PRINT(isLong(mpz)); DBG_PRINT(";"); - DBG_PRINT("Short"); DBG_PRINT(isShort(mpz)); DBG_PRINTLN(";"); - + DBG_PRINT("Short"); DBG_PRINT(isShort(mpz)); DBG_PRINT(";"); + if (mc_start_found == true) { + DBG_PRINT(" mstart="); + DBG_PRINTLN(pdec->mstart); + } + else { + DBG_PRINTLN(""); + } #endif - if ((z - pdec->mstart) > minbitlen) // Todo: Hier wird auf minbitlen geprueft. Die Differenz zwischen mstart und mend sind aber Pulse und keine bits + if ((z - pdec->mstart) > minbitlen && mc_start_found == true) // Todo: Hier wird auf minbitlen geprueft. Die Differenz zwischen mstart und mend sind aber Pulse und keine bits { pdec->mend = z; @@ -2126,7 +2159,7 @@ const bool ManchesterpatternDecoder::isManchester() if ((longlow == longhigh) || (shortlow == shorthigh) || (longlow == shortlow) || (longhigh == shorthigh) || (longlow == shorthigh) || (longhigh == shortlow)) break; //Check if the indexes are valid bool break_flag = false; - for (uint8_t a = 0; a < 4 && break_flag==false; a++) + for (uint8_t a = 0; a < 4 && break_flag == false; a++) { #ifdef MCDEBUGDETECT //>=0 DBG_PRINT(" seq_even["); DBG_PRINT(a); DBG_PRINT("]"); @@ -2137,16 +2170,46 @@ const bool ManchesterpatternDecoder::isManchester() DBG_PRINTLN(" "); #endif #endif - if ( (sequence_even[a] - sequence_odd[a] != 0) && (sequence_odd[a] == -1 || sequence_even[a] == -1)) + if ((sequence_even[a] - sequence_odd[a] != 0) && (sequence_odd[a] == -1 || sequence_even[a] == -1)) { break_flag = true; } } - if (break_flag == true) { + if (break_flag == false) { + break_flag = true; // Must be set false during loops + uint8_t seq_a = (shorthigh * 10) + longlow; + uint8_t seq_b = (longhigh * 10) + shortlow; + if (seq_a < 10) seq_a += 100; + if (seq_b < 10) seq_b += 100; + + for (uint8_t a = 0; a < 4 && break_flag == true; a++) // check longlow longhigh and vice versa + { + if (sequence_even[a] == seq_a || sequence_odd[a] == seq_a) + { + for (uint8_t a2 = 0; a2 < 4 && break_flag == true; a2++) + { + if (sequence_even[a2] == seq_b || sequence_odd[a2] == seq_b) + { + break_flag = false; + } + + } + } + } + #if MCDEBUGDETECT >= 1 - DBG_PRINT(" sequence check not passed"); -#endif + if (break_flag == true) + DBG_PRINT(" sequence dual long match failed "); +#endif + } // break_flag true + else { +#if MCDEBUGDETECT >= 1 + DBG_PRINT(" basic sequence not passed "); +#endif + } + + if (break_flag == true) { // Check if we can start a new calulation at a later position if (pdec->messageLen - z > minbitlen) { @@ -2156,11 +2219,18 @@ const bool ManchesterpatternDecoder::isManchester() sequence_even[a] = -1; sequence_odd[a] = -1; } - +#if MCDEBUGDETECT >= 1 + DBG_PRINT(" start new check z="); + DBG_PRINTLN(z); +#endif z++; // Increase z counter to start new check continue; } +#if MCDEBUGDETECT >= 1 + DBG_PRINT(" abort z="); + DBG_PRINTLN(z); +#endif break; } #if MCDEBUGDETECT >= 1 @@ -2185,46 +2255,64 @@ const bool ManchesterpatternDecoder::isManchester() #endif // TOdo: Bei FFFF passt diese Pruefung nicht. #if MCDEBUGDETECT >= 1 - DBG_PRINTLN(" -- MC found -- "); + DBG_PRINTLN(" -- MC found --"); #endif return true; } else { mc_start_found = false; + if (z > (maxMCmstart - minbitlen)) { // maxMCmstart = 254 +#if MCDEBUGDETECT >= 1 + DBG_PRINTLN(" find MCmstart ismax abort"); +#endif + break; + } + for (uint8_t a = 0; a < 4; a++) + { + sequence_even[a] = sequence_odd[a] = -1; + } } - } else { + } + else { if (mc_start_found == false) { + if (z > (maxMCmstart - minbitlen)) { // maxMCmstart = 254 +#if MCDEBUGDETECT >= 1 + DBG_PRINTLN(" maxMCmstart abort"); +#endif + break; + } pdec->mstart = z; mc_start_found = true; } - } - int8_t seq_found = -1; - uint8_t seq = (mpz* 10) + pdec->message[z + 1]; + int8_t seq_found = -1; + uint8_t seq = (mpz * 10) + pdec->message[z + 1]; - if (seq < 10) seq += 100; + if (seq < 10) seq += 100; - int8_t *seqptr; - if (z % 2 == 0) //Every even value - seqptr = sequence_even; - else - seqptr = sequence_odd; + int8_t *seqptr; + if (z % 2 == 0) //Every even value + seqptr = sequence_even; + else + seqptr = sequence_odd; - for (uint8_t a = 0; a < 4 && seq_found==-1; a++) - { + for (uint8_t a = 0; a < 4 && seq_found == -1; a++) + { if (seqptr[a] == seq) { seq_found = a; - } else if (seqptr[a] == -1) + } + else if (seqptr[a] == -1) { //DBG_PRINT(" +seq[:"); DBG_PRINT(seq); DBG_PRINTLN("]"); seqptr[a] = seq; seq_found = a; } - - } + + } + } z++; } } @@ -2232,8 +2320,5 @@ const bool ManchesterpatternDecoder::isManchester() } return false; - - - } diff --git a/src/_micro-api/libraries/signalDecoder/src/signalDecoder4.h b/src/_micro-api/libraries/signalDecoder/src/signalDecoder4.h index 5128b98..3df3e0e 100644 --- a/src/_micro-api/libraries/signalDecoder/src/signalDecoder4.h +++ b/src/_micro-api/libraries/signalDecoder/src/signalDecoder4.h @@ -42,6 +42,11 @@ #define DEBUG 1 //#define LAN_WIZ 1 // die Ausgabe ueber Ethernet funktioniert nur, wenn dies hier nochmals definiert wird +//#define DEBUG_BackupReg 1 +#ifdef DEBUG_BackupReg + #include +#endif + #include "output.h" #include "bitstore.h" #include "FastDelegate.h" @@ -50,6 +55,7 @@ #define defMaxMsgSize 1500 //2000 #define defMsMaxMsgSize 254 #define minMessageLen 40 +#define maxMCmstart 254 #define syncMinFact 6 #define syncMaxFact 45 // 39 #define syncMaxMicros 17000 @@ -173,7 +179,9 @@ class SignalDetectorClass bool checkMBuffer(); bool isMuMessageRepeat(); - +#ifdef DEBUG_BackupReg + void setBackupRegSD(uint32_t n); +#endif }; class ManchesterpatternDecoder @@ -200,7 +208,7 @@ class ManchesterpatternDecoder int8_t shorthigh; int16_t clock; // Manchester calculated clock int8_t minbitlen; - uint8_t mc_sync_pos; + uint16_t mc_sync_pos; bool mc_start_found = false;