summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
a8fd088)
CHG: `lf visa2000` - removed askedgedetect, it seemed it destroyed more than enhanced.
return 0;
}
size_t size = DemodBufferLen;
return 0;
}
size_t size = DemodBufferLen;
- //call lfdemod.c demod for Viking
int ans = VikingDemod_AM(DemodBuffer, &size);
if (ans < 0) {
if (g_debugMode) PrintAndLog("DEBUG: Error - Viking Demod %d %s", ans, (ans == -5)?"[chksum error]":"");
int ans = VikingDemod_AM(DemodBuffer, &size);
if (ans < 0) {
if (g_debugMode) PrintAndLog("DEBUG: Error - Viking Demod %d %s", ans, (ans == -5)?"[chksum error]":"");
RepaintGraphWindow();
return 0;
}
RepaintGraphWindow();
return 0;
}
+void setGrid_Clock(uint8_t clock){
+ PlotGridXdefault = clock;
+ RepaintGraphWindow();
+}
+
int CmdHexsamples(const char *Cmd)
{
int CmdHexsamples(const char *Cmd)
{
void printEM410x(uint32_t hi, uint64_t id);
int getSamples(const char *Cmd, bool silent);
void printEM410x(uint32_t hi, uint64_t id);
int getSamples(const char *Cmd, bool silent);
+void setGrid_Clock(uint8_t clock);
+
int CmdDataIIR(const char *Cmd);
extern uint8_t DemodBuffer[MAX_DEMOD_BUF_LEN];
int CmdDataIIR(const char *Cmd);
extern uint8_t DemodBuffer[MAX_DEMOD_BUF_LEN];
- PrintAndLog("ERROR: EM4x50 - didn't find a clock");
+ if (verbose || g_debugMode) PrintAndLog("ERROR: EM4x50 - didn't find a clock");
return 0;
}
} else tol = clk/8;
return 0;
}
} else tol = clk/8;
}
setDemodBuf(DemodBuffer+ans, 64, 0);
}
setDemodBuf(DemodBuffer+ans, 64, 0);
//got a good demod
uint32_t raw1 = bytebits_to_byte(DemodBuffer, 32);
//got a good demod
uint32_t raw1 = bytebits_to_byte(DemodBuffer, 32);
int CmdJablotronRead(const char *Cmd) {
CmdLFRead("s");
int CmdJablotronRead(const char *Cmd) {
CmdLFRead("s");
- getSamples("12000", TRUE);
+ getSamples("10000", TRUE);
return CmdJablotronDemod(Cmd);
}
return CmdJablotronDemod(Cmd);
}
// save GraphBuffer - to restore it later
save_restoreGB(1);
// save GraphBuffer - to restore it later
save_restoreGB(1);
+ //sCmdAskEdgeDetect("");
//ASK / Manchester
bool st = TRUE;
//ASK / Manchester
bool st = TRUE;
return 0;
}
setDemodBuf(DemodBuffer, 96, ans);
return 0;
}
setDemodBuf(DemodBuffer, 96, ans);
//got a good demod
uint32_t raw1 = bytebits_to_byte(DemodBuffer, 32);
uint32_t raw2 = bytebits_to_byte(DemodBuffer+32, 32);
//got a good demod
uint32_t raw1 = bytebits_to_byte(DemodBuffer, 32);
uint32_t raw2 = bytebits_to_byte(DemodBuffer+32, 32);
int CmdVisa2kRead(const char *Cmd) {
CmdLFRead("s");
int CmdVisa2kRead(const char *Cmd) {
CmdLFRead("s");
- getSamples("16000",TRUE);
+ getSamples("12000",TRUE);
return CmdVisa2kDemod(Cmd);
}
return CmdVisa2kDemod(Cmd);
}
//by marshmellow
//demodulates strong heavily clipped samples
//by marshmellow
//demodulates strong heavily clipped samples
+//RETURN: num of errors. if 0, is ok.
int cleanAskRawDemod(uint8_t *BinStream, size_t *size, int clk, int invert, int high, int low)
{
size_t bitCnt=0, smplCnt=0, errCnt=0;
int cleanAskRawDemod(uint8_t *BinStream, size_t *size, int clk, int invert, int high, int low)
{
size_t bitCnt=0, smplCnt=0, errCnt=0;
//by marshmellow
//take 10 and 01 and manchester decode
//run through 2 times and take least errCnt
//by marshmellow
//take 10 and 01 and manchester decode
//run through 2 times and take least errCnt
-int manrawdecode(uint8_t * BitStream, size_t *size, uint8_t invert){
+int manrawdecode(uint8_t *BitStream, size_t *size, uint8_t invert){
+
+ // sanity check
+ if (*size < 16) return -1;
+
int errCnt = 0, bestErr = 1000;
uint16_t bitnum = 0, MaxBits = 512, bestRun = 0;
size_t i, k;
int errCnt = 0, bestErr = 1000;
uint16_t bitnum = 0, MaxBits = 512, bestRun = 0;
size_t i, k;
- if (*size < 16) return -1;
//find correct start position [alignment]
//find correct start position [alignment]
- for (k=0; k < 2; ++k){
- for (i=k; i<*size-3; i += 2)
+ for (k = 0; k < 2; ++k){
+ for (i = k; i < *size-3; i += 2) {
if (BitStream[i] == BitStream[i+1])
errCnt++;
if (BitStream[i] == BitStream[i+1])
errCnt++;
if (bestErr > errCnt){
bestErr = errCnt;
bestRun = k;
}
if (bestErr > errCnt){
bestErr = errCnt;
bestRun = k;
}
- for (i=bestRun; i < *size-3; i += 2){
+ for (i = bestRun; i < *size-3; i += 2){
if (BitStream[i] == 1 && (BitStream[i+1] == 0)){
BitStream[bitnum++] = invert;
} else if ((BitStream[i] == 0) && BitStream[i+1] == 1){
if (BitStream[i] == 1 && (BitStream[i+1] == 0)){
BitStream[bitnum++] = invert;
} else if ((BitStream[i] == 0) && BitStream[i+1] == 1){
} else {
BitStream[bitnum++] = 7;
}
} else {
BitStream[bitnum++] = 7;
}
- if (bitnum>MaxBits) break;
+ if (bitnum > MaxBits) break;