mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-23 22:39:22 -05:00
Frequency manager lists
Scanner approximately 6.3% less buggy with wide ranges
This commit is contained in:
parent
e2f0a03460
commit
61be221432
@ -23,7 +23,6 @@
|
||||
// Color bitmaps generated with:
|
||||
// Gimp image > indexed colors (16), then "xxd -i *.bmp"
|
||||
|
||||
//BUG: SCANNER Mirroring in proc_wideband...
|
||||
//BUG: SCANNER Lock on frequency, if frequency jump, still locked on first one
|
||||
//BUG: SCANNER Multiple slices
|
||||
//BUG: REPLAY freezes when SD card not present
|
||||
|
@ -60,7 +60,7 @@ ScannerView::~ScannerView() {
|
||||
void ScannerView::do_detection() {
|
||||
uint8_t power_max = 0;
|
||||
int32_t bin_max = -1;
|
||||
uint32_t bin_max_pixel = 0;
|
||||
uint32_t slice_max = 0;
|
||||
uint32_t snap_value;
|
||||
uint8_t power;
|
||||
rtc::RTC datetime;
|
||||
@ -87,20 +87,20 @@ void ScannerView::do_detection() {
|
||||
|
||||
if ((power >= mean_power + power_threshold) && (power > power_max)) {
|
||||
power_max = power;
|
||||
bin_max = slices[slice].max_index + (slice * SCAN_BIN_NB);
|
||||
bin_max_pixel = bin_max / slices_nb;
|
||||
bin_max = slices[slice].max_index;
|
||||
slice_max = slice;
|
||||
}
|
||||
}
|
||||
|
||||
// Lock / release
|
||||
if ((bin_max >= last_bin - 2) && (bin_max <= last_bin + 2) && (bin_max > -1)) {
|
||||
if ((bin_max >= last_bin - 2) && (bin_max <= last_bin + 2) && (bin_max > -1) && (slice_max == last_slice)) {
|
||||
|
||||
// Staying around the same bin
|
||||
if (detect_timer >= DETECT_DELAY) {
|
||||
if ((bin_max != locked_bin) || (!locked)) {
|
||||
|
||||
if (!locked) {
|
||||
resolved_frequency = slices[slice_counter].center_frequency + (SCAN_BIN_WIDTH * (bin_max - 120));
|
||||
resolved_frequency = slices[slice_max].center_frequency + (SCAN_BIN_WIDTH * (bin_max - 128));
|
||||
|
||||
if (check_snap.value()) {
|
||||
snap_value = options_snap.selected_index_value();
|
||||
@ -138,7 +138,8 @@ void ScannerView::do_detection() {
|
||||
else if (options_goto.selected_index() == 2)
|
||||
nav_.push<POCSAGAppView>();
|
||||
*/
|
||||
}
|
||||
} else
|
||||
text_infos.set("Out of range");
|
||||
}
|
||||
|
||||
big_display.set(resolved_frequency);
|
||||
@ -162,22 +163,19 @@ void ScannerView::do_detection() {
|
||||
}
|
||||
|
||||
last_bin = bin_max;
|
||||
last_slice = slice_max;
|
||||
scan_counter++;
|
||||
|
||||
// Refresh red tick
|
||||
portapack::display.fill_rectangle({last_tick_pos, 90, 1, 6}, Color::black());
|
||||
if (bin_max > -1) {
|
||||
//if (bin_max_pixel < 120)
|
||||
// bin_max_pixel += 2;
|
||||
//else
|
||||
// bin_max_pixel -= 0;
|
||||
last_tick_pos = (Coord)bin_max_pixel;
|
||||
last_tick_pos = (Coord)(bin_max / slices_nb);
|
||||
portapack::display.fill_rectangle({last_tick_pos, 90, 1, 6}, Color::red());
|
||||
}
|
||||
}
|
||||
|
||||
void ScannerView::add_spectrum_pixel(Color color) {
|
||||
// Is avoiding floats really needed ?
|
||||
// Is avoiding floats really necessary ?
|
||||
bin_skip_acc += bin_skip_frac;
|
||||
if (bin_skip_acc < 0x10000)
|
||||
return;
|
||||
@ -196,26 +194,26 @@ void ScannerView::on_channel_spectrum(const ChannelSpectrum& spectrum) {
|
||||
|
||||
baseband::spectrum_streaming_stop();
|
||||
|
||||
// Add pixels to spectrum row, and find max power for this slice
|
||||
// Add pixels to spectrum display and find max power for this slice
|
||||
// Center 12 bins are ignored (DC spike is blanked)
|
||||
// Leftmost and rightmost 2 bins are ignored
|
||||
// Center 12 bins are ignored
|
||||
// 256-2-2-12 = 240 bins used
|
||||
for (bin = 0; bin < 120; bin++) {
|
||||
add_spectrum_pixel(spectrum_rgb3_lut[spectrum.db[134 + bin]]); // 134~253 goes in 0~119
|
||||
power = spectrum.db[134 + bin];
|
||||
mean_acc += power;
|
||||
if (power > max_power) {
|
||||
max_power = power;
|
||||
max_bin = bin - 2; // To check
|
||||
for (bin = 0; bin < 256; bin++) {
|
||||
|
||||
if ((bin < 2) || (bin > 253) || ((bin >= 122) && (bin < 134))) {
|
||||
power = 0;
|
||||
} else {
|
||||
if (bin < 128)
|
||||
power = spectrum.db[128 + bin];
|
||||
else
|
||||
power = spectrum.db[bin - 128];
|
||||
}
|
||||
}
|
||||
for (bin = 120; bin < 240; bin++) {
|
||||
add_spectrum_pixel(spectrum_rgb3_lut[spectrum.db[bin - 118]]); // 2~121 goes in 120~239
|
||||
power = spectrum.db[bin - 118];
|
||||
|
||||
add_spectrum_pixel(spectrum_rgb3_lut[power]);
|
||||
|
||||
mean_acc += power;
|
||||
if (power > max_power) {
|
||||
max_power = power;
|
||||
max_bin = bin + 2; // To check
|
||||
max_bin = bin;
|
||||
}
|
||||
}
|
||||
|
||||
@ -224,12 +222,13 @@ void ScannerView::on_channel_spectrum(const ChannelSpectrum& spectrum) {
|
||||
|
||||
if (slices_nb > 1) {
|
||||
// Slice sequence
|
||||
slice_counter++;
|
||||
if (slice_counter >= slices_nb) {
|
||||
do_detection();
|
||||
slice_counter = 0;
|
||||
}
|
||||
} else
|
||||
slice_counter++;
|
||||
receiver_model.set_tuning_frequency(slices[slice_counter].center_frequency);
|
||||
baseband::set_spectrum(SCAN_SLICE_WIDTH, 31); // Clear
|
||||
} else {
|
||||
// Unique slice
|
||||
do_detection();
|
||||
@ -263,7 +262,7 @@ void ScannerView::on_range_changed() {
|
||||
text_slices.set("!!");
|
||||
slices_nb = 32;
|
||||
} else {
|
||||
text_slices.set(to_string_dec_uint(slices_nb));
|
||||
text_slices.set(to_string_dec_uint(slices_nb, 2, ' '));
|
||||
}
|
||||
// slices_span = 6 * 2.5M = 15M
|
||||
slices_span = slices_nb * SCAN_SLICE_WIDTH;
|
||||
@ -284,7 +283,7 @@ void ScannerView::on_range_changed() {
|
||||
text_slices.set(" 1");
|
||||
}
|
||||
|
||||
bin_skip_frac = 0x10000 / slices_nb;
|
||||
bin_skip_frac = 0xF000 / slices_nb;
|
||||
|
||||
slice_counter = 0;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@
|
||||
namespace ui {
|
||||
|
||||
#define SCAN_SLICE_WIDTH 2500000 // Scan slice bandwidth
|
||||
#define SCAN_BIN_NB 256 // FFT power bins (skip 4 at center, 2*6 on sides)
|
||||
#define SCAN_BIN_NB 256 // FFT power bins
|
||||
#define SCAN_BIN_NB_NO_DC (SCAN_BIN_NB - 16) // Bins after trimming
|
||||
#define SCAN_BIN_WIDTH (SCAN_SLICE_WIDTH / SCAN_BIN_NB)
|
||||
|
||||
@ -126,6 +126,7 @@ private:
|
||||
uint8_t slices_nb { 0 };
|
||||
uint8_t slice_counter { 0 };
|
||||
int16_t last_bin { 0 };
|
||||
uint32_t last_slice { 0 };
|
||||
Coord last_tick_pos { 0 };
|
||||
rf::Frequency scan_span { 0 }, resolved_frequency { 0 };
|
||||
uint16_t locked_bin { 0 };
|
||||
|
@ -74,6 +74,7 @@ void WidebandSpectrum::on_message(const Message* const msg) {
|
||||
baseband_fs = message.sampling_rate;
|
||||
trigger = message.trigger;
|
||||
baseband_thread.set_sampling_rate(baseband_fs);
|
||||
phase = 0;
|
||||
configured = true;
|
||||
break;
|
||||
|
||||
|
8
sdcard/FREQMAN/DMR.TXT
Normal file
8
sdcard/FREQMAN/DMR.TXT
Normal file
@ -0,0 +1,8 @@
|
||||
f=446106250,d=DMR T1 CH1
|
||||
f=446118750,d=DMR T1 CH2
|
||||
f=446131250,d=DMR T1 CH3
|
||||
f=446143750,d=DMR T1 CH4
|
||||
f=446156250,d=DMR T1 CH5
|
||||
f=446168750,d=DMR T1 CH6
|
||||
f=446181250,d=DMR T1 CH7
|
||||
f=446193750,d=DMR T1 CH8
|
8
sdcard/FREQMAN/GMRS.TXT
Normal file
8
sdcard/FREQMAN/GMRS.TXT
Normal file
@ -0,0 +1,8 @@
|
||||
f=462550000,d=GMRS CH1/15 OUT
|
||||
f=462575000,d=GMRS CH2/16 OUT
|
||||
f=462600000,d=GMRS CH3/17 OUT
|
||||
f=462625000,d=GMRS CH4/18 OUT
|
||||
f=462650000,d=GMRS CH5/19 OUT
|
||||
f=462675000,d=GMRS CH6/20 OUT
|
||||
f=462700000,d=GMRS CH7/21 OUT
|
||||
f=462725000,d=GMRS CH8/22 OUT
|
8
sdcard/FREQMAN/KDR444.TXT
Normal file
8
sdcard/FREQMAN/KDR444.TXT
Normal file
@ -0,0 +1,8 @@
|
||||
f=444600000,d=KDR444 CH1
|
||||
f=444650000,d=KDR444 CH2
|
||||
f=444800000,d=KDR444 CH3
|
||||
f=444825000,d=KDR444 CH4
|
||||
f=444850000,d=KDR444 CH5
|
||||
f=444875000,d=KDR444 CH6
|
||||
f=444925000,d=KDR444 CH7
|
||||
f=444975000,d=KDR444 CH8
|
69
sdcard/FREQMAN/LPD433.TXT
Normal file
69
sdcard/FREQMAN/LPD433.TXT
Normal file
@ -0,0 +1,69 @@
|
||||
f=433075000,d=LPD433 CH1
|
||||
f=433100000,d=LPD433 CH2
|
||||
f=433125000,d=LPD433 CH3
|
||||
f=433150000,d=LPD433 CH4
|
||||
f=433175000,d=LPD433 CH5
|
||||
f=433200000,d=LPD433 CH6
|
||||
f=433225000,d=LPD433 CH7
|
||||
f=433250000,d=LPD433 CH8
|
||||
f=433275000,d=LPD433 CH9
|
||||
f=433300000,d=LPD433 CH10
|
||||
f=433325000,d=LPD433 CH11
|
||||
f=433350000,d=LPD433 CH12
|
||||
f=433375000,d=LPD433 CH13
|
||||
f=433400000,d=LPD433 CH14
|
||||
f=433425000,d=LPD433 CH15
|
||||
f=433450000,d=LPD433 CH16
|
||||
f=433475000,d=LPD433 CH17
|
||||
f=433500000,d=LPD433 CH18
|
||||
f=433525000,d=LPD433 CH19
|
||||
f=433550000,d=LPD433 CH20
|
||||
f=433575000,d=LPD433 CH21
|
||||
f=433600000,d=LPD433 CH22
|
||||
f=433625000,d=LPD433 CH23
|
||||
f=433650000,d=LPD433 CH24
|
||||
f=433675000,d=LPD433 CH25
|
||||
f=433700000,d=LPD433 CH26
|
||||
f=433725000,d=LPD433 CH27
|
||||
f=433750000,d=LPD433 CH28
|
||||
f=433775000,d=LPD433 CH29
|
||||
f=433800000,d=LPD433 CH30
|
||||
f=433825000,d=LPD433 CH31
|
||||
f=433850000,d=LPD433 CH32
|
||||
f=433875000,d=LPD433 CH33
|
||||
f=433900000,d=LPD433 CH34
|
||||
f=433925000,d=LPD433 CH35
|
||||
f=433950000,d=LPD433 CH36
|
||||
f=433975000,d=LPD433 CH37
|
||||
f=434000000,d=LPD433 CH38
|
||||
f=434025000,d=LPD433 CH39
|
||||
f=434050000,d=LPD433 CH40
|
||||
f=434075000,d=LPD433 CH41
|
||||
f=434100000,d=LPD433 CH42
|
||||
f=434125000,d=LPD433 CH43
|
||||
f=434150000,d=LPD433 CH44
|
||||
f=434175000,d=LPD433 CH45
|
||||
f=434200000,d=LPD433 CH46
|
||||
f=434225000,d=LPD433 CH47
|
||||
f=434250000,d=LPD433 CH48
|
||||
f=434275000,d=LPD433 CH49
|
||||
f=434300000,d=LPD433 CH50
|
||||
f=434325000,d=LPD433 CH51
|
||||
f=434350000,d=LPD433 CH52
|
||||
f=434375000,d=LPD433 CH53
|
||||
f=434400000,d=LPD433 CH54
|
||||
f=434425000,d=LPD433 CH55
|
||||
f=434450000,d=LPD433 CH56
|
||||
f=434475000,d=LPD433 CH57
|
||||
f=434500000,d=LPD433 CH58
|
||||
f=434525000,d=LPD433 CH59
|
||||
f=434550000,d=LPD433 CH60
|
||||
f=434575000,d=LPD433 CH61
|
||||
f=434600000,d=LPD433 CH62
|
||||
f=434625000,d=LPD433 CH63
|
||||
f=434650000,d=LPD433 CH64
|
||||
f=434675000,d=LPD433 CH65
|
||||
f=434700000,d=LPD433 CH66
|
||||
f=434725000,d=LPD433 CH67
|
||||
f=434750000,d=LPD433 CH68
|
||||
f=434775000,d=LPD433 CH69
|
5
sdcard/FREQMAN/MURS.TXT
Normal file
5
sdcard/FREQMAN/MURS.TXT
Normal file
@ -0,0 +1,5 @@
|
||||
f=151820000,d=MURS CH1
|
||||
f=151880000,d=MURS CH2
|
||||
f=151940000,d=MURS CH3
|
||||
f=154570000,d=MURS CH4
|
||||
f=154600000,d=MURS CH5
|
24
sdcard/FREQMAN/PMR446.TXT
Normal file
24
sdcard/FREQMAN/PMR446.TXT
Normal file
@ -0,0 +1,24 @@
|
||||
f=446006250,d=PMR CH1
|
||||
f=446018750,d=PMR CH2
|
||||
f=446031250,d=PMR CH3
|
||||
f=446043750,d=PMR CH4
|
||||
f=446056250,d=PMR CH5
|
||||
f=446068750,d=PMR CH6
|
||||
f=446081250,d=PMR CH7
|
||||
f=446093750,d=PMR CH8
|
||||
f=446103125,d=dPMR CH1
|
||||
f=446109375,d=dPMR CH2
|
||||
f=446115625,d=dPMR CH3
|
||||
f=446121875,d=dPMR CH4
|
||||
f=446128125,d=dPMR CH5
|
||||
f=446134375,d=dPMR CH6
|
||||
f=446140625,d=dPMR CH7
|
||||
f=446146875,d=dPMR CH8
|
||||
f=446153125,d=dPMR CH9
|
||||
f=446159375,d=dPMR CH10
|
||||
f=446165625,d=dPMR CH11
|
||||
f=446171875,d=dPMR CH12
|
||||
f=446178125,d=dPMR CH13
|
||||
f=446184375,d=dPMR CH14
|
||||
f=446190625,d=dPMR CH15
|
||||
f=446196875,d=dPMR CH16
|
Loading…
Reference in New Issue
Block a user