Meritve na terenu

This commit is contained in:
2026-01-25 11:57:17 +01:00
parent 97728bd829
commit b01565628e
4 changed files with 7 additions and 7 deletions
+5 -5
View File
@@ -12,7 +12,7 @@ FFT_SIZE = 1024
BIN_COUNT = FFT_SIZE // 2 # 512 Bins
DISPLAY_BINS = 100 # Only display first 100 bins
SWEEP_SIZE = 2
BYTES_PER_FRAME = BIN_COUNT * 4 + SWEEP_SIZE
BYTES_PER_FRAME = BIN_COUNT * 4
WATERFALL_HISTORY = 100 # Number of frames to display in waterfall
try:
@@ -50,15 +50,15 @@ def update(frame):
raw_data = ser.read(BYTES_PER_FRAME)
try:
fm_sweep = struct.unpack(f'H', raw_data[:2])
fm_sweep = [2]
x_dist = np.linspace(0, 1024*3e8/100e6/fm_sweep[0], BIN_COUNT)
x_dist = np.linspace(0, 1024*3e8/100e6/2, BIN_COUNT)
x_dist_display = x_dist[:DISPLAY_BINS] # Only first 100 bins
ax1.set_title(f'FFT prikaz radarskega signala FM={fm_sweep[0]}')
ax1.set_title(f'FFT prikaz radarskega signala FM={2}')
bar_plot.set_xdata(x_dist_display)
ax1.set_xlim(x_dist_display[2], x_dist_display[-1]) # Skip DC
fft_data = struct.unpack(f'{BIN_COUNT}f', raw_data[2:])
fft_data = struct.unpack(f'{BIN_COUNT}f', raw_data[:])
fft_data_display = fft_data[:DISPLAY_BINS] # Only use first 100 bins
# Update FFT plot
+2 -2
View File
@@ -9,7 +9,7 @@
// --- TABELA ---
const uint16_t FM_FREQ=2; // 30 preletov/sekundo
const uint16_t FM_FREQ=2;
const uint16_t FM_SAMPLES=4096; // 12 bitov
uint16_t FM_table_pos[FM_SAMPLES];
uint16_t FM_table_neg[FM_SAMPLES];
@@ -30,6 +30,7 @@ void setup() {
// 1. Postavimo serijsko komunikacijo
SerialUSB.begin(115200);
while (!SerialUSB); // Počakaj na povezavo z računalnikom
delay(5000);
// 2. Poračunamo wavetable za FM signal
for (uint16_t i=0; i<FM_SAMPLES; i++) {
@@ -157,7 +158,6 @@ void loop() {
// --- KORAK 4: POŠILJANJE PODATKOV ---
// Pošljemo samo prvo polovico spektra (SAMPLES / 2)
SerialUSB.write((uint8_t*) &FM_FREQ, sizeof(uint16_t));
SerialUSB.write((uint8_t*)vReal, (SAMPLES / 2) * sizeof(float));
// Ponastavi zastavico
if (bufferA_Ready) bufferA_Ready = false;
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB