java.lang.Object
pl.polsl.rtsa.controller.Autoscaler
Automatic Y-axis scaler for the oscilloscope and FFT views.
Analyses the current signal data and returns visible min/max values with a configurable padding margin so the waveform never touches the canvas edges.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final doublePadding percentage to add above/below the signal (0.1 = 10%). -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
PADDING_FACTOR
private static final double PADDING_FACTORPadding percentage to add above/below the signal (0.1 = 10%).- See Also:
-
-
Constructor Details
-
Autoscaler
public Autoscaler()
-
-
Method Details
-
scaleTime
public double[] scaleTime(double[] samples) Computes a padded voltage range for the time-domain display.- Parameters:
samples- voltage samples (V)- Returns:
- double[2] = { vMin, vMax } with 0.1 padding applied; defaults to [0.0, 5.0] when data is insufficient
-
scaleFFT
public double scaleFFT(double[] fft) Computes a padded magnitude ceiling for the FFT display.- Parameters:
fft- FFT magnitude bins- Returns:
- maximum magnitude multiplied by (1 + 0.1); defaults to 1.0 when data is insufficient
-