Merge remote-tracking branch 'upstream/master' into hf_mf_sim

This commit is contained in:
vratiskol
2019-03-19 16:48:45 +01:00
6 changed files with 56 additions and 18 deletions

View File

@@ -458,7 +458,7 @@ int ASKDemod_ext(const char *Cmd, bool verbose, bool emSearch, uint8_t askType,
uint8_t bits[MAX_GRAPH_TRACE_LEN] = {0};
sscanf(Cmd, "%i %i %i %i %c", &clk, &invert, &maxErr, &maxLen, &amp);
if (!maxLen) maxLen = BIGBUF_SIZE;
if (invert != 0 && invert != 1) {
@@ -485,14 +485,13 @@ int ASKDemod_ext(const char *Cmd, bool verbose, bool emSearch, uint8_t askType,
if (amp == 'a')
askAmp(bits, BitLen);
bool st = false;
size_t ststart = 0, stend = 0;
if (*stCheck)
st = DetectST(bits, &BitLen, &foundclk, &ststart, &stend);
// if (*stCheck)
bool st = DetectST(bits, &BitLen, &foundclk, &ststart, &stend);
clk = (clk == 0) ? foundclk : clk;
if (st) {
*stCheck = st;
clk = (clk == 0) ? foundclk : clk;
CursorCPos = ststart;
CursorDPos = stend;
if (verbose)
@@ -1607,8 +1606,7 @@ int CmdLoad(const char *Cmd) {
break;
}
if (f)
fclose(f);
fclose(f);
PrintAndLogEx(SUCCESS, "loaded %d samples", GraphTraceLen);

View File

@@ -113,8 +113,8 @@ char *mtostr(const model_t *model) {
+ strlen(strbuf)
+ (polystr && *polystr ? strlen(polystr) : 6)
+ (initstr && *initstr ? strlen(initstr) : 6)
+ (model->flags & P_REFIN ? 4 : 5)
+ (model->flags & P_REFOUT ? 4 : 5)
+ ((model->flags & P_REFIN) ? 4 : 5)
+ ((model->flags & P_REFOUT) ? 4 : 5)
+ (xorotstr && *xorotstr ? strlen(xorotstr) : 6)
+ (checkstr && *checkstr ? strlen(checkstr) : 6)
+ (magicstr && *magicstr ? strlen(magicstr) : 6)

View File

@@ -1207,7 +1207,7 @@ prhex(char **spp, bmp_t bits, int flags, int bperhx) {
* Set P_UPPER in flags to write A-F in uppercase.
*/
static const char hex[] = "0123456789abcdef0123456789ABCDEF";
const int upper = (flags & P_UPPER ? 0x10 : 0);
const int upper = ((flags & P_UPPER) ? 0x10 : 0);
while (bperhx > 0) {
bperhx -= ((bperhx + 3) & 3) + 1;
*(*spp)++ = hex[(bits >> bperhx & BMP_C(0xf)) | upper];