data iir, shiftgraphzero - now uses cliparser

This commit is contained in:
iceman1001 2021-03-23 13:13:10 +01:00
commit 9b1f7ca7a3
2 changed files with 31 additions and 8 deletions

View file

@ -1106,9 +1106,21 @@ static int CmdUndecimate(const char *Cmd) {
// shift graph zero up or down based on input + or - // shift graph zero up or down based on input + or -
static int CmdGraphShiftZero(const char *Cmd) { static int CmdGraphShiftZero(const char *Cmd) {
int shift = 0;
//set options from parameters entered with the command CLIParserContext *ctx;
sscanf(Cmd, "%i", &shift); CLIParserInit(&ctx, "data shiftgraphzero",
"Shift 0 for Graphed wave + or - shift value",
"data shiftgraphzero -n 10 --> shift 10 points\n"
"data shiftgraphzero -n -22 --> shift negative 22 points"
);
void *argtable[] = {
arg_param_begin,
arg_int1("n", NULL, "<dec>", "shift + or -"),
arg_param_end
};
CLIExecWithReturn(ctx, Cmd, argtable, false);
int shift = arg_get_int_def(ctx, 1, 0);
CLIParserFree(ctx);
for (size_t i = 0; i < GraphTraceLen; i++) { for (size_t i = 0; i < GraphTraceLen; i++) {
int shiftedVal = GraphBuffer[i] + shift; int shiftedVal = GraphBuffer[i] + shift;
@ -2536,8 +2548,21 @@ static int CmdFSKToNRZ(const char *Cmd) {
} }
static int CmdDataIIR(const char *Cmd) { static int CmdDataIIR(const char *Cmd) {
uint8_t k = param_get8(Cmd, 0);
//iceIIR_Butterworth(GraphBuffer, GraphTraceLen); CLIParserContext *ctx;
CLIParserInit(&ctx, "data iir",
"Apply IIR buttersworth filter on plot data",
"data iir -n 2"
);
void *argtable[] = {
arg_param_begin,
arg_u64_1("n", NULL, "<dec>", "factor n"),
arg_param_end
};
CLIExecWithReturn(ctx, Cmd, argtable, false);
uint8_t k = arg_get_u32_def(ctx, 1, 0);
CLIParserFree(ctx);
iceSimple_Filter(GraphBuffer, GraphTraceLen, k); iceSimple_Filter(GraphBuffer, GraphTraceLen, k);
uint8_t bits[GraphTraceLen]; uint8_t bits[GraphTraceLen];

View file

@ -7,9 +7,7 @@ data rawdemod
data askedgedetect data askedgedetect
data autocorr data autocorr
data dirthreshold data dirthreshold
data iir
data setgraphmarkers data setgraphmarkers
data shiftgraphzero
hf 15 dump hf 15 dump
hf 15 info hf 15 info
hf 15 raw hf 15 raw