use PrintAndLogEx() instead of PrintAndLog()

This commit is contained in:
Brian Pow 2018-02-21 20:21:25 +08:00
commit 5d332d38ef

View file

@ -88,7 +88,7 @@ size_t getFromGraphBuf(uint8_t *buf) {
// A simple test to see if there is any data inside Graphbuffer.
bool HasGraphData(){
if ( GraphTraceLen <= 0) {
PrintAndLog("No data available, try reading something first");
PrintAndLogEx(NORMAL, "No data available, try reading something first");
return false;
}
return true;
@ -106,7 +106,7 @@ int GetAskClock(const char *str, bool printAns) {
size_t size = getFromGraphBuf(grph);
if (size == 0) {
if (g_debugMode)
PrintAndLog("Failed to copy from graphbuffer");
PrintAndLogEx(WARNING, "Failed to copy from graphbuffer");
return -1;
}
//, size_t *ststart, size_t *stend
@ -119,7 +119,7 @@ int GetAskClock(const char *str, bool printAns) {
setClockGrid(clock, start);
// Only print this message if we're not looping something
if (printAns || g_debugMode)
PrintAndLog("Auto-detected clock rate: %d, Best Starting Position: %d", clock, start);
PrintAndLogEx(NORMAL, "Auto-detected clock rate: %d, Best Starting Position: %d", clock, start);
return clock;
}
@ -130,7 +130,7 @@ uint8_t GetPskCarrier(const char *str, bool printAns) {
size_t size = getFromGraphBuf(grph);
if ( size == 0 ) {
if (g_debugMode)
PrintAndLog("Failed to copy from graphbuffer");
PrintAndLogEx(WARNING, "Failed to copy from graphbuffer");
return 0;
}
uint16_t fc = countFC(grph, size, 0);
@ -139,7 +139,7 @@ uint8_t GetPskCarrier(const char *str, bool printAns) {
if (( fc >> 8) == 10 && carrier == 8) return 0;
// Only print this message if we're not looping something
if (printAns)
PrintAndLog("Auto-detected PSK carrier rate: %d", carrier);
PrintAndLogEx(NORMAL, "Auto-detected PSK carrier rate: %d", carrier);
return carrier;
}
@ -152,7 +152,7 @@ int GetPskClock(const char* str, bool printAns) {
uint8_t grph[MAX_GRAPH_TRACE_LEN] = {0};
size_t size = getFromGraphBuf(grph);
if ( size == 0 ) {
if (g_debugMode) PrintAndLog("Failed to copy from graphbuffer");
if (g_debugMode) PrintAndLogEx(WARNING, "Failed to copy from graphbuffer");
return -1;
}
size_t firstPhaseShiftLoc = 0;
@ -161,7 +161,7 @@ int GetPskClock(const char* str, bool printAns) {
setClockGrid(clock, firstPhaseShiftLoc);
// Only print this message if we're not looping something
if (printAns)
PrintAndLog("Auto-detected clock rate: %d", clock);
PrintAndLogEx(NORMAL, "Auto-detected clock rate: %d", clock);
return clock;
}
@ -176,7 +176,7 @@ int GetNrzClock(const char* str, bool printAns) {
size_t size = getFromGraphBuf(grph);
if ( size == 0 ) {
if (g_debugMode)
PrintAndLog("Failed to copy from graphbuffer");
PrintAndLogEx(WARNING, "Failed to copy from graphbuffer");
return -1;
}
size_t clkStartIdx = 0;
@ -184,7 +184,7 @@ int GetNrzClock(const char* str, bool printAns) {
setClockGrid(clock, clkStartIdx);
// Only print this message if we're not looping something
if (printAns)
PrintAndLog("Auto-detected clock rate: %d", clock);
PrintAndLogEx(NORMAL, "Auto-detected clock rate: %d", clock);
return clock;
}
//by marshmellow
@ -202,13 +202,13 @@ int GetFskClock(const char* str, bool printAns) {
return 0;
if ((fc1==10 && fc2==8) || (fc1==8 && fc2==5)){
if (printAns) PrintAndLog("Detected Field Clocks: FC/%d, FC/%d - Bit Clock: RF/%d", fc1, fc2, rf1);
if (printAns) PrintAndLogEx(NORMAL, "Detected Field Clocks: FC/%d, FC/%d - Bit Clock: RF/%d", fc1, fc2, rf1);
setClockGrid(rf1, firstClockEdge);
return rf1;
}
if (g_debugMode) {
PrintAndLog("DEBUG: unknown fsk field clock detected");
PrintAndLog("Detected Field Clocks: FC/%d, FC/%d - Bit Clock: RF/%d", fc1, fc2, rf1);
PrintAndLogEx(DEBUG, "DEBUG: unknown fsk field clock detected");
PrintAndLogEx(NORMAL, "Detected Field Clocks: FC/%d, FC/%d - Bit Clock: RF/%d", fc1, fc2, rf1);
}
return 0;
}
@ -220,7 +220,7 @@ int fskClocks(uint8_t *fc1, uint8_t *fc2, uint8_t *rf1, int *firstClockEdge) {
uint16_t ans = countFC(bits, size, 1);
if (ans == 0) {
if (g_debugMode) PrintAndLog("DEBUG: No data found");
if (g_debugMode) PrintAndLogEx(DEBUG, "DEBUG: No data found");
return 0;
}
@ -229,7 +229,7 @@ int fskClocks(uint8_t *fc1, uint8_t *fc2, uint8_t *rf1, int *firstClockEdge) {
//int firstClockEdge = 0;
*rf1 = detectFSKClk(bits, size, *fc1, *fc2, firstClockEdge);
if (*rf1 == 0) {
if (g_debugMode) PrintAndLog("DEBUG: Clock detect error");
if (g_debugMode) PrintAndLogEx(DEBUG, "DEBUG: Clock detect error");
return 0;
}
return 1;