chg: code cleanup

This commit is contained in:
Chris 2018-09-08 11:18:10 +02:00
parent 0b673683d9
commit 0e2dbe7424
3 changed files with 13 additions and 13 deletions

View file

@ -244,8 +244,8 @@ int CmdAnalyseLfsr(const char *Cmd){
} }
int CmdAnalyseLCR(const char *Cmd) { int CmdAnalyseLCR(const char *Cmd) {
uint8_t data[50]; uint8_t data[50];
char cmdp = param_getchar(Cmd, 0); char cmdp = tolower(param_getchar(Cmd, 0));
if (strlen(Cmd) == 0|| cmdp == 'h' || cmdp == 'H') return usage_analyse_lcr(); if (strlen(Cmd) == 0|| cmdp == 'h') return usage_analyse_lcr();
int len = 0; int len = 0;
switch (param_gethex_to_eol(Cmd, 0, data, sizeof(data), &len)) { switch (param_gethex_to_eol(Cmd, 0, data, sizeof(data), &len)) {
@ -265,8 +265,8 @@ int CmdAnalyseLCR(const char *Cmd) {
} }
int CmdAnalyseCRC(const char *Cmd) { int CmdAnalyseCRC(const char *Cmd) {
char cmdp = param_getchar(Cmd, 0); char cmdp = tolower(param_getchar(Cmd, 0));
if (strlen(Cmd) == 0 || cmdp == 'h' || cmdp == 'H') return usage_analyse_crc(); if (strlen(Cmd) == 0 || cmdp == 'h') return usage_analyse_crc();
int len = strlen(Cmd); int len = strlen(Cmd);
if ( len & 1 ) return usage_analyse_crc(); if ( len & 1 ) return usage_analyse_crc();
@ -867,8 +867,8 @@ int CmdAnalyseNuid(const char *Cmd){
uint8_t nuid[4] = {0}; uint8_t nuid[4] = {0};
uint8_t uid[7] = {0}; uint8_t uid[7] = {0};
int len = 0; int len = 0;
char cmdp = param_getchar(Cmd, 0); char cmdp = tolower(param_getchar(Cmd, 0));
if (strlen(Cmd) == 0|| cmdp == 'h' || cmdp == 'H') return usage_analyse_nuid(); if (strlen(Cmd) == 0|| cmdp == 'h') return usage_analyse_nuid();
/* selftest UID 040D681AB52281 -> NUID 8F430FEF */ /* selftest UID 040D681AB52281 -> NUID 8F430FEF */
if (cmdp == 't' || cmdp == 'T') { if (cmdp == 't' || cmdp == 'T') {

View file

@ -701,8 +701,8 @@ int ASKbiphaseDemod(const char *Cmd, bool verbose)
//by marshmellow - see ASKbiphaseDemod //by marshmellow - see ASKbiphaseDemod
int Cmdaskbiphdemod(const char *Cmd) int Cmdaskbiphdemod(const char *Cmd)
{ {
char cmdp = param_getchar(Cmd, 0); char cmdp = tolower(param_getchar(Cmd, 0));
if (strlen(Cmd) > 25 || cmdp == 'h' || cmdp == 'H') return usage_data_rawdemod_ab(); if (strlen(Cmd) > 25 || cmdp == 'h') return usage_data_rawdemod_ab();
return ASKbiphaseDemod(Cmd, true); return ASKbiphaseDemod(Cmd, true);
} }
@ -710,8 +710,8 @@ int Cmdaskbiphdemod(const char *Cmd)
//by marshmellow - see ASKDemod //by marshmellow - see ASKDemod
int Cmdaskrawdemod(const char *Cmd) int Cmdaskrawdemod(const char *Cmd)
{ {
char cmdp = param_getchar(Cmd, 0); char cmdp = tolower(param_getchar(Cmd, 0));
if (strlen(Cmd) > 25 || cmdp == 'h' || cmdp == 'H') return usage_data_rawdemod_ar(); if (strlen(Cmd) > 25 || cmdp == 'h') return usage_data_rawdemod_ar();
return ASKDemod(Cmd, true, false, 0); return ASKDemod(Cmd, true, false, 0);
} }

View file

@ -139,10 +139,10 @@ int CmdFlashMemRead(const char *Cmd) {
int CmdFlashmemSpiBaudrate(const char *Cmd) { int CmdFlashmemSpiBaudrate(const char *Cmd) {
char ctmp = param_getchar(Cmd, 0); char ctmp = tolower(param_getchar(Cmd, 0));
if (strlen(Cmd) < 1 || ctmp == 'h' || ctmp == 'H') return usage_flashmem_spibaud(); if (strlen(Cmd) < 1 || ctmp == 'h') return usage_flashmem_spibaud();
uint32_t baudrate = param_get32ex(Cmd, 0, 0, 10); uint32_t baudrate = param_get32ex(Cmd, 0, 0, 10);
baudrate = baudrate*1000000; baudrate = baudrate * 1000000;
if (baudrate != FLASH_BAUD && baudrate != FLASH_MINBAUD ) return usage_flashmem_spibaud(); if (baudrate != FLASH_BAUD && baudrate != FLASH_MINBAUD ) return usage_flashmem_spibaud();
UsbCommand c = {CMD_FLASHMEM_SET_SPIBAUDRATE, {baudrate, 0, 0}}; UsbCommand c = {CMD_FLASHMEM_SET_SPIBAUDRATE, {baudrate, 0, 0}};
SendCommand(&c); SendCommand(&c);