Skip to content

Commit

Permalink
support full resolution saving of PD290 images
Browse files Browse the repository at this point in the history
the scope image of PD290 is still cropped to 640 pixels but aspect
ratio is now correct
  • Loading branch information
xdsopl committed Nov 22, 2024
1 parent 2c3c6b1 commit 28ebde8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions app/src/main/java/xdsopl/robot36/Decoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class Decoder {
this.scopeBuffer = scopeBuffer;
this.imageBuffer = imageBuffer;
imageBuffer.line = -1;
pixelBuffer = new PixelBuffer(scopeBuffer.width, 2);
pixelBuffer = new PixelBuffer(800, 2);
demodulator = new Demodulator(sampleRate);
double pulseFilterSeconds = 0.0025;
int pulseFilterSamples = (int) Math.round(pulseFilterSeconds * sampleRate) | 1;
Expand Down Expand Up @@ -115,7 +115,7 @@ public class Decoder {
syncPulse20msModes.add(new PaulDon("160", 98, 512, 400, 0.195584, sampleRate));
syncPulse20msModes.add(new PaulDon("180", 96, 640, 496, 0.18304, sampleRate));
syncPulse20msModes.add(new PaulDon("240", 97, 640, 496, 0.24448, sampleRate));
syncPulse20msModes.add(new PaulDon("290", 94, 640, 616, 0.2288, sampleRate));
syncPulse20msModes.add(new PaulDon("290", 94, 800, 616, 0.2288, sampleRate));
}

private double scanLineMean(int[] lines) {
Expand Down Expand Up @@ -170,11 +170,12 @@ private Mode findMode(ArrayList<Mode> modes, String name) {
}

private void copyUnscaled() {
int width = Math.min(scopeBuffer.width, pixelBuffer.width);
for (int row = 0; row < pixelBuffer.height; ++row) {
int line = scopeBuffer.width * scopeBuffer.line;
System.arraycopy(pixelBuffer.pixels, row * pixelBuffer.width, scopeBuffer.pixels, line, pixelBuffer.width);
Arrays.fill(scopeBuffer.pixels, line + pixelBuffer.width, line + scopeBuffer.width, 0);
System.arraycopy(scopeBuffer.pixels, line, scopeBuffer.pixels, scopeBuffer.width * (scopeBuffer.line + scopeBuffer.height / 2), scopeBuffer.width);
System.arraycopy(pixelBuffer.pixels, row * pixelBuffer.width, scopeBuffer.pixels, line, width);
Arrays.fill(scopeBuffer.pixels, line + width, line + scopeBuffer.width, 0);
System.arraycopy(scopeBuffer.pixels, line, scopeBuffer.pixels, scopeBuffer.width * (scopeBuffer.line + scopeBuffer.height / 2), width);
scopeBuffer.line = (scopeBuffer.line + 1) % (scopeBuffer.height / 2);
}
}
Expand Down Expand Up @@ -207,7 +208,7 @@ private void copyLines(boolean okay) {
finish = imageBuffer.line == imageBuffer.height;
}
int scale = scopeBuffer.width / pixelBuffer.width;
if (scale == 1)
if (scale <= 1)
copyUnscaled();
else
copyScaled(scale);
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/xdsopl/robot36/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ protected void onCreate(Bundle state) {
scopeBuffer = new PixelBuffer(640, 2 * 1280);
freqPlotBuffer = new PixelBuffer(256, 2 * 256);
peakMeterBuffer = new PixelBuffer(1, 16);
imageBuffer = new PixelBuffer(640, 616);
imageBuffer = new PixelBuffer(800, 616);
createScope(config);
createFreqPlot(config);
createPeakMeter();
Expand Down

0 comments on commit 28ebde8

Please sign in to comment.