From e277b719da6f4804eacccda5790659eb0e3aaa7d Mon Sep 17 00:00:00 2001 From: Ian Gebbie Date: Sun, 18 Apr 2021 20:41:41 +0200 Subject: [PATCH] Matrix update --- TODO.md | 4 +- source/abstractdata.cpp | 83 +++++++++++++++++++---------------- source/hp_mdivariableedit.cpp | 3 -- source/matrixdata.cpp | 25 ++++------- source/vartablemodel.cpp | 18 ++++---- 5 files changed, 65 insertions(+), 68 deletions(-) diff --git a/TODO.md b/TODO.md index 05f99e8..8eee5bf 100644 --- a/TODO.md +++ b/TODO.md @@ -2,9 +2,11 @@ 1 GUI matrix data output to correct format + For real done + Compex matrix required + list data output - confirm output formats are correct 2 Comms diff --git a/source/abstractdata.cpp b/source/abstractdata.cpp index 8889e4d..f1f1a78 100644 --- a/source/abstractdata.cpp +++ b/source/abstractdata.cpp @@ -294,73 +294,73 @@ return out; bool BCD(QDataStream &ds, double real) { double base=0.0; +quint16 expn; int i; - -qDebug()<<"BCD from "<0) { fractpart=modf(base,&intpart); num1=(quint8)intpart; base=fractpart*10.0; // num1=i*2; + } fractpart=modf(base,&intpart); num2=(quint8)intpart; base=fractpart*10.0; // num2=i*2+1; num=BCDi(num1,num2); qDebug()<<"base: "<({0x01,0x00}),2); + + //Matrix header //Start keeps changing 01 or 02 + //0x00 //0x14 real 0x94 Complex + //0x80?? CRC?? + //0x02 + //0x00 + //0x00 + //0x00 qDebug()<<"Matrix: Parsing a Matrix"; diff --git a/source/hp_mdivariableedit.cpp b/source/hp_mdivariableedit.cpp index 77f6426..b9235b3 100644 --- a/source/hp_mdivariableedit.cpp +++ b/source/hp_mdivariableedit.cpp @@ -166,13 +166,10 @@ bool hp_mdiVariableEdit::saveFile(const QFileInfo fileinfo) QApplication::setOverrideCursor(Qt::WaitCursor); QDataStream ds(&file); - ds.setByteOrder(QDataStream::LittleEndian); - varmodel->getData(ds); - //reset busy cursor QApplication::restoreOverrideCursor(); varmodel->resetModified(); diff --git a/source/matrixdata.cpp b/source/matrixdata.cpp index fedc55a..fcefdd5 100644 --- a/source/matrixdata.cpp +++ b/source/matrixdata.cpp @@ -61,6 +61,9 @@ void MatrixData::insert(int row, int column, itemData data) if(rowlist) { rowlist->replace(column,data); } + + //TODO + //If data is complex convert to matric to a complex matrix } //Add a new row @@ -99,7 +102,7 @@ bool MatrixData::dataOut(QDataStream & ds) { QString str; //header - // static const quint8 mydata[] = {0x02, 0x01, 0x04,0x03,0x06,0x05,0x08,0x07}; + // static const quint8 mydata[] = {0x02, 0x01, 0x04,0x03,0x06,0x05,0x08,0x07}; //QByteArray test= QByteArray::fromRawData((char *)mydata,sizeof (mydata)); @@ -107,9 +110,9 @@ bool MatrixData::dataOut(QDataStream & ds) { //ds.writeRawData((char *)mydata,sizeof(mydata)); - - ds<<(quint16)0x0001; - ds<<(quint16)0x8014; + ds<<(quint16)0x0001; //somes time 02? + ds<<(quint8)0x14; //94 when complex TODO - manage change + ds<<(quint8)0x80; //CRC?? ds<<(quint16)0x0002; ds<<(quint16)0x0000; @@ -117,6 +120,7 @@ bool MatrixData::dataOut(QDataStream & ds) { ds<(column); //body + //If real type matrix _ TODO double real; QStringList l1; quint8 g; @@ -127,23 +131,10 @@ bool MatrixData::dataOut(QDataStream & ds) { real=item.dReal; BCD(ds,real); - - - // if(j!=column) - // out.append(""); } -// if (i!=row) -// out.append(""); } - //footer - ds.device()->seek(0); - ds>>g; - qDebug()<getData(ds_test); - - qDebug()<<"VarTableModel::getData"; - qDebug()<<"Out:"<getData(ds); +// dataobj->getData(ds_test); +// qDebug()<<"VarTableModel::getData"; +// qDebug()<<"Out:"<