Meritve na terenu
This commit is contained in:
+5
-5
@@ -12,7 +12,7 @@ FFT_SIZE = 1024
|
|||||||
BIN_COUNT = FFT_SIZE // 2 # 512 Bins
|
BIN_COUNT = FFT_SIZE // 2 # 512 Bins
|
||||||
DISPLAY_BINS = 100 # Only display first 100 bins
|
DISPLAY_BINS = 100 # Only display first 100 bins
|
||||||
SWEEP_SIZE = 2
|
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
|
WATERFALL_HISTORY = 100 # Number of frames to display in waterfall
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -50,15 +50,15 @@ def update(frame):
|
|||||||
raw_data = ser.read(BYTES_PER_FRAME)
|
raw_data = ser.read(BYTES_PER_FRAME)
|
||||||
|
|
||||||
try:
|
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
|
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)
|
bar_plot.set_xdata(x_dist_display)
|
||||||
ax1.set_xlim(x_dist_display[2], x_dist_display[-1]) # Skip DC
|
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
|
fft_data_display = fft_data[:DISPLAY_BINS] # Only use first 100 bins
|
||||||
|
|
||||||
# Update FFT plot
|
# Update FFT plot
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
|
|
||||||
// --- TABELA ---
|
// --- TABELA ---
|
||||||
const uint16_t FM_FREQ=2; // 30 preletov/sekundo
|
const uint16_t FM_FREQ=2;
|
||||||
const uint16_t FM_SAMPLES=4096; // 12 bitov
|
const uint16_t FM_SAMPLES=4096; // 12 bitov
|
||||||
uint16_t FM_table_pos[FM_SAMPLES];
|
uint16_t FM_table_pos[FM_SAMPLES];
|
||||||
uint16_t FM_table_neg[FM_SAMPLES];
|
uint16_t FM_table_neg[FM_SAMPLES];
|
||||||
@@ -30,6 +30,7 @@ void setup() {
|
|||||||
// 1. Postavimo serijsko komunikacijo
|
// 1. Postavimo serijsko komunikacijo
|
||||||
SerialUSB.begin(115200);
|
SerialUSB.begin(115200);
|
||||||
while (!SerialUSB); // Počakaj na povezavo z računalnikom
|
while (!SerialUSB); // Počakaj na povezavo z računalnikom
|
||||||
|
delay(5000);
|
||||||
|
|
||||||
// 2. Poračunamo wavetable za FM signal
|
// 2. Poračunamo wavetable za FM signal
|
||||||
for (uint16_t i=0; i<FM_SAMPLES; i++) {
|
for (uint16_t i=0; i<FM_SAMPLES; i++) {
|
||||||
@@ -157,7 +158,6 @@ void loop() {
|
|||||||
|
|
||||||
// --- KORAK 4: POŠILJANJE PODATKOV ---
|
// --- KORAK 4: POŠILJANJE PODATKOV ---
|
||||||
// Pošljemo samo prvo polovico spektra (SAMPLES / 2)
|
// 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));
|
SerialUSB.write((uint8_t*)vReal, (SAMPLES / 2) * sizeof(float));
|
||||||
// Ponastavi zastavico
|
// Ponastavi zastavico
|
||||||
if (bufferA_Ready) bufferA_Ready = false;
|
if (bufferA_Ready) bufferA_Ready = false;
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 108 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 111 KiB |
Reference in New Issue
Block a user