Rev 234 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 234 | Rev 239 | ||
---|---|---|---|
Line 196... | Line 196... | ||
196 | Ticker = new QTimer(this); |
196 | Ticker = new QTimer(this); |
Line 197... | Line 197... | ||
197 | 197 | ||
198 | // Seriell-Port |
198 | // Seriell-Port |
Line 199... | Line 199... | ||
199 | serialPort = new ManageSerialPort; |
199 | serialPort = new ManageSerialPort; |
200 | 200 | ||
Line 201... | Line 201... | ||
201 | // QFile-Instanz (Log-Datei) |
201 | // neuer Logger |
202 | CSVFile = new QFile(""); |
202 | logger = new Logger(Settings); |
Line 203... | Line 203... | ||
203 | 203 | ||
Line 273... | Line 273... | ||
273 | // firmeware Updateen / flashen |
273 | // firmeware Updateen / flashen |
274 | connect(pb_Update, SIGNAL(clicked()), this, SLOT(slot_pb_Update())); |
274 | connect(pb_Update, SIGNAL(clicked()), this, SLOT(slot_pb_Update())); |
275 | connect(pb_HexFile, SIGNAL(clicked()), this, SLOT(slot_pb_HexFile())); |
275 | connect(pb_HexFile, SIGNAL(clicked()), this, SLOT(slot_pb_HexFile())); |
Line 276... | Line 276... | ||
276 | 276 | ||
277 | // CVS-Record starten / stoppen |
277 | // CVS-Record starten / stoppen |
Line 278... | Line 278... | ||
278 | connect(ac_RecordCSV, SIGNAL(triggered()), this, SLOT(slot_RecordCSV())); |
278 | connect(ac_RecordCSV, SIGNAL(triggered()), this, SLOT(slot_RecordLog())); |
279 | 279 | ||
Line 280... | Line 280... | ||
280 | // Timer-Events |
280 | // Timer-Events |
Line 611... | Line 611... | ||
611 | { |
611 | { |
612 | config_Plot(); |
612 | config_Plot(); |
613 | } |
613 | } |
Line 614... | Line 614... | ||
614 | 614 | ||
615 | // CVS-Datei neu anlegen. |
615 | // CVS-Datei neu anlegen. |
616 | if ((CSVFile->isOpen()) && (Old_Analog1.LogView != Settings->Analog1.LogView)) |
616 | if (Old_Analog1.LogView != Settings->Analog1.LogView) |
- | 617 | { |
|
617 | { |
618 | QString filename = Settings->DIR.Logging + Mode.Hardware + " - " + QDate::currentDate().toString(("yyyy-MM-dd")) + " -- " + QTime::currentTime().toString("hh-mm"); |
- | 619 | logger->close(); |
|
618 | slot_RecordCSV(); |
620 | logger->newLog(filename); |
619 | slot_RecordCSV(); |
621 | update_Log(); |
Line 620... | Line 622... | ||
620 | } |
622 | } |
621 | 623 | ||
Line -... | Line 624... | ||
- | 624 | } |
|
- | 625 | } |
|
- | 626 | ||
- | 627 | //aktualisiere Logging-Status |
|
- | 628 | void MKTool::update_Log() { |
|
- | 629 | if (logger->is_active()) |
|
- | 630 | { |
|
- | 631 | logger->write(AnalogData); |
|
- | 632 | pb_Record->setText("Log Stop"); |
|
- | 633 | ac_RecordCSV->setText("Log Stop"); |
|
- | 634 | lb_Status->setText(tr("Log-Record gestartet.")); |
|
- | 635 | } |
|
- | 636 | else |
|
- | 637 | { |
|
- | 638 | pb_Record->setText("Log Aufzeichnen"); |
|
- | 639 | ac_RecordCSV->setText("Log Aufzeichnen"); |
|
- | 640 | lb_Status->setText(tr("Log-Record gestopt.")); |
|
- | 641 | } |
|
- | 642 | } |
|
- | 643 | ||
- | 644 | //starte/stoppe Logging, wenn auf den entsprechenden Button gedrückt wurde |
|
- | 645 | void MKTool::slot_RecordLog() |
|
- | 646 | { |
|
- | 647 | if (!logger->is_active()) |
|
- | 648 | logger->start_Log(); |
|
- | 649 | else |
|
- | 650 | logger->close(); |
|
622 | } |
651 | update_Log(); |
623 | } |
652 | } |
624 | 653 | ||
Line 625... | Line 654... | ||
625 | void MKTool::slot_ac_Preferences() |
654 | void MKTool::slot_ac_Preferences() |
Line 1058... | Line 1087... | ||
1058 | 1087 | ||
1059 | Settings->TTY.Port = le_Port->text(); |
1088 | Settings->TTY.Port = le_Port->text(); |
Line 1060... | Line -... | ||
1060 | } |
- | |
1061 | - | ||
1062 | - | ||
1063 | // Debug-Daten anzeigen und Aufzeichnen |
- | |
1064 | /////////////////////////////////////// |
- | |
1065 | void MKTool::write_CSV() |
- | |
1066 | { |
- | |
1067 | QTextStream Out(CSVFile); |
- | |
1068 | for (int a=0; a<MaxAnalog; a++) |
- | |
1069 | { |
- | |
1070 | if (Settings->Analog1.LogView[a]) |
- | |
1071 | { |
- | |
1072 | Out << AnalogData[a]; |
- | |
1073 | if (a < MaxAnalog - 1) |
- | |
1074 | Out << ';'; |
- | |
1075 | } |
- | |
1076 | } |
- | |
1077 | Out << "\n"; |
- | |
1078 | } |
- | |
1079 | - | ||
1080 | void MKTool::slot_RecordCSV() // DONE 0.71g |
- | |
1081 | { |
- | |
1082 | if (!CSVFile->isOpen()) |
- | |
1083 | { |
- | |
1084 | QString Filename = Settings->DIR.Logging + Mode.Hardware + " - " + QDate::currentDate().toString(("yyyy-MM-dd")) + " -- " + QTime::currentTime().toString("hh-mm") + ".csv"; |
- | |
1085 | - | ||
1086 | CSVFile = new QFile(Filename); |
- | |
1087 | if (!CSVFile->exists()) |
- | |
1088 | { |
- | |
1089 | CSVFile->open(QIODevice::Append | QIODevice::Text); |
- | |
1090 | - | ||
1091 | QTextStream Out(CSVFile); |
- | |
1092 | - | ||
1093 | for (int a = 0; a < MaxAnalog; a++) |
- | |
1094 | { |
- | |
1095 | if (Settings->Analog1.LogView[a]) |
- | |
1096 | { |
- | |
1097 | Out << Settings->Analog1.Label[a]; |
- | |
1098 | - | ||
1099 | if (a < MaxAnalog - 1) |
- | |
1100 | Out << ';'; |
- | |
1101 | } |
- | |
1102 | } |
- | |
1103 | Out << "\n"; |
- | |
1104 | } |
- | |
1105 | else |
- | |
1106 | { |
- | |
1107 | CSVFile->open(QIODevice::Append | QIODevice::Text); |
- | |
1108 | } |
- | |
1109 | - | ||
1110 | // pb_Record->setIcon(ToolBox::Icon(6)); |
- | |
1111 | // pb_Record->setText("CSV Stop"); |
- | |
1112 | // ac_RecordCSV->setIcon(ToolBox::Icon(6)); |
- | |
1113 | ac_RecordCSV->setText("CSV Stop"); |
- | |
1114 | lb_Status->setText(tr("CVS-Record gestartet.")); |
- | |
1115 | } |
- | |
1116 | else |
- | |
1117 | { |
- | |
1118 | CSVFile->close(); |
- | |
1119 | // pb_Record->setIcon(ToolBox::Icon(7)); |
- | |
1120 | // pb_Record->setText("CSV Aufzeichnen"); |
- | |
1121 | // ac_RecordCSV->setIcon(ToolBox::Icon(7)); |
- | |
1122 | ac_RecordCSV->setText("CSV Aufzeichnen"); |
- | |
1123 | lb_Status->setText(tr("CVS-Record gestopt.")); |
- | |
1124 | } |
1089 | } |
1125 | } |
1090 | |
1126 | - | ||
1127 | void MKTool::show_DebugData() |
- | |
1128 | { |
1091 | |
1129 | if (CSVFile->isOpen()) |
- | |
Line 1130... | Line 1092... | ||
1130 | { |
1092 | void MKTool::show_DebugData() |
1131 | write_CSV(); |
1093 | { |
1132 | } |
1094 | logger->write(AnalogData); |
Line 1695... | Line 1657... | ||
1695 | } |
1657 | } |
Line 1696... | Line 1658... | ||
1696 | 1658 | ||
1697 | set_Preferences(); |
1659 | set_Preferences(); |
Line 1698... | Line -... | ||
1698 | Settings->write_Settings(); |
- | |
1699 | - | ||
1700 | if (CSVFile->isOpen()) |
1660 | Settings->write_Settings(); |
1701 | { |
- | |
1702 | CSVFile->close(); |
1661 |