There are a TON of explorations I did here, many may be unnecessary, but this is a stake in the ground. The main issue was the strange queue logic in canconmanager::sendFrame which puts the tx data in the rx queue so it will show up in the displayed data. It caused SIGABRT and SIGSEG to show up everywhere. It is NOT fixed yet, but TX works over the wire you just can't see it in the tableview. I thought at first it was only when overwrite data was active, so I put in a a pile of changes to keep frames and filtered frames as two seperate copies of data where frames was always complete and filtered was only what was seen in the mainwindow. It made it so the graphing window would work with overwrite data active which is an improvement. I wouldn't roll these changes back. Because of these changes I had to update the frame sorting code adjust the refresh function in canframemode.cpp I also thought it was related to UI updates, but its not, that's been confirmed. I put a mutex around the custom sender tick timer so that the 1ms timer wouldn't re-enter its callback. This didn't fix the crash, but it sure seems to make a lot of sense, and the way I did it no elasped time is lost for tracking purposes, and in reality theres no way 1ms was consistent anyway. I put a mutex around the shrinking of frames and filteredframes to make sure we weren't deleting at the same time as accessing, but honestly we acccess those lists in many places without semaphores so that probably did nothing. Fixed a bug in FrameSenderWindow:DoModifiers that was improperly parsing and sometimes crashing when looking for the ~ operator before a symbol. Also added some minor work to keep row expansion functioning when changing filters or sorting. Need to make some tweaks so it stops trying so hard when overwrite is not active Theres also code in main.c taht makes debugging output super verbose. Committing now to start cleanup
116 lines
3.1 KiB
C++
116 lines
3.1 KiB
C++
#ifndef GRAPHINGWINDOW_H
|
|
#define GRAPHINGWINDOW_H
|
|
|
|
#include "qcustomplot.h"
|
|
#include "can_structs.h"
|
|
#include "dbc/dbchandler.h"
|
|
|
|
#include <QDialog>
|
|
|
|
namespace Ui {
|
|
class GraphingWindow;
|
|
}
|
|
|
|
class GraphParams
|
|
{
|
|
public:
|
|
GraphParams();
|
|
|
|
uint32_t ID;
|
|
int startBit, numBits;
|
|
bool intelFormat;
|
|
bool isSigned;
|
|
uint64_t mask;
|
|
double bias;
|
|
double scale;
|
|
int stride;
|
|
int strideSoFar;
|
|
QColor lineColor;
|
|
QColor fillColor;
|
|
int lineWidth;
|
|
bool drawOnlyPoints;
|
|
int pointType;
|
|
QCPGraph *ref;
|
|
QString graphName;
|
|
DBC_SIGNAL *associatedSignal;
|
|
//the below stuff is used for internal purposes only - code should be refactored so these can be private
|
|
QVector<double> x, y;
|
|
double xbias;
|
|
int64_t prevValTable;
|
|
QPointF prevValLocation;
|
|
QString prevValStr;
|
|
QCPItemBracket *lastBracket;
|
|
QList<QCPItemBracket *> brackets;
|
|
QList<QCPItemText *> bracketTexts;
|
|
};
|
|
|
|
class GraphingWindow : public QDialog
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit GraphingWindow(const QVector<CANFrame> *, QWidget *parent = 0);
|
|
~GraphingWindow();
|
|
void showEvent(QShowEvent*);
|
|
|
|
public slots:
|
|
void createGraph(GraphParams ¶ms, bool createGraphParam = true);
|
|
|
|
private slots:
|
|
void titleDoubleClick(QMouseEvent *event, QCPTextElement *title);
|
|
void axisDoubleClick(QCPAxis* axis, QCPAxis::SelectablePart part);
|
|
void legendDoubleClick(QCPLegend* legend, QCPAbstractLegendItem* item);
|
|
void legendSingleClick(QCPLegend* legend, QCPAbstractLegendItem* item);
|
|
void plottableDoubleClick(QCPAbstractPlottable* plottable,int dataIdx, QMouseEvent* event);
|
|
void plottableClick(QCPAbstractPlottable* plottable, int dataIdx, QMouseEvent* event);
|
|
void selectionChanged();
|
|
void mousePress();
|
|
void mouseWheel();
|
|
void removeSelectedGraph();
|
|
void removeAllGraphs();
|
|
void contextMenuRequest(QPoint pos);
|
|
void moveLegend();
|
|
void saveGraphs();
|
|
void saveSpreadsheet();
|
|
void saveDefinitions();
|
|
void loadDefinitions();
|
|
void rescaleAxis(QCPAxis* axis);
|
|
void rescaleToData();
|
|
void toggleFollowMode();
|
|
void addNewGraph();
|
|
void appendToGraph(GraphParams ¶ms, CANFrame &frame, QVector<double> &x, QVector<double> &y);
|
|
void editSelectedGraph();
|
|
void updatedFrames(int);
|
|
void gotCenterTimeID(uint32_t ID, double timestamp);
|
|
void resetView();
|
|
void zoomIn();
|
|
void zoomOut();
|
|
|
|
signals:
|
|
void sendCenterTimeID(uint32_t ID, double timestamp);
|
|
|
|
private:
|
|
Ui::GraphingWindow *ui;
|
|
DBCHandler *dbcHandler;
|
|
QList<CANFrame> frameCache;
|
|
const QVector<CANFrame> *modelFrames;
|
|
QList<GraphParams> graphParams;
|
|
QPen selectedPen;
|
|
QCPSelectionDecorator *selDecorator;
|
|
QCPItemText *locationText;
|
|
QCPItemTracer *itemTracer;
|
|
bool needScaleSetup; //do we need to set x,y graphing extents?
|
|
bool secondsMode;
|
|
bool useOpenGL;
|
|
bool followGraphEnd;
|
|
|
|
void showParamsDialog(int idx);
|
|
void closeEvent(QCloseEvent *event);
|
|
void readSettings();
|
|
void writeSettings();
|
|
bool eventFilter(QObject *obj, QEvent *event);
|
|
void changeEvent(QEvent *event);
|
|
};
|
|
|
|
#endif // GRAPHINGWINDOW_H
|