From 0608a7c5304fe73fc57b024c72fa90858440a397 Mon Sep 17 00:00:00 2001 From: Jacob Litewski Date: Thu, 11 Apr 2024 20:13:56 -0400 Subject: [PATCH] Minor Changes to the Operation Buffer Implementation Instead of being initialized as all zeros and showing changes if those values are not zero, it now has a copy of the Graph Buffer data, and will show changes if it's different from what's stored in the Graph Buffer. --- client/src/cmddata.c | 16 ++++++++-------- client/src/proxguiqt.cpp | 10 ++++------ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/client/src/cmddata.c b/client/src/cmddata.c index fc09bb5ef..bdeca3043 100644 --- a/client/src/cmddata.c +++ b/client/src/cmddata.c @@ -3790,11 +3790,11 @@ static int CmdXor(const char *Cmd) { static command_t CommandTable[] = { {"-----------", CmdHelp, AlwaysAvailable, "------------------------- " _CYAN_("General") "-------------------------"}, {"help", CmdHelp, AlwaysAvailable, "This help"}, - {"plot", CmdPlot, AlwaysAvailable, "Show graph window"}, - {"hide", CmdHide, AlwaysAvailable, "Hide graph window"}, + {"clear", CmdBuffClear, AlwaysAvailable, "Clears various buffers used by the graph window"}, + {"hide", CmdHide, AlwaysAvailable, "Hide the graph window"}, + {"plot", CmdPlot, AlwaysAvailable, "Show the graph window"}, {"load", CmdLoad, AlwaysAvailable, "Load contents of file into graph window"}, {"save", CmdSave, AlwaysAvailable, "Save signal trace data"}, - {"clear", CmdBuffClear, AlwaysAvailable, "Clears various buffers used by the graph window"}, {"-----------", CmdHelp, AlwaysAvailable, "------------------------- " _CYAN_("Modulation") "-------------------------"}, {"detectclock", CmdDetectClockRate, AlwaysAvailable, "Detect ASK, FSK, NRZ, PSK clock rate of wave in GraphBuffer"}, @@ -3805,26 +3805,26 @@ static command_t CommandTable[] = { {"rawdemod", CmdRawDemod, AlwaysAvailable, "Demodulate the data in the GraphBuffer and output binary"}, {"-----------", CmdHelp, AlwaysAvailable, "------------------------- " _CYAN_("Graph") "-------------------------"}, - {"norm", CmdNorm, AlwaysAvailable, "Normalize max/min to +/-128"}, {"askedgedetect", CmdAskEdgeDetect, AlwaysAvailable, "Adjust Graph for manual ASK demod"}, {"autocorr", CmdAutoCorr, AlwaysAvailable, "Autocorrelation over window"}, {"cthreshold", CmdCenterThreshold, AlwaysAvailable, "Average out all values between"}, {"dirthreshold", CmdDirectionalThreshold, AlwaysAvailable, "Max rising higher up-thres/ Min falling lower down-thres"}, - {"envelope", CmdEnvelope, AlwaysAvailable, "Generate square envelope of samples"}, {"decimate", CmdDecimate, AlwaysAvailable, "Decimate samples"}, {"undecimate", CmdUndecimate, AlwaysAvailable, "Un-decimate samples"}, + {"envelope", CmdEnvelope, AlwaysAvailable, "Generate square envelope of samples"}, + {"grid", CmdGrid, AlwaysAvailable, "overlay grid on graph window"}, {"hpf", CmdHpf, AlwaysAvailable, "Remove DC offset from trace"}, {"iir", CmdDataIIR, AlwaysAvailable, "Apply IIR buttersworth filter on plot data"}, - {"grid", CmdGrid, AlwaysAvailable, "overlay grid on graph window"}, {"ltrim", CmdLtrim, AlwaysAvailable, "Trim samples from left of trace"}, - {"rtrim", CmdRtrim, AlwaysAvailable, "Trim samples from right of trace"}, {"mtrim", CmdMtrim, AlwaysAvailable, "Trim out samples from the specified start to the specified stop"}, + {"rtrim", CmdRtrim, AlwaysAvailable, "Trim samples from right of trace"}, + {"norm", CmdNorm, AlwaysAvailable, "Normalize max/min to +/-128"}, {"setgraphmarkers", CmdSetGraphMarkers, AlwaysAvailable, "Set blue and orange marker in graph window"}, {"shiftgraphzero", CmdGraphShiftZero, AlwaysAvailable, "Shift 0 for Graphed wave + or - shift value"}, {"timescale", CmdTimeScale, AlwaysAvailable, "Set cursor display timescale"}, - {"zerocrossings", CmdZerocrossings, AlwaysAvailable, "Count time between zero-crossings"}, {"convertbitstream", CmdConvertBitStream, AlwaysAvailable, "Convert GraphBuffer's 0/1 values to 127 / -127"}, {"getbitstream", CmdGetBitStream, AlwaysAvailable, "Convert GraphBuffer's >=1 values to 1 and <1 to 0"}, + {"zerocrossings", CmdZerocrossings, AlwaysAvailable, "Count time between zero-crossings"}, {"-----------", CmdHelp, AlwaysAvailable, "------------------------- " _CYAN_("Operations") "-------------------------"}, {"asn1", CmdAsn1Decoder, AlwaysAvailable, "ASN1 decoder"}, diff --git a/client/src/proxguiqt.cpp b/client/src/proxguiqt.cpp index 26645b75c..79d86d0db 100644 --- a/client/src/proxguiqt.cpp +++ b/client/src/proxguiqt.cpp @@ -538,6 +538,7 @@ static const QColor GREEN = QColor(100, 255, 100); static const QColor RED = QColor(255, 100, 100); static const QColor BLUE = QColor(100, 100, 255); static const QColor YELLOW = QColor(255, 255, 0); +static const QColor CITRON = QColor(215, 197, 46); static const QColor PINK = QColor(255, 0, 255); static const QColor ORANGE = QColor(255, 153, 0); static const QColor LIGHTBLUE = QColor(100, 209, 246); @@ -786,22 +787,19 @@ void Plot::plotOperations(int *buffer, size_t len, QPainter *painter, QRect plot QPainterPath penPath; int32_t x = xCoordOf(g_GraphStart, plotRect), prevX = 0; int32_t y = yCoordOf(buffer[g_GraphStart], plotRect, gs_absVMax), prevY = 0; - int32_t past = 0, current = 0; + int32_t current = 0; for (uint32_t pos = g_GraphStart; pos < len && xCoordOf(pos, plotRect) < plotRect.right(); pos++) { - if(pos == 0) continue; //Skip the first value of the buffer to prevent underflows - //Store the previous x and y values to move the pen to if we need to draw a line prevX = x; prevY = y; x = xCoordOf(pos, plotRect); current = buffer[pos]; - past = buffer[pos - 1]; //Get the previous value for checking y = yCoordOf(current, plotRect, gs_absVMax); - //We don't want to graph a line over the zero line, only operations stored in the buffer - if(current == 0 && past == 0) continue; + //We only want to graph changes between the Graph Buffer and the Operation Buffer + if(current == g_GraphBuffer[pos]) continue; penPath.moveTo(prevX, prevY); //Move the pen penPath.lineTo(x, y); //Draw the line from the previous coords to the new ones