Small refactoring

This commit is contained in:
Marek Ossowski 2025-08-16 22:35:36 +02:00
parent 638484ae78
commit 36eece717b
6 changed files with 19 additions and 14 deletions

View file

@ -354,6 +354,12 @@ public class Decoder {
return true;
}
/**
* @param freqOffs offsets from expected sync frequency
* @param pulses positions of sync pulses
* @param lines lengths of scan lines
* @param index position of latest sync pulse
*/
private boolean processSyncPulse(ArrayList<Mode> modes, float[] freqOffs, int[] pulses, int[] lines, int index) {
for (int i = 1; i < pulses.length; ++i)
pulses[i - 1] = pulses[i];

View file

@ -2,19 +2,20 @@ package xdsopl.robot36;
import android.graphics.Color;
/**
* HF Fax, IOC 576, 120 lines per minute
*/
public class HFFax extends BaseMode {
private final ExponentialMovingAverage lowPassFilter;
private final String name;
private final int sr;
private final int sampleRate;
private final float[] cumulated;
private int horizontalShift = 0;
HFFax(String name, int sampleRate) {
this.name = name;
lowPassFilter = new ExponentialMovingAverage();
this.sr = sampleRate;
this.sampleRate = sampleRate;
cumulated = new float[getWidth()];
}
@ -54,7 +55,7 @@ public class HFFax extends BaseMode {
@Override
public int getScanLineSamples() {
return sr / 2;
return sampleRate / 2;
}
@Override

View file

@ -631,7 +631,7 @@ public class MainActivity extends AppCompatActivity {
return true;
}
if (id == R.id.action_force_hffax_mode) {
setMode("HF Fax");
setMode(R.string.hf_fax);
return true;
}
if (id == R.id.action_force_robot36_color) {

View file

@ -33,7 +33,7 @@ public interface Mode {
int getBegin();
/**
* @return number of samples from start of scanline to sync pulse??? nonzero for Scottie only?
* @return number of samples from start of first scanline to first sync pulse?, nonzero for Scottie
*/
int getFirstSyncPulseIndex();
@ -56,7 +56,7 @@ public interface Mode {
* @param pixelBuffer buffer to store decoded pixels
* @param scratchBuffer buffer for temporary data
* @param scanLineBuffer raw samples to be decoded, can contain more than one scanline
* @param scopeBufferWidth ??? used in RawDecoder, initializes width?
* @param scopeBufferWidth used in RawDecoder, initializes width?
* @param syncPulseIndex number of samples from array start to sync pulse
* @param scanLineSamples number of samples per scanline
* @param frequencyOffset correction of frequency of expected vs actual sync pulse (normalized to range (-1, 1))

View file

@ -97,16 +97,14 @@
android:title="@string/wraase_sc2_180" />
</menu>
</item>
<item
android:id="@+id/action_force_hffax_mode"
android:title="@string/hf_fax" />
<item
android:id="@+id/action_force_raw_mode"
android:icon="@drawable/baseline_image_not_supported_24"
android:title="@string/raw_mode"
app:iconTint="@color/tint" />
<item
android:id="@+id/action_force_hffax_mode"
android:icon="@drawable/baseline_image_not_supported_24"
android:title="@string/hffax_mode"
app:iconTint="@color/tint" />
<item
android:id="@+id/action_auto_mode"
android:icon="@drawable/baseline_auto_mode_24"

View file

@ -21,6 +21,7 @@
<string name="scottie2" translatable="false">Scottie 2</string>
<string name="scottie_dx" translatable="false">Scottie DX</string>
<string name="wraase_sc2_180" translatable="false">Wraase SC2180</string>
<string name="hf_fax" translatable="false">HF Fax</string>
<string name="rate_8000" translatable="false">8 kHz</string>
<string name="rate_16000" translatable="false">16 kHz</string>
<string name="rate_32000" translatable="false">32 kHz</string>
@ -44,7 +45,6 @@
<string name="auto_mode">Auto Mode</string>
<string name="lock_mode">Lock Mode</string>
<string name="raw_mode">Raw Mode</string>
<string name="hffax_mode">HF Fax Mode</string>
<string name="listening">Listening</string>
<string name="audio_settings">Audio Settings</string>
<string name="sample_rate">Sample Rate</string>