|
|
|
@ -84,7 +84,15 @@ Widget::Widget(QWidget *parent)
|
|
|
|
|
/* 打开配置文件, 恢复关闭前的状态. */
|
|
|
|
|
QString file = QCoreApplication::applicationDirPath()+"/CableTool.ini";
|
|
|
|
|
settings = new QSettings(file, QSettings::IniFormat, this);
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
for(int i = 0; i < ui->comboPort->count(); i++)
|
|
|
|
|
{
|
|
|
|
|
if (!QString::compare(ui->comboPort->itemText(i), settings->value("usartBoxName", "COM1").toString(), Qt::CaseSensitive))
|
|
|
|
|
{
|
|
|
|
|
ui->comboPort->setCurrentIndex(i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
ui->comboBaud->setCurrentIndex(settings->value("baudBoxIndex", 6).toInt());
|
|
|
|
|
filePath = settings->value("updateFile", "").toString();
|
|
|
|
@ -284,7 +292,7 @@ int Widget::readData()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//printHexArray(__FUNCTION__, buf, len);
|
|
|
|
|
HexPrint(__FUNCTION__, rxbuf, (header->len + 4));
|
|
|
|
|
//HexPrint(__FUNCTION__, rxbuf, (header->len + 4));
|
|
|
|
|
|
|
|
|
|
paraseProtocols(rxbuf);
|
|
|
|
|
rxbufLen = 0;
|
|
|
|
@ -913,10 +921,12 @@ int Widget::protoAdjustInfo(char *data)
|
|
|
|
|
|
|
|
|
|
int Widget::protoLog(char * data)
|
|
|
|
|
{
|
|
|
|
|
mul_head_t *header = reinterpret_cast<mul_head_t*>(data + sizeof(mul_head_t));
|
|
|
|
|
mul_head_t *header = reinterpret_cast<mul_head_t*>(data + sizeof(proto_head_t));
|
|
|
|
|
falsh_log_t *log;
|
|
|
|
|
uint32_t cnt = 0;
|
|
|
|
|
|
|
|
|
|
qDebug() << "index:" << header->index << "len:" << header->len << endl;
|
|
|
|
|
|
|
|
|
|
/* 数据头校验. */
|
|
|
|
|
if (header->index != logIndex
|
|
|
|
|
|| header->len > UPDATE_DATA_SIZE)
|
|
|
|
@ -966,7 +976,6 @@ int Widget::protoLog(char * data)
|
|
|
|
|
QString temp;
|
|
|
|
|
temp.sprintf("%d / %d", logIndex, ui->stateLogEdit->text().toInt());
|
|
|
|
|
ui->logIndexLabel->setText(temp);
|
|
|
|
|
//work->multipleIndexSet(header->index + 1);
|
|
|
|
|
sendMsgLogGet();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1132,7 +1141,7 @@ int Widget::paraseProtocols(char *data)
|
|
|
|
|
//_debug_pkt_wave_cal();
|
|
|
|
|
break;
|
|
|
|
|
case DEBUG_PRV_LOG:
|
|
|
|
|
//_debug_pkt_log_get();
|
|
|
|
|
protoLog(data);
|
|
|
|
|
break;
|
|
|
|
|
case DEBUG_PRV_HISTORY_DATA:
|
|
|
|
|
protoHistoryData(data);
|
|
|
|
@ -1490,8 +1499,6 @@ int Widget::sendMsgDeviceAdjustMode(int cmd)
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int Widget::sendMsgWaveCol()
|
|
|
|
|
{
|
|
|
|
|
char buf[2048] = {0};
|
|
|
|
@ -1550,7 +1557,7 @@ int Widget::sendMsgLogGet()
|
|
|
|
|
crc = reinterpret_cast<uint32_t*>(buf + header->len);
|
|
|
|
|
*crc = crc32(buf, header->len);
|
|
|
|
|
|
|
|
|
|
HexPrint(__FUNCTION__, buf, header->len + 4);
|
|
|
|
|
//HexPrint(__FUNCTION__, buf, header->len + 4);
|
|
|
|
|
writeData(buf, header->len + 4);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -1580,9 +1587,6 @@ int Widget::sendMsgHistoryDataGet()
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Widget::on_btnConn_clicked()
|
|
|
|
|
{
|
|
|
|
|
if (!isConnected)
|
|
|
|
@ -1949,6 +1953,7 @@ void Widget::on_stateLogButton_clicked()
|
|
|
|
|
ui->logIndexLabel->setText(temp);
|
|
|
|
|
//work->multipleIndexSet(0);
|
|
|
|
|
//work->stateSet(CM_usart::WS_LOG_GET);
|
|
|
|
|
sendMsgLogGet();
|
|
|
|
|
|
|
|
|
|
/* 关闭按钮. */
|
|
|
|
|
buttonEnable(false);
|
|
|
|
|