Commit 22ac8cf45151f79edacd4418f3f823b5541c36e3

Authored by oliverhaag
1 parent 497e11b1

Updated export functionality and bulk command enum

openhantek/ChangeLog
@@ -45,3 +45,9 @@ @@ -45,3 +45,9 @@
45 * Moved constants.h to dso.h and added functions that return strings for enums 45 * Moved constants.h to dso.h and added functions that return strings for enums
46 * Sample buffer size above scope shows real sample count got from oscilloscope 46 * Sample buffer size above scope shows real sample count got from oscilloscope
47 * Documentation updated 47 * Documentation updated
  48 +
  49 +2010-08-23 Oliver Haag <oliver.haag@gmail.com>
  50 +* Saving color settings for printing too
  51 +* Added zoomed scope and markers to exports
  52 +* Darker default colors for channels in print mode
  53 +* Added enum values for DSO-5200 bulk commands
openhantek/mainpage.dox
@@ -15,7 +15,7 @@ You need the development packages for the following libraries to build OpenHante @@ -15,7 +15,7 @@ You need the development packages for the following libraries to build OpenHante
15 <li><a href="http://www.opengl.org/">OpenGL</a></li> 15 <li><a href="http://www.opengl.org/">OpenGL</a></li>
16 </ul> 16 </ul>
17 17
18 -\subsection ssec_dependencies Building 18 +\subsection ssec_building Building
19 After installing these you can build it by running: 19 After installing these you can build it by running:
20 <pre> 20 <pre>
21 $ qmake 21 $ qmake
@@ -23,7 +23,7 @@ After installing these you can build it by running: @@ -23,7 +23,7 @@ After installing these you can build it by running:
23 $ make install 23 $ make install
24 </pre> 24 </pre>
25 25
26 -\subsection ssec_dependencies Build options 26 +\subsection ssec_options Build options
27 You can set environment variables to set various build options (Done best by prepending env VARIABLE=value to the qmake command). The known environment variables are: 27 You can set environment variables to set various build options (Done best by prepending env VARIABLE=value to the qmake command). The known environment variables are:
28 <ul> 28 <ul>
29 <li> 29 <li>
@@ -44,7 +44,7 @@ You need the tool dsoextractfw from the sourceforge page too extract the firmwar @@ -44,7 +44,7 @@ You need the tool dsoextractfw from the sourceforge page too extract the firmwar
44 <pre> 44 <pre>
45 $ make 45 $ make
46 </pre> 46 </pre>
47 -After building it you have to place the DSO*1.SYS file into the same directory and run the built binary: 47 +After building it, you have to place the DSO*1.SYS file into the same directory and run the built binary:
48 <pre> 48 <pre>
49 $ ./dsoextractfw 49 $ ./dsoextractfw
50 </pre> 50 </pre>
openhantek/src/dsowidget.cpp
@@ -278,7 +278,7 @@ void DsoWidget::setMeasurementVisible(unsigned int channel, bool visible) { @@ -278,7 +278,7 @@ void DsoWidget::setMeasurementVisible(unsigned int channel, bool visible) {
278 /// \brief Update the label about the marker measurements 278 /// \brief Update the label about the marker measurements
279 void DsoWidget::updateMarkerDetails() { 279 void DsoWidget::updateMarkerDetails() {
280 double divs = fabs(this->settings->scope.horizontal.marker[1] - this->settings->scope.horizontal.marker[0]); 280 double divs = fabs(this->settings->scope.horizontal.marker[1] - this->settings->scope.horizontal.marker[0]);
281 - double time = divs * this->settings->scope.horizontal.timebase; 281 + double time = divs * this->settings->scope.horizontal.timebase;
282 282
283 if(this->settings->view.zoom) { 283 if(this->settings->view.zoom) {
284 this->markerInfoLabel->setText(tr("Zoom x%L1").arg(DIVS_TIME / divs, -1, 'g', 3)); 284 this->markerInfoLabel->setText(tr("Zoom x%L1").arg(DIVS_TIME / divs, -1, 'g', 3));
openhantek/src/exporter.cpp
@@ -22,6 +22,8 @@ @@ -22,6 +22,8 @@
22 //////////////////////////////////////////////////////////////////////////////// 22 ////////////////////////////////////////////////////////////////////////////////
23 23
24 24
  25 +#include <cmath>
  26 +
25 #include <QImage> 27 #include <QImage>
26 #include <QMutex> 28 #include <QMutex>
27 #include <QPainter> 29 #include <QPainter>
@@ -142,7 +144,7 @@ bool Exporter::doExport() { @@ -142,7 +144,7 @@ bool Exporter::doExport() {
142 // Draw the measurement table 144 // Draw the measurement table
143 stretchBase = (double) (paintDevice->width() - lineHeight * 6) / 10; 145 stretchBase = (double) (paintDevice->width() - lineHeight * 6) / 10;
144 int channelCount = 0; 146 int channelCount = 0;
145 - for(int channel = 0; channel < this->settings->scope.voltage.count(); channel++) { 147 + for(int channel = this->settings->scope.voltage.count() - 1; channel >= 0; channel--) {
146 if(this->settings->scope.voltage[channel].used || this->settings->scope.spectrum[channel].used) { 148 if(this->settings->scope.voltage[channel].used || this->settings->scope.spectrum[channel].used) {
147 channelCount++; 149 channelCount++;
148 double top = (double) paintDevice->height() - channelCount * lineHeight; 150 double top = (double) paintDevice->height() - channelCount * lineHeight;
@@ -170,130 +172,188 @@ bool Exporter::doExport() { @@ -170,130 +172,188 @@ bool Exporter::doExport() {
170 } 172 }
171 } 173 }
172 174
  175 + // Draw the marker table
  176 + double scopeHeight;
  177 + stretchBase = (double) (paintDevice->width() - lineHeight * 10) / 4;
  178 + painter.setPen(colorValues->text);
  179 +
  180 + // Calculate variables needed for zoomed scope
  181 + double divs = fabs(this->settings->scope.horizontal.marker[1] - this->settings->scope.horizontal.marker[0]);
  182 + double time = divs * this->settings->scope.horizontal.timebase;
  183 + double zoomFactor = DIVS_TIME / divs;
  184 + double zoomOffset = (this->settings->scope.horizontal.marker[0] + this->settings->scope.horizontal.marker[1]) / 2;
  185 +
  186 + if(this->settings->view.zoom) {
  187 + scopeHeight = (double) (paintDevice->height() - (channelCount + 5) * lineHeight) / 2;
  188 + double top = 2.5 * lineHeight + scopeHeight;
  189 +
  190 + painter.drawText(QRectF(0, top, stretchBase, lineHeight), tr("Zoom x%L1").arg(DIVS_TIME / divs, -1, 'g', 3));
  191 +
  192 + painter.drawText(QRectF(lineHeight * 10, top, stretchBase, lineHeight), Helper::valueToString(time, Helper::UNIT_SECONDS, 4), QTextOption(Qt::AlignRight));
  193 + painter.drawText(QRectF(lineHeight * 10 + stretchBase, top, stretchBase, lineHeight), Helper::valueToString(1.0 / time, Helper::UNIT_HERTZ, 4), QTextOption(Qt::AlignRight));
  194 +
  195 + painter.drawText(QRectF(lineHeight * 10 + stretchBase * 2, top, stretchBase, lineHeight), Helper::valueToString(time / DIVS_TIME, Helper::UNIT_SECONDS, 3) + tr("/div"), QTextOption(Qt::AlignRight));
  196 + painter.drawText(QRectF(lineHeight * 10 + stretchBase * 3, top, stretchBase, lineHeight), Helper::valueToString(divs * this->settings->scope.horizontal.frequencybase / DIVS_TIME, Helper::UNIT_HERTZ, 3) + tr("/div"), QTextOption(Qt::AlignRight));
  197 + }
  198 + else {
  199 + scopeHeight = (double) paintDevice->height() - (channelCount + 4) * lineHeight;
  200 + double top = 2.5 * lineHeight + scopeHeight;
  201 +
  202 + painter.drawText(QRectF(0, top, stretchBase, lineHeight), tr("Marker 1/2"));
  203 +
  204 + painter.drawText(QRectF(lineHeight * 10, top, stretchBase * 2, lineHeight), Helper::valueToString(time, Helper::UNIT_SECONDS, 4), QTextOption(Qt::AlignRight));
  205 + painter.drawText(QRectF(lineHeight * 10 + stretchBase * 2, top, stretchBase * 2, lineHeight), Helper::valueToString(1.0 / time, Helper::UNIT_HERTZ, 4), QTextOption(Qt::AlignRight));
  206 + }
  207 +
173 // Set DIVS_TIME x DIVS_VOLTAGE matrix for oscillograph 208 // Set DIVS_TIME x DIVS_VOLTAGE matrix for oscillograph
174 - double screenHeight = (double) paintDevice->height() - (channelCount + 3) * lineHeight;  
175 - painter.setMatrix(QMatrix((paintDevice->width() - 1) / DIVS_TIME, 0, 0, -(screenHeight - 1) / DIVS_VOLTAGE, (double) (paintDevice->width() - 1) / 2, (screenHeight - 1) / 2 + lineHeight * 2), false); 209 + painter.setMatrix(QMatrix((paintDevice->width() - 1) / DIVS_TIME, 0, 0, -(scopeHeight - 1) / DIVS_VOLTAGE, (double) (paintDevice->width() - 1) / 2, (scopeHeight - 1) / 2 + lineHeight * 1.5), false);
176 210
177 // Draw the graphs 211 // Draw the graphs
178 painter.setRenderHint(QPainter::Antialiasing); 212 painter.setRenderHint(QPainter::Antialiasing);
179 painter.setBrush(Qt::NoBrush); 213 painter.setBrush(Qt::NoBrush);
180 214
181 - switch(this->settings->scope.horizontal.format) {  
182 - case Dso::GRAPHFORMAT_TY:  
183 - // Add graphs for channels  
184 - for(int channel = 0 ; channel < this->settings->scope.voltage.count(); channel++) {  
185 - if(this->settings->scope.voltage[channel].used) {  
186 - painter.setPen(colorValues->voltage[channel]);  
187 -  
188 - // What's the horizontal distance between sampling points?  
189 - double horizontalFactor = this->dataAnalyzer->data(channel)->samples.voltage.interval / this->settings->scope.horizontal.timebase;  
190 - // How many samples are visible?  
191 - unsigned int lastPosition = DIVS_TIME / horizontalFactor;  
192 - if(lastPosition >= this->dataAnalyzer->data(channel)->samples.voltage.count)  
193 - lastPosition = this->dataAnalyzer->data(channel)->samples.voltage.count - 1;  
194 -  
195 - // Draw graph  
196 - QPointF *graph = new QPointF[lastPosition + 1];  
197 - for(unsigned int position = 0; position <= lastPosition; position++)  
198 - graph[position] = QPointF(position * horizontalFactor - DIVS_TIME / 2, this->dataAnalyzer->data(channel)->samples.voltage.sample[position] / this->settings->scope.voltage[channel].gain + this->settings->scope.voltage[channel].offset);  
199 - painter.drawPolyline(graph, lastPosition + 1); 215 + for(int zoomed = 0; zoomed < (this->settings->view.zoom ? 2 : 1); zoomed++) {
  216 + switch(this->settings->scope.horizontal.format) {
  217 + case Dso::GRAPHFORMAT_TY:
  218 + // Add graphs for channels
  219 + for(int channel = 0 ; channel < this->settings->scope.voltage.count(); channel++) {
  220 + if(this->settings->scope.voltage[channel].used) {
  221 + painter.setPen(colorValues->voltage[channel]);
  222 +
  223 + // What's the horizontal distance between sampling points?
  224 + double horizontalFactor = this->dataAnalyzer->data(channel)->samples.voltage.interval / this->settings->scope.horizontal.timebase;
  225 + // How many samples are visible?
  226 + double centerPosition, centerOffset;
  227 + if(zoomed) {
  228 + centerPosition = (zoomOffset + DIVS_TIME / 2) / horizontalFactor;
  229 + centerOffset = DIVS_TIME / horizontalFactor / zoomFactor / 2;
  230 + }
  231 + else {
  232 + centerPosition = DIVS_TIME / 2 / horizontalFactor;
  233 + centerOffset = DIVS_TIME / horizontalFactor / 2;
  234 + }
  235 + unsigned int firstPosition = qMax((int) (centerPosition - centerOffset), 0);
  236 + unsigned int lastPosition = qMin((int) (centerPosition + centerOffset), (int) this->dataAnalyzer->data(channel)->samples.voltage.count - 1);
  237 +
  238 + // Draw graph
  239 + QPointF *graph = new QPointF[lastPosition - firstPosition + 1];
  240 + for(unsigned int position = firstPosition; position <= lastPosition; position++)
  241 + graph[position - firstPosition] = QPointF(position * horizontalFactor - DIVS_TIME / 2, this->dataAnalyzer->data(channel)->samples.voltage.sample[position] / this->settings->scope.voltage[channel].gain + this->settings->scope.voltage[channel].offset);
  242 + painter.drawPolyline(graph, lastPosition - firstPosition + 1);
  243 + }
200 } 244 }
201 - }  
202 -  
203 - // Add spectrum graphs  
204 - for (int channel = 0; channel < this->settings->scope.spectrum.count(); channel++) {  
205 - if(this->settings->scope.spectrum[channel].used) {  
206 - painter.setPen(colorValues->spectrum[channel]);  
207 -  
208 - // What's the horizontal distance between sampling points?  
209 - double horizontalFactor = this->dataAnalyzer->data(channel)->samples.spectrum.interval / this->settings->scope.horizontal.frequencybase;  
210 - // How many samples are visible?  
211 - unsigned int lastPosition = DIVS_TIME / horizontalFactor;  
212 - if(lastPosition >= this->dataAnalyzer->data(channel)->samples.spectrum.count)  
213 - lastPosition = this->dataAnalyzer->data(channel)->samples.spectrum.count - 1;  
214 -  
215 - // Draw graph  
216 - QPointF *graph = new QPointF[lastPosition + 1];  
217 - for(unsigned int position = 0; position <= lastPosition; position++)  
218 - graph[position] = QPointF(position * horizontalFactor - DIVS_TIME / 2, this->dataAnalyzer->data(channel)->samples.spectrum.sample[position] / this->settings->scope.spectrum[channel].magnitude + this->settings->scope.spectrum[channel].offset);  
219 - painter.drawPolyline(graph, lastPosition + 1); 245 +
  246 + // Add spectrum graphs
  247 + for (int channel = 0; channel < this->settings->scope.spectrum.count(); channel++) {
  248 + if(this->settings->scope.spectrum[channel].used) {
  249 + painter.setPen(colorValues->spectrum[channel]);
  250 +
  251 + // What's the horizontal distance between sampling points?
  252 + double horizontalFactor = this->dataAnalyzer->data(channel)->samples.spectrum.interval / this->settings->scope.horizontal.frequencybase;
  253 + // How many samples are visible?
  254 + double centerPosition, centerOffset;
  255 + if(zoomed) {
  256 + centerPosition = (zoomOffset + DIVS_TIME / 2) / horizontalFactor;
  257 + centerOffset = DIVS_TIME / horizontalFactor / zoomFactor / 2;
  258 + }
  259 + else {
  260 + centerPosition = DIVS_TIME / 2 / horizontalFactor;
  261 + centerOffset = DIVS_TIME / horizontalFactor / 2;
  262 + }
  263 + unsigned int firstPosition = qMax((int) (centerPosition - centerOffset), 0);
  264 + unsigned int lastPosition = qMin((int) (centerPosition + centerOffset), (int) this->dataAnalyzer->data(channel)->samples.spectrum.count - 1);
  265 +
  266 + // Draw graph
  267 + QPointF *graph = new QPointF[lastPosition - firstPosition + 1];
  268 + for(unsigned int position = firstPosition; position <= lastPosition; position++)
  269 + graph[position - firstPosition] = QPointF(position * horizontalFactor - DIVS_TIME / 2, this->dataAnalyzer->data(channel)->samples.spectrum.sample[position] / this->settings->scope.spectrum[channel].magnitude + this->settings->scope.spectrum[channel].offset);
  270 + painter.drawPolyline(graph, lastPosition - firstPosition + 1);
  271 + }
220 } 272 }
221 - }  
222 - break; 273 + break;
  274 +
  275 + case Dso::GRAPHFORMAT_XY:
  276 + break;
223 277
224 - case Dso::GRAPHFORMAT_XY:  
225 - break; 278 + default:
  279 + break;
  280 + }
226 281
227 - default:  
228 - break; 282 + // Set DIVS_TIME / zoomFactor x DIVS_VOLTAGE matrix for zoomed oscillograph
  283 + painter.setMatrix(QMatrix((paintDevice->width() - 1) / DIVS_TIME * zoomFactor, 0, 0, -(scopeHeight - 1) / DIVS_VOLTAGE, (double) (paintDevice->width() - 1) / 2 - zoomOffset * zoomFactor * (paintDevice->width() - 1) / DIVS_TIME, (scopeHeight - 1) * 1.5 + lineHeight * 4), false);
229 } 284 }
230 285
231 this->dataAnalyzer->mutex()->unlock(); 286 this->dataAnalyzer->mutex()->unlock();
232 287
233 - // Draw grid 288 + // Draw grids
234 painter.setRenderHint(QPainter::Antialiasing, false); 289 painter.setRenderHint(QPainter::Antialiasing, false);
235 - // Grid lines  
236 - painter.setPen(colorValues->grid);  
237 -  
238 - if(this->format < EXPORT_FORMAT_IMAGE) {  
239 - // Draw vertical lines  
240 - for(int div = 1; div < DIVS_TIME / 2; div++) {  
241 - for(int dot = 1; dot < DIVS_VOLTAGE / 2 * 5; dot++) {  
242 - painter.drawLine(QPointF((double) -div - 0.02, (double) -dot / 5), QPointF((double) -div + 0.02, (double) -dot / 5));  
243 - painter.drawLine(QPointF((double) -div - 0.02, (double) dot / 5), QPointF((double) -div + 0.02, (double) dot / 5));  
244 - painter.drawLine(QPointF((double) div - 0.02, (double) -dot / 5), QPointF((double) div + 0.02, (double) -dot / 5));  
245 - painter.drawLine(QPointF((double) div - 0.02, (double) dot / 5), QPointF((double) div + 0.02, (double) dot / 5)); 290 + for(int zoomed = 0; zoomed < (this->settings->view.zoom ? 2 : 1); zoomed++) {
  291 + // Set DIVS_TIME x DIVS_VOLTAGE matrix for oscillograph
  292 + painter.setMatrix(QMatrix((paintDevice->width() - 1) / DIVS_TIME, 0, 0, -(scopeHeight - 1) / DIVS_VOLTAGE, (double) (paintDevice->width() - 1) / 2, (scopeHeight - 1) * (zoomed + 0.5) + lineHeight * 1.5 + lineHeight * 2.5 * zoomed), false);
  293 +
  294 + // Grid lines
  295 + painter.setPen(colorValues->grid);
  296 +
  297 + if(this->format < EXPORT_FORMAT_IMAGE) {
  298 + // Draw vertical lines
  299 + for(int div = 1; div < DIVS_TIME / 2; div++) {
  300 + for(int dot = 1; dot < DIVS_VOLTAGE / 2 * 5; dot++) {
  301 + painter.drawLine(QPointF((double) -div - 0.02, (double) -dot / 5), QPointF((double) -div + 0.02, (double) -dot / 5));
  302 + painter.drawLine(QPointF((double) -div - 0.02, (double) dot / 5), QPointF((double) -div + 0.02, (double) dot / 5));
  303 + painter.drawLine(QPointF((double) div - 0.02, (double) -dot / 5), QPointF((double) div + 0.02, (double) -dot / 5));
  304 + painter.drawLine(QPointF((double) div - 0.02, (double) dot / 5), QPointF((double) div + 0.02, (double) dot / 5));
  305 + }
246 } 306 }
247 - }  
248 - // Draw horizontal lines  
249 - for(int div = 1; div < DIVS_VOLTAGE / 2; div++) {  
250 - for(int dot = 1; dot < DIVS_TIME / 2 * 5; dot++) {  
251 - painter.drawLine(QPointF((double) -dot / 5, (double) -div - 0.02), QPointF((double) -dot / 5, (double) -div + 0.02));  
252 - painter.drawLine(QPointF((double) dot / 5, (double) -div - 0.02), QPointF((double) dot / 5, (double) -div + 0.02));  
253 - painter.drawLine(QPointF((double) -dot / 5, (double) div - 0.02), QPointF((double) -dot / 5, (double) div + 0.02));  
254 - painter.drawLine(QPointF((double) dot / 5, (double) div - 0.02), QPointF((double) dot / 5, (double) div + 0.02)); 307 + // Draw horizontal lines
  308 + for(int div = 1; div < DIVS_VOLTAGE / 2; div++) {
  309 + for(int dot = 1; dot < DIVS_TIME / 2 * 5; dot++) {
  310 + painter.drawLine(QPointF((double) -dot / 5, (double) -div - 0.02), QPointF((double) -dot / 5, (double) -div + 0.02));
  311 + painter.drawLine(QPointF((double) dot / 5, (double) -div - 0.02), QPointF((double) dot / 5, (double) -div + 0.02));
  312 + painter.drawLine(QPointF((double) -dot / 5, (double) div - 0.02), QPointF((double) -dot / 5, (double) div + 0.02));
  313 + painter.drawLine(QPointF((double) dot / 5, (double) div - 0.02), QPointF((double) dot / 5, (double) div + 0.02));
  314 + }
255 } 315 }
256 } 316 }
257 - }  
258 - else {  
259 - // Draw vertical lines  
260 - for(int div = 1; div < DIVS_TIME / 2; div++) {  
261 - for(int dot = 1; dot < DIVS_VOLTAGE / 2 * 5; dot++) {  
262 - painter.drawPoint(QPointF(-div, (double) -dot / 5));  
263 - painter.drawPoint(QPointF(-div, (double) dot / 5));  
264 - painter.drawPoint(QPointF(div, (double) -dot / 5));  
265 - painter.drawPoint(QPointF(div, (double) dot / 5)); 317 + else {
  318 + // Draw vertical lines
  319 + for(int div = 1; div < DIVS_TIME / 2; div++) {
  320 + for(int dot = 1; dot < DIVS_VOLTAGE / 2 * 5; dot++) {
  321 + painter.drawPoint(QPointF(-div, (double) -dot / 5));
  322 + painter.drawPoint(QPointF(-div, (double) dot / 5));
  323 + painter.drawPoint(QPointF(div, (double) -dot / 5));
  324 + painter.drawPoint(QPointF(div, (double) dot / 5));
  325 + }
266 } 326 }
267 - }  
268 - // Draw horizontal lines  
269 - for(int div = 1; div < DIVS_VOLTAGE / 2; div++) {  
270 - for(int dot = 1; dot < DIVS_TIME / 2 * 5; dot++) {  
271 - if(dot % 5 == 0)  
272 - continue; // Already done by vertical lines  
273 - painter.drawPoint(QPointF((double) -dot / 5, -div));  
274 - painter.drawPoint(QPointF((double) dot / 5, -div));  
275 - painter.drawPoint(QPointF((double) -dot / 5, div));  
276 - painter.drawPoint(QPointF((double) dot / 5, div)); 327 + // Draw horizontal lines
  328 + for(int div = 1; div < DIVS_VOLTAGE / 2; div++) {
  329 + for(int dot = 1; dot < DIVS_TIME / 2 * 5; dot++) {
  330 + if(dot % 5 == 0)
  331 + continue; // Already done by vertical lines
  332 + painter.drawPoint(QPointF((double) -dot / 5, -div));
  333 + painter.drawPoint(QPointF((double) dot / 5, -div));
  334 + painter.drawPoint(QPointF((double) -dot / 5, div));
  335 + painter.drawPoint(QPointF((double) dot / 5, div));
  336 + }
277 } 337 }
278 } 338 }
279 - } 339 +
  340 + // Axes
  341 + painter.setPen(colorValues->axes);
  342 + painter.drawLine(QPointF(-DIVS_TIME / 2, 0), QPointF(DIVS_TIME / 2, 0));
  343 + painter.drawLine(QPointF(0, -DIVS_VOLTAGE / 2), QPointF(0, DIVS_VOLTAGE / 2));
  344 + for(double div = 0.2; div <= DIVS_TIME / 2; div += 0.2) {
  345 + painter.drawLine(QPointF(div, -0.05), QPointF(div, 0.05));
  346 + painter.drawLine(QPointF(-div, -0.05), QPointF(-div, 0.05));
  347 + }
  348 + for(double div = 0.2; div <= DIVS_VOLTAGE / 2; div += 0.2) {
  349 + painter.drawLine(QPointF(-0.05, div), QPointF(0.05, div));
  350 + painter.drawLine(QPointF(-0.05, -div), QPointF(0.05, -div));
  351 + }
280 352
281 - // Axes  
282 - painter.setPen(colorValues->axes);  
283 - painter.drawLine(QPointF(-DIVS_TIME / 2, 0), QPointF(DIVS_TIME / 2, 0));  
284 - painter.drawLine(QPointF(0, -DIVS_VOLTAGE / 2), QPointF(0, DIVS_VOLTAGE / 2));  
285 - for(double div = 0.2; div <= DIVS_TIME / 2; div += 0.2) {  
286 - painter.drawLine(QPointF(div, -0.05), QPointF(div, 0.05));  
287 - painter.drawLine(QPointF(-div, -0.05), QPointF(-div, 0.05)); 353 + // Borders
  354 + painter.setPen(colorValues->border);
  355 + painter.drawRect(QRectF(-DIVS_TIME / 2, -DIVS_VOLTAGE / 2, DIVS_TIME, DIVS_VOLTAGE));
288 } 356 }
289 - for(double div = 0.2; div <= DIVS_VOLTAGE / 2; div += 0.2) {  
290 - painter.drawLine(QPointF(-0.05, div), QPointF(0.05, div));  
291 - painter.drawLine(QPointF(-0.05, -div), QPointF(0.05, -div));  
292 - }  
293 -  
294 - // Borders  
295 - painter.setPen(colorValues->border);  
296 - painter.drawRect(QRectF(-DIVS_TIME / 2, -DIVS_VOLTAGE / 2, DIVS_TIME, DIVS_VOLTAGE));  
297 357
298 painter.end(); 358 painter.end();
299 359
openhantek/src/hantek/types.h
@@ -208,6 +208,69 @@ namespace Hantek { @@ -208,6 +208,69 @@ namespace Hantek {
208 /// </table> 208 /// </table>
209 COMMAND_GETLOGICALDATA, 209 COMMAND_GETLOGICALDATA,
210 210
  211 + /// This command isn't used for the DSO-2090 and DSO-5200:
  212 + /// <table>
  213 + /// <tr>
  214 + /// <td>0x0a</td>
  215 + /// <td>...</td>
  216 + /// </tr>
  217 + /// </table>
  218 + COMMAND_UNKNOWN_0A,
  219 +
  220 + /// This command isn't used for the DSO-2090 and DSO-5200:
  221 + /// <table>
  222 + /// <tr>
  223 + /// <td>0x0b</td>
  224 + /// <td>...</td>
  225 + /// </tr>
  226 + /// </table>
  227 + COMMAND_UNKNOWN_0B,
  228 +
  229 + /// This command seems to set the sampling rate for the DSO-5200:
  230 + /// <table>
  231 + /// <tr>
  232 + /// <td>0x0c</td>
  233 + /// <td>0x00</td>
  234 + /// <td>Samplerate[0] (?)</td>
  235 + /// <td>Samplerate[1] (?)</td>
  236 + /// <td>Unknown</td>
  237 + /// <td>0x00</td>
  238 + /// </tr>
  239 + /// </table>
  240 + COMMAND_DSO5200_0C,
  241 +
  242 + /// This command seems to set trigger settings for the DSO-5200:
  243 + /// <table>
  244 + /// <tr>
  245 + /// <td>0x0d</td>
  246 + /// <td>0x00</td>
  247 + /// <td>Unknown</td>
  248 + /// <td>Unknown</td>
  249 + /// <td>TriggerPoint (?)</td>
  250 + /// <td>0xff</td>
  251 + /// <td>TriggerPoint (?)</td>
  252 + /// <td>0xff</td>
  253 + /// <td>TriggerPoint (?)</td>
  254 + /// <td>0xff</td>
  255 + /// </tr>
  256 + /// </table>
  257 + COMMAND_DSO5200_0D,
  258 +
  259 + /// This command seems to set some additional settings for the DSO-5200:
  260 + /// <table>
  261 + /// <tr>
  262 + /// <td>0x0e</td>
  263 + /// <td>0x00</td>
  264 + /// <td>Unknown</td>
  265 + /// <td>0x00</td>
  266 + /// <td>Unknown</td>
  267 + /// <td>0x00</td>
  268 + /// <td>0x00</td>
  269 + /// <td>0x00</td>
  270 + /// </tr>
  271 + /// </table>
  272 + COMMAND_DSO5200_0E,
  273 +
211 COMMAND_COUNT ///< Total number of commands 274 COMMAND_COUNT ///< Total number of commands
212 }; 275 };
213 276
openhantek/src/openhantek.cpp
@@ -405,27 +405,40 @@ void OpenHantekMainWindow::readSettings(const QString &amp;fileName) { @@ -405,27 +405,40 @@ void OpenHantekMainWindow::readSettings(const QString &amp;fileName) {
405 settingsLoader->beginGroup("view"); 405 settingsLoader->beginGroup("view");
406 // Colors 406 // Colors
407 settingsLoader->beginGroup("color"); 407 settingsLoader->beginGroup("color");
408 - if(settingsLoader->contains("axes"))  
409 - this->settings->view.color.screen.axes = settingsLoader->value("axes").value<QColor>();  
410 - if(settingsLoader->contains("background"))  
411 - this->settings->view.color.screen.background = settingsLoader->value("background").value<QColor>();  
412 - if(settingsLoader->contains("border"))  
413 - this->settings->view.color.screen.border = settingsLoader->value("border").value<QColor>();  
414 - if(settingsLoader->contains("grid"))  
415 - this->settings->view.color.screen.grid = settingsLoader->value("grid").value<QColor>();  
416 - if(settingsLoader->contains("markers"))  
417 - this->settings->view.color.screen.markers = settingsLoader->value("markers").value<QColor>();  
418 - for(int channel = 0; channel < this->settings->scope.spectrum.count(); channel++) {  
419 - QString key = QString("spectrum%1").arg(channel);  
420 - if(settingsLoader->contains(key))  
421 - this->settings->view.color.screen.spectrum[channel] = settingsLoader->value(key).value<QColor>();  
422 - }  
423 - if(settingsLoader->contains("text"))  
424 - this->settings->view.color.screen.text = settingsLoader->value("text").value<QColor>();  
425 - for(int channel = 0; channel < this->settings->scope.voltage.count(); channel++) {  
426 - QString key = QString("voltage%1").arg(channel);  
427 - if(settingsLoader->contains(key))  
428 - this->settings->view.color.screen.voltage[channel] = settingsLoader->value(key).value<QColor>(); 408 + DsoSettingsColorValues *colors;
  409 + for(int mode = 0; mode < 2; mode++) {
  410 + if(mode == 0) {
  411 + colors = &this->settings->view.color.screen;
  412 + settingsLoader->beginGroup("screen");
  413 + }
  414 + else {
  415 + colors = &this->settings->view.color.print;
  416 + settingsLoader->beginGroup("print");
  417 + }
  418 +
  419 + if(settingsLoader->contains("axes"))
  420 + colors->axes = settingsLoader->value("axes").value<QColor>();
  421 + if(settingsLoader->contains("background"))
  422 + colors->background = settingsLoader->value("background").value<QColor>();
  423 + if(settingsLoader->contains("border"))
  424 + colors->border = settingsLoader->value("border").value<QColor>();
  425 + if(settingsLoader->contains("grid"))
  426 + colors->grid = settingsLoader->value("grid").value<QColor>();
  427 + if(settingsLoader->contains("markers"))
  428 + colors->markers = settingsLoader->value("markers").value<QColor>();
  429 + for(int channel = 0; channel < this->settings->scope.spectrum.count(); channel++) {
  430 + QString key = QString("spectrum%1").arg(channel);
  431 + if(settingsLoader->contains(key))
  432 + colors->spectrum[channel] = settingsLoader->value(key).value<QColor>();
  433 + }
  434 + if(settingsLoader->contains("text"))
  435 + colors->text = settingsLoader->value("text").value<QColor>();
  436 + for(int channel = 0; channel < this->settings->scope.voltage.count(); channel++) {
  437 + QString key = QString("voltage%1").arg(channel);
  438 + if(settingsLoader->contains(key))
  439 + colors->voltage[channel] = settingsLoader->value(key).value<QColor>();
  440 + }
  441 + settingsLoader->endGroup();
429 } 442 }
430 settingsLoader->endGroup(); 443 settingsLoader->endGroup();
431 // Other view settings 444 // Other view settings
@@ -507,16 +520,29 @@ void OpenHantekMainWindow::writeSettings(const QString &amp;fileName) { @@ -507,16 +520,29 @@ void OpenHantekMainWindow::writeSettings(const QString &amp;fileName) {
507 // Colors 520 // Colors
508 if(complete) { 521 if(complete) {
509 settingsSaver->beginGroup("color"); 522 settingsSaver->beginGroup("color");
510 - settingsSaver->setValue("axes", this->settings->view.color.screen.axes);  
511 - settingsSaver->setValue("background", this->settings->view.color.screen.background);  
512 - settingsSaver->setValue("border", this->settings->view.color.screen.border);  
513 - settingsSaver->setValue("grid", this->settings->view.color.screen.grid);  
514 - settingsSaver->setValue("markers", this->settings->view.color.screen.markers);  
515 - for(int channel = 0; channel < this->settings->scope.spectrum.count(); channel++)  
516 - settingsSaver->setValue(QString("spectrum%1").arg(channel), this->settings->view.color.screen.spectrum[channel]);  
517 - settingsSaver->setValue("text", this->settings->view.color.screen.text);  
518 - for(int channel = 0; channel < this->settings->scope.voltage.count(); channel++)  
519 - settingsSaver->setValue(QString("voltage%1").arg(channel), this->settings->view.color.screen.voltage[channel]); 523 + DsoSettingsColorValues *colors;
  524 + for(int mode = 0; mode < 2; mode++) {
  525 + if(mode == 0) {
  526 + colors = &this->settings->view.color.screen;
  527 + settingsSaver->beginGroup("screen");
  528 + }
  529 + else {
  530 + colors = &this->settings->view.color.print;
  531 + settingsSaver->beginGroup("print");
  532 + }
  533 +
  534 + settingsSaver->setValue("axes", colors->axes);
  535 + settingsSaver->setValue("background", colors->background);
  536 + settingsSaver->setValue("border", colors->border);
  537 + settingsSaver->setValue("grid", colors->grid);
  538 + settingsSaver->setValue("markers", colors->markers);
  539 + for(int channel = 0; channel < this->settings->scope.spectrum.count(); channel++)
  540 + settingsSaver->setValue(QString("spectrum%1").arg(channel), colors->spectrum[channel]);
  541 + settingsSaver->setValue("text", colors->text);
  542 + for(int channel = 0; channel < this->settings->scope.voltage.count(); channel++)
  543 + settingsSaver->setValue(QString("voltage%1").arg(channel), colors->voltage[channel]);
  544 + settingsSaver->endGroup();
  545 + }
520 settingsSaver->endGroup(); 546 settingsSaver->endGroup();
521 } 547 }
522 // Other view settings 548 // Other view settings
openhantek/src/settings.cpp
@@ -135,9 +135,9 @@ void DsoSettings::setChannelCount(unsigned int channels) { @@ -135,9 +135,9 @@ void DsoSettings::setChannelCount(unsigned int channels) {
135 this->view.color.screen.spectrum.insert(channel, this->view.color.screen.voltage[channel].lighter()); 135 this->view.color.screen.spectrum.insert(channel, this->view.color.screen.voltage[channel].lighter());
136 // Print 136 // Print
137 if(this->view.color.print.voltage.count() <= channel + 1) 137 if(this->view.color.print.voltage.count() <= channel + 1)
138 - this->view.color.print.voltage.insert(channel, this->view.color.screen.voltage[channel]); 138 + this->view.color.print.voltage.insert(channel, this->view.color.screen.voltage[channel].darker(120));
139 if(this->view.color.print.spectrum.count() <= channel + 1) 139 if(this->view.color.print.spectrum.count() <= channel + 1)
140 - this->view.color.print.spectrum.insert(channel, this->view.color.print.voltage[channel].darker()); 140 + this->view.color.print.spectrum.insert(channel, this->view.color.screen.voltage[channel].darker());
141 } 141 }
142 142
143 // Check if the math channel is missing 143 // Check if the math channel is missing