Compare commits

...

82 Commits

Author SHA1 Message Date
Erwin Ried 4f9e8e9642 Update README.md 2023-01-25 15:34:09 +01:00
Erwin Ried de53626a46 Update README.md 2023-01-25 15:33:00 +01:00
Erwin Ried 2cf6849985 Update README.md 2023-01-25 15:16:03 +01:00
Erwin Ried 1cde3ab189 Update README.md 2023-01-25 15:12:21 +01:00
Erwin Ried bdb70a3231 Update README.md 2023-01-25 15:04:43 +01:00
Erwin Ried 49e63e2728 Update README.md 2023-01-25 14:36:18 +01:00
Erwin Ried 1beca57e56 Update README.md 2023-01-25 14:33:27 +01:00
Erwin Ried 27632825a3 Update contributors list 2023-01-25 14:14:12 +01:00
gullradriel e02e58b366 Merge pull request #789 from formtapez/settings
Save and recall all receiver settings of the Audio RX app
2023-01-21 13:04:52 +01:00
formtapez 37912df085 tabs vs spaces 2023-01-21 11:46:43 +01:00
formtapez a20a08c630 save/recall all receiver settings 2023-01-21 11:36:06 +01:00
formtapez a8885282cd save and recall stepsize 2023-01-20 22:21:59 +01:00
gullradriel 2d9090862b Merge pull request #782 from Brumi-2021/adding_Vertical_rate_field_ADSB_TX
Added Vertical rate field ADSB-TX
2023-01-05 09:59:00 +01:00
Brumi-2021 6e5bb7911c Added Vertical rate field ADSB-TX 2023-01-05 00:14:11 +01:00
Brumi-2021 46f98ddc8b Merge pull request #780 from Brumi-2021/Correcting_complementary_Bearing_Compas_Hdg_angle_ADSB-TX_App_final
Solving correct  Bearing Angle in ADSB TX app
2023-01-01 23:15:52 +01:00
Brumi-2021 2902365b80 Solving correct Bearing Angle in ADSB TX app 2023-01-01 23:23:06 +01:00
Brumi-2021 c0f368c978 Merge pull request #775 from Brumi-2021/Small_BW_Label_error_correction_Scanner_App
Scanner BW label corrections
2022-12-29 23:23:41 +01:00
Brumi-2021 75c2b69f19 Scanner BW label corrections 2022-12-30 00:38:54 +01:00
Brumi-2021 3291c7e2a0 Merge pull request #774 from Brumi-2021/Minor_ADSB_Compas_sinf32_array_value_correction_and_comments
Minor sin_f32_table correction and comments
2022-12-29 22:24:28 +01:00
Brumi-2021 64ca9f6a68 Minor sin_f32_table correction and comments 2022-12-29 23:27:15 +01:00
gullradriel 297063873f Merge pull request #767 from rusty-labs/scanner-manual-mode-unlimited-range
#765 Scanner app, unlimited range for manual mode
2022-12-29 17:41:00 +01:00
jLynx 2a38f386ab Update version.txt 2022-12-29 15:35:54 +13:00
jLynx 079a0506a4 Update past_version.txt 2022-12-29 15:35:45 +13:00
Brumi-2021 e8ad86cc94 Merge pull request #768 from rusty-labs/sin_function_180_fix
#755 fix, sin_f32 fails at 180
2022-12-28 16:34:38 +01:00
rusty.labs e69c9bbc7b #755 fix, sin_f32 fails at 180
#755 fix, sin_f32 returns incorrect result at 180 degrees, clean up
2022-12-28 01:13:42 -05:00
rusty.labs 1f7b800c2a #765 unlimited range for manual mode
* fix for #765, manual mode has unlimited range now
* speedup for button_add.on_select (roughly x70 times faster)
* fix for random freezes while switching to Audio
2022-12-26 17:18:30 -05:00
Brumi-2021 25c267a3d9 Merge pull request #744 from strijar/spectrum_color
New spectrum color scheme Look at table (LUT) for the Waterfall FFT .
2022-12-17 16:02:54 +01:00
gullradriel efbcd2aa9b Merge pull request #752 from lujji/fix-ook-bug
Fix OOK repeat bug
2022-12-17 12:44:19 +01:00
gullradriel f32b55f66f Merge pull request #754 from lujji/ook-scan
Implement OOK scan
2022-12-17 12:43:34 +01:00
gullradriel e9adc32421 Merge pull request #757 from gullradriel/next
Updated submodules
2022-12-14 22:18:43 +01:00
GullCode a120a6344d Updated submodules 2022-12-14 22:17:25 +01:00
lujji e3cea4c68b minor ui fix 2022-12-05 22:12:46 +02:00
lujji 0631f5d5ab implement ook scan 2022-12-05 16:51:23 +02:00
lujji 8986b65f94 fix ook repeat bug 2022-11-30 10:59:24 +02:00
gullradriel 7f64606fb2 Merge pull request #750 from gullradriel/recon-delete-retune-fix
Retune after delete fix
2022-11-20 20:14:47 +01:00
GullCode 7bfb54eee9 better order of events 2022-11-20 19:53:03 +01:00
GullCode e0c1f7b45e Retune after delete fix 2022-11-20 19:46:01 +01:00
gullradriel 734f315266 Merge pull request #749 from gullradriel/updating-am-mode
Added/Renamed AM bandwidth modes
2022-11-20 18:36:43 +01:00
GullCode 7f6aebbe53 Fixed typos 2022-11-20 18:29:20 +01:00
GullCode 5f62926af3 Fixed typo 2022-11-20 18:02:54 +01:00
GullCode 17f6475506 Added/Renamed AM bandwidth modes 2022-11-20 17:44:11 +01:00
Jimi Sanchez 17d3cb387e Merge pull request #747 from Brumi-2021/“Additional_AM_BW_type_9Khz_on_top_current_6Khz”
“additional am bw type 9 khz on top current 6 khz”
2022-11-19 17:04:19 -05:00
Brumi-2021 1e4c93b979 Final opt. AM-9K, applied to Audio_RX and Mic App. 2022-11-19 18:17:54 +01:00
Brumi-2021 25dfa96257 Adding FIR_taps for EU AM broadcasting 9K00A3E 2022-11-14 00:32:29 +01:00
Erwin Ried 400cccdcc1 Contributors gridview 2022-11-10 09:41:20 +01:00
Belousov Oleg f59437cf71 New spectrum color scheme 2022-11-10 02:17:04 +03:00
GullCode 5577ec82ed Merge pull request #729 from BehleZebub/patch-1
Update generate_world_map.bin.py
2022-11-02 17:54:42 +01:00
GullCode da98e7739e Update generate_world_map.bin.py
Formatting text
2022-11-02 17:21:56 +01:00
GullCode b5b5bf42af Merge pull request #737 from BehleZebub/next
update for python scripts so no python2.7 is needed
2022-11-02 17:14:53 +01:00
BehleZebub 587fbfbbb1 added shebang line for pyhton3 on unix 2022-11-02 00:36:04 +01:00
GullCode c54e382db2 Merge pull request #739 from lujji/next
Add gain and amplifier controls in Jammer
2022-11-01 12:00:55 +01:00
lujji 22de89c879 added gain and amp controls 2022-11-01 06:42:55 +02:00
GullCode aa778e5797 Merge pull request #738 from Brumi-2021/Extending_previous_ghost_signal_interference_c/m_in_all_RX_after_using_Replay_App
(MINOR IMPROV Replay App) - Extending previous  "ghost interf. signal" c/m to Replay App
2022-10-30 20:15:24 +01:00
Brumi-2021 e8e98475e2 Extending "ghost interf. signal" c/m to Replay App 2022-10-30 19:23:52 +01:00
BehleZebub 95d1bca9fd changed from python2 to python3 2022-10-30 00:04:31 +02:00
BehleZebub 1a5c360efe changed from python2 to python3 2022-10-30 00:04:07 +02:00
BehleZebub 560c7143bf Update make_dcs.py 2022-10-30 00:03:07 +02:00
BehleZebub 6fc03a2651 changed from python2 to python3 2022-10-30 00:02:01 +02:00
BehleZebub f31ee1172d changed from python2 to python3 2022-10-30 00:00:55 +02:00
BehleZebub 996e648a64 changed from python2 to python3 2022-10-30 00:00:26 +02:00
BehleZebub ca4f68d24a changed from python2 to python3 2022-10-29 23:58:26 +02:00
GullCode 2c3f8e9b3d Merge pull request #734 from Brumi-2021/“Solving_correctg_RX_DSB-SC_Suppressed_Carrier”
Mic App: DSB RX distortion c/m + minor improv.
2022-10-29 21:31:50 +02:00
Brumi-2021 a591ba572f Mic App: DSB RX distortion c/m + minor improv. 2022-10-29 16:02:08 +02:00
BehleZebub c9657bc92b Update generate_world_map.bin.py
corrected typo in print();
2022-10-28 17:38:00 +02:00
BehleZebub b8d98e4f45 Update generate_world_map.bin.py
forced endianess on outfile.write() to little endian and closed outfile at the end
2022-10-22 23:42:40 +02:00
GullCode e0309b13e5 Merge pull request #728 from GullCode/fix-wfm-bw-label
Fix wfm bw label
2022-10-18 21:38:21 +02:00
GullCode c2117b2c5b cosmetic fix for bw display 2022-10-18 21:37:28 +02:00
GullCode 2b78f9e907 Correct WFM bw label to 200k 2022-10-18 21:36:22 +02:00
GullCode 6cd4eb0358 Correct WFM bandwidth and step 2022-10-18 21:26:14 +02:00
GullCode 8ec69d7c95 Merge pull request #727 from Brumi-2021/adding_in_RX_WFM_to_Mic_App
Add WFM mode in Mic App (in tx and rx)
2022-10-16 20:47:50 +02:00
Brumi-2021 efe8d82fae Add WFM mode in Mic App (in tx and rx) 2022-10-16 19:01:05 +02:00
GullCode 32697d1c73 Merge pull request #723 from GullCode/recon-freqman-steps-band-update
Recon freqman steps band update
2022-10-11 12:52:23 +02:00
GullCode 11558b9843 Merge pull request #722 from GullCode/scanner-freqman-update-max_files-steps
Scanner freqman update max files steps
2022-10-11 12:52:10 +02:00
GullCode e5d1308560 Added FM bands files 2022-10-11 12:49:32 +02:00
GullCode 62968e6009 Added default RECON.TXT file 2022-10-11 12:49:15 +02:00
GullCode a9b4abc07e Indenting some comments 2022-10-11 12:48:42 +02:00
GullCode 05f3793213 Added 30Khz steps and removed quoted code 2022-10-11 12:46:12 +02:00
GullCode ae8633c569 Use FREQMAN_MAX_PER_FILE instead of MAX_DB_ENTRY 2022-10-11 12:40:49 +02:00
GullCode 480f492740 Removed MAX_DB_ENTRY definition 2022-10-11 12:40:31 +02:00
GullCode dd2e23f901 Updated FREQMAN_MAX_PER_FILE value 2022-10-11 12:40:08 +02:00
GullCode 3ca57f634c Merge pull request #721 from eried/hackrf_update
Update hackrf
2022-10-11 12:10:26 +02:00
GullCode 29ac3192cb Update hackrf 2022-10-11 12:03:25 +02:00
47 changed files with 1127 additions and 828 deletions
+1 -1
View File
@@ -1 +1 @@
v1.5.3
v1.5.4
+1 -1
View File
@@ -1 +1 @@
v1.5.4
v1.6.0
+17 -22
View File
@@ -6,7 +6,7 @@ This is a fork of the [Havoc](https://github.com/furrtek/portapack-havoc/) firmw
[<img src="https://raw.githubusercontent.com/wiki/eried/portapack-mayhem/img/hw_overview_h2_front.png" height="400">](https://github.com/eried/portapack-mayhem/wiki/Hardware-overview) [<img src="https://raw.githubusercontent.com/wiki/eried/portapack-mayhem/img/hw_overview_h2_inside.png" height="400">](https://github.com/eried/portapack-mayhem/wiki/Hardware-overview#portapack-internals)
*[PortaPack H2+HackRF+battery](https://s.click.aliexpress.com/e/_9zbXMk) (clone) with a custom [3d printed case](https://github.com/eried/portapack-mayhem/wiki/H2-Enclosure)*
*[PortaPack H2+HackRF+battery](https://s.click.aliexpress.com/e/_DmU7GQX) (clone) with a custom [3d printed case](https://github.com/eried/portapack-mayhem/wiki/H2-Enclosure)*
# Quick overview
@@ -18,42 +18,40 @@ If you are new to *HackRF+PortaPack+Mayhem*, there is an awesome introductory vi
This repository expands upon the previous work by many people and aims to constantly add new features, bugfixes and generate documentation to make further development easier. [Collaboration](https://github.com/eried/portapack-mayhem/wiki/How-to-collaborate) is always welcomed and appreciated.
## Does it work on H1/H2 PortaPack?
## What to buy?
Yes, both devices are the [same](https://github.com/eried/portapack-mayhem/wiki/First-steps). The one I am using to test all changes is this [PortaPack H2+HackRF+battery](https://s.click.aliexpress.com/e/_9zbXMk), which is a kit that includes everything you need. Sadly, the people making the H2 never made the updated schematics available, which is not ideal (and goes against the terms of the license). Most members of the community are using a clone of the [PortaPack H1+HackRF+metal case](https://s.click.aliexpress.com/e/_dS6liw4), which does not include any battery functionality, but it is a cheaper alternative.
:heavy_check_mark: A recommended one is this [PortaPack H2](https://s.click.aliexpress.com/e/_DmU7GQX) pack, that includes everything you need. Sadly, the people making the H2 never made the updated schematics available (against the terms of the license).
To support the people behind the hardware, please buy a genuine [HackRF](https://greatscottgadgets.com/hackrf/) and [PortaPack](https://store.sharebrained.com/products/portapack-for-hackrf-one-kit).
:heavy_check_mark: Another popular option is the clone of the [PortaPack H1](https://s.click.aliexpress.com/e/_Dkbqs2X).
## Where is the latest firmware?
:warning: Be cautious , *ask* the seller about compatibility with the latest releases. Look out for the description of the item, if they provide the firmware files for an older version or they have custom setup instructions, this means it might be **NOT compatible**, for example:
The **latest (nightly) release** can be found [here](https://github.com/eried/portapack-mayhem/releases/).
![image](https://user-images.githubusercontent.com/1091420/214579017-9ad970b9-0917-48f6-a550-588226d3f89b.png)
The current **stable release** is on the [![GitHub release (latest by date)](https://img.shields.io/github/v/release/eried/portapack-mayhem?label=Releases&style=social)](https://github.com/eried/portapack-mayhem/releases/latest) page. Follow the instructions you can find in the release description.
:warning: If it looks **too different**, this might mean that they are using their own recipe, check the [different models](https://github.com/eried/portapack-mayhem/wiki/PortaPack-Versions) in our wiki. For example all the H3 and clones of that version use their own version of the firmware. They do not contribute the changes back and eventually you will be left with a device that nobody maintains:
## Is this the newest firmware for my PortaPack?
Most probably: **YES**. *If you find new features somewhere else, please [suggest](https://github.com/eried/portapack-mayhem/issues/new/choose) them*.
![image](https://user-images.githubusercontent.com/1091420/214581333-424900ee-26f8-4e96-be2f-69d8dc995ba9.png)
## Which one is actually the newest?
There is a lot of confusion of which is the latest version because no old version used any actual "version number". Additionally, since the files were distributed on facebook groups, github issue links and similar temporal sources, then there was no central location for them.
## Where is the latest version?
This fork (**Mayhem**) uses *major.minor.release* [semantic versioning](https://en.wikipedia.org/wiki/Software_versioning), so you can always compare your current version with the latest from [Releases](https://github.com/eried/portapack-mayhem/releases/latest).
## What about Havoc/GridRF/jamesshao8/jboone's?
* jboone's PortaPack: the [vanilla](https://en.wikipedia.org/wiki/Vanilla_software) experience
* Havoc: It was the most popular fork of jboone's PortaPack, currrently, it is not being maintained nor updated
* jamesshao8: He keeps his own version of the fork, while not attached as a fork to anything. Latest functions do not follow the license and are not being published with source code, so keep this in mind
* GridRF: They sell PortaPack clones with their own firmware based on a old version, which has no sourcecode available
The current **stable release** is on the [![GitHub release (latest by date)](https://img.shields.io/github/v/release/eried/portapack-mayhem?label=Releases&style=social)](https://github.com/eried/portapack-mayhem/releases/latest) page. Follow the instructions you can find in the release description. The **latest (nightly) release** can be found [here](https://github.com/eried/portapack-mayhem/releases/).
## How can I collaborate
You can write [documentation](https://github.com/eried/portapack-mayhem/wiki), fix bugs and [answer issues](https://github.com/eried/portapack-mayhem/issues) or add new functionality. Please check the following [guide](https://github.com/eried/portapack-mayhem/wiki/How-to-collaborate) with details.
Consider that the hardware and firmware has been created and maintain by a [lot](https://github.com/mossmann/hackrf/graphs/contributors) of [people](https://github.com/eried/portapack-mayhem/graphs/contributors), so always try colaborating your time and effort first. For coding related questions, if something does not fit as an issue, please join our Discord by clicking the chat badge on [top](#portapack-mayhem).
[![Contributors](https://contrib.rocks/image?repo=eried/portapack-mayhem)](https://github.com/eried/portapack-mayhem/graphs/contributors)
To support the people behind the hardware, please buy a genuine [HackRF](https://greatscottgadgets.com/hackrf/) and [PortaPack](https://store.sharebrained.com/products/portapack-for-hackrf-one-kit).
As a last option, if you want to send money directly to me for getting more boards, antennas and such:
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CBPQA4HRRPJQ6&source=url)
## What if I really want to pay for something?
## What if I really want something specific?
If what you need can be relevant in general, you can [request a feature](https://github.com/eried/portapack-mayhem/issues/new?labels=enhancement&template=feature_request.md).
You can create a bounty and invite people to your own bounty. This will incentivize coders to work on a new feature, solving a bug or even writting documentation. Start a bounty by [creating](https://github.com/eried/portapack-mayhem/issues/new/choose) or [choosing](https://github.com/eried/portapack-mayhem/issues/) an existing issue. Then, go to [Bountysource](https://www.bountysource.com/) and post a bounty using the link to that specific [issue](https://www.bountysource.com/teams/portapack-mayhem/issues).
Promote your bounty over our Discord by clicking the chat badge on [top](#portapack-mayhem).
@@ -62,6 +60,3 @@ Promote your bounty over our Discord by clicking the chat badge on [top](#portap
First, check the [documentation](https://github.com/eried/portapack-mayhem/wiki). If you find a bug or you think the problem is related to the current repository, please open an [issue](https://github.com/eried/portapack-mayhem/issues/new/choose).
You can reach the [official community](https://www.facebook.com/groups/177623356165819) in Facebook, and our Discord by clicking the chat badge on [top](#portapack-mayhem).
## What if I find incongruencies, or grammatical errors in the text?
If is on the [Wiki](https://github.com/eried/portapack-mayhem/wiki), you can modify it directly. If is on files of the repository, you can send corrections as [pull requests](https://github.com/eried/portapack-mayhem/wiki/How-to-collaborate#coding-new-stuff-or-fixing-bugs). As a last resource, open an [issue](https://github.com/eried/portapack-mayhem/issues/new/choose).
+14 -1
View File
@@ -51,6 +51,13 @@ int app_settings::load(std::string application, AppSettings* settings) {
settings->tx_amp=std::app_settings::read_long_long(file_content, "tx_amp=");
settings->tx_frequency=std::app_settings::read_long_long(file_content, "tx_frequency=");
settings->tx_gain=std::app_settings::read_long_long(file_content, "tx_gain=");
settings->step=std::app_settings::read_long_long(file_content, "step=");
settings->modulation=std::app_settings::read_long_long(file_content, "modulation=");
settings->am_config_index=std::app_settings::read_long_long(file_content, "am_config_index=");
settings->nbfm_config_index=std::app_settings::read_long_long(file_content, "nbfm_config_index=");
settings->wfm_config_index=std::app_settings::read_long_long(file_content, "wfm_config_index=");
settings->squelch=std::app_settings::read_long_long(file_content, "squelch=");
rc = SETTINGS_OK;
}
else rc = SETTINGS_UNABLE_TO_LOAD;
@@ -61,7 +68,7 @@ int app_settings::load(std::string application, AppSettings* settings) {
int app_settings::save(std::string application, AppSettings* settings) {
if (portapack::persistent_memory::save_app_settings()) {
if (portapack::persistent_memory::save_app_settings()) {
file_path = folder+"/"+application+".ini";
make_new_directory(folder);
@@ -79,6 +86,12 @@ int app_settings::save(std::string application, AppSettings* settings) {
// Save other settings from struct
settings_file.write_line("rx_frequency="+to_string_dec_uint(settings->rx_frequency));
settings_file.write_line("tx_frequency="+to_string_dec_uint(settings->tx_frequency));
settings_file.write_line("step="+to_string_dec_uint(settings->step));
settings_file.write_line("modulation="+to_string_dec_uint(settings->modulation));
settings_file.write_line("am_config_index="+to_string_dec_uint(settings->am_config_index));
settings_file.write_line("nbfm_config_index="+to_string_dec_uint(settings->nbfm_config_index));
settings_file.write_line("wfm_config_index="+to_string_dec_uint(settings->wfm_config_index));
settings_file.write_line("squelch="+to_string_dec_uint(settings->squelch));
rc = SETTINGS_OK;
}
+5
View File
@@ -59,6 +59,11 @@ public:
uint32_t tx_frequency;
uint8_t tx_gain;
uint8_t vga;
uint32_t step;
uint8_t am_config_index;
uint8_t nbfm_config_index;
uint8_t wfm_config_index;
uint8_t squelch;
};
int load(std::string application, AppSettings* settings);
+20 -10
View File
@@ -136,6 +136,7 @@ AnalogAudioView::AnalogAudioView(
field_vga.set_value(app_settings.vga);
receiver_model.set_rf_amp(app_settings.rx_amp);
field_frequency.set_value(app_settings.rx_frequency);
receiver_model.set_configuration_without_init(static_cast<ReceiverModel::Mode>(app_settings.modulation), app_settings.step, app_settings.am_config_index, app_settings.nbfm_config_index, app_settings.wfm_config_index, app_settings.squelch);
}
else field_frequency.set_value(receiver_model.tuning_frequency());
@@ -193,36 +194,45 @@ AnalogAudioView::AnalogAudioView(
audio::output::start();
update_modulation(static_cast<ReceiverModel::Mode>(modulation));
on_modulation_changed(static_cast<ReceiverModel::Mode>(modulation));
on_modulation_changed(static_cast<ReceiverModel::Mode>(modulation));
}
size_t AnalogAudioView::get_spec_bw_index() {
return spec_bw_index;
return spec_bw_index;
}
void AnalogAudioView::set_spec_bw(size_t index, uint32_t bw) {
spec_bw_index = index;
spec_bw = bw;
spec_bw_index = index;
spec_bw = bw;
baseband::set_spectrum(bw, spec_trigger);
receiver_model.set_sampling_rate(bw);
receiver_model.set_baseband_bandwidth(bw/2);
baseband::set_spectrum(bw, spec_trigger);
receiver_model.set_sampling_rate(bw);
receiver_model.set_baseband_bandwidth(bw/2);
}
uint16_t AnalogAudioView::get_spec_trigger() {
return spec_trigger;
return spec_trigger;
}
void AnalogAudioView::set_spec_trigger(uint16_t trigger) {
spec_trigger = trigger;
spec_trigger = trigger;
baseband::set_spectrum(spec_bw, spec_trigger);
baseband::set_spectrum(spec_bw, spec_trigger);
}
AnalogAudioView::~AnalogAudioView() {
// save app settings
app_settings.rx_frequency = field_frequency.value();
app_settings.lna = receiver_model.lna();
app_settings.vga = receiver_model.vga();
app_settings.rx_amp = receiver_model.rf_amp();
app_settings.step = receiver_model.frequency_step();
app_settings.modulation = (uint8_t)receiver_model.modulation();
app_settings.am_config_index = receiver_model.am_configuration();
app_settings.nbfm_config_index = receiver_model.nbfm_configuration();
app_settings.wfm_config_index = receiver_model.wfm_configuration();
app_settings.squelch = receiver_model.squelch_level();
settings.save("rx_audio", &app_settings);
// TODO: Manipulating audio codec here, and in ui_receiver.cpp. Good to do
@@ -53,12 +53,13 @@ private:
OptionsField options_config {
{ 3 * 8, 0 * 16 },
4,
5,
{
{ "DSB ", 0 },
{ "USB ", 0 },
{ "LSB ", 0 },
{ "CW ", 0 },
{ "DSB 9k ", 0 },
{ "DSB 6k ", 0 },
{ "USB+3k ", 0 },
{ "LSB-3k ", 0 },
{ "CW ", 0 },
}
};
};
+7 -2
View File
@@ -26,7 +26,7 @@
#include "ui_fileman.hpp"
#include "io_file.hpp"
#include "cpld_update.hpp"
#include "baseband_api.hpp"
#include "portapack.hpp"
#include "portapack_persistent_memory.hpp"
@@ -258,7 +258,12 @@ ReplayAppView::ReplayAppView(
ReplayAppView::~ReplayAppView() {
radio::disable();
baseband::shutdown();
display.fill_rectangle({ 0,0,240, 320 },Color::black()); //Solving sometimes visible bottom waterfall artifacts, clearing all LCD pixels.
chThdSleepMilliseconds(40); // (that happened sometimes if we interrupt the waterfall play at the beggining of the play around 25% and exit )
hackrf::cpld::load_sram_no_verify(); // to leave all RX reception ok, without "ghost interference signal problem" at the exit .
baseband::shutdown(); // better this function at the end, after load_sram(). If not , sometimes produced hang up (now not , it is ok).
}
void ReplayAppView::on_hide() {
@@ -38,7 +38,7 @@ namespace ui
console.writeln("Brumi-2021,texasyojimbo");
console.writeln("heurist1,intoxsick,ckuethe");
console.writeln("notpike,jLynx,zigad");
console.writeln("MichalLeonBorsuk");
console.writeln("MichalLeonBorsuk,jimilinuxguy");
console.writeln("");
break;
+5 -2
View File
@@ -162,13 +162,16 @@ ADSBSpeedView::ADSBSpeedView(
add_children({
&labels_speed,
&labels_vert_rate,
&compass,
&field_angle,
&field_speed
&field_speed,
&field_vert_rate
});
field_angle.set_value(0);
field_speed.set_value(400);
field_vert_rate.set_value(0);
field_angle.on_change = [this](int32_t v) {
compass.set_value(v);
@@ -181,7 +184,7 @@ void ADSBSpeedView::collect_frames(const uint32_t ICAO_address, std::vector<ADSB
ADSBFrame temp_frame;
encode_frame_velo(temp_frame, ICAO_address, field_speed.value(),
field_angle.value(), 0); // TODO: v_rate
field_angle.value(), field_vert_rate.value()); // Added v_rate , ft/min , (+) climb , (-) descend .
frame_list.emplace_back(temp_frame);
}
+8
View File
@@ -96,6 +96,10 @@ private:
{ { 1 * 8, 6 * 16 }, "Speed: kn Bearing: *", Color::light_grey() }
};
Labels labels_vert_rate {
{ { 1 * 8, 8 * 16 }, "Vert. rate: ft/min, (+/-)", Color::light_grey() }
};
Compass compass {
{ 21 * 8, 2 * 16 }
};
@@ -107,6 +111,10 @@ private:
NumberField field_speed {
{ 8 * 8, 6 * 16 }, 3, { 0, 999 }, 5, ' '
};
NumberField field_vert_rate {
{ 11 * 8, 8 * 16 }, 5, { -4096, 4096 }, 64, ' ' // Let's limit to +/-5k aprox , Ex. max safe descent vertical rate aprox -1000 ft/min on an instrument approach. , std step is 64
};
};
class ADSBSquawkView : public OptionTabView {
+71 -125
View File
@@ -36,16 +36,17 @@ EncodersConfigView::EncodersConfigView(
using option_t = std::pair<std::string, int32_t>;
std::vector<option_t> enc_options;
size_t i;
set_parent_rect(parent_rect);
hidden(true);
// Default encoder def
encoder_def = &encoder_defs[0];
add_children({
&labels,
&options_enctype,
&field_repeat_min,
&field_clk,
&field_clk_step,
&field_frameduration,
@@ -58,18 +59,18 @@ EncodersConfigView::EncodersConfigView(
// Load encoder types in option field
for (i = 0; i < ENC_TYPES_COUNT; i++)
enc_options.emplace_back(std::make_pair(encoder_defs[i].name, i));
options_enctype.on_change = [this](size_t index, int32_t) {
on_type_change(index);
};
options_enctype.set_options(enc_options);
options_enctype.set_selected_index(0);
symfield_word.on_change = [this]() {
generate_frame();
};
// Selecting input clock changes symbol and word duration
field_clk.on_change = [this](int32_t value) {
// value is in kHz, new_value is in us
@@ -81,7 +82,7 @@ EncodersConfigView::EncodersConfigView(
field_clk_step.on_change = [this](size_t, int32_t value) {
field_clk.set_step(value);
};
// Selecting word duration changes input clock and symbol duration
field_frameduration.on_change = [this](int32_t value) {
// value is in us, new_value is in kHz
@@ -107,7 +108,8 @@ void EncodersConfigView::on_type_change(size_t index) {
encoder_def = &encoder_defs[index];
field_clk.set_value(encoder_def->default_speed / 1000);
field_repeat_min.set_value(encoder_def->repeat_min);
// SymField setup
word_length = encoder_def->word_length;
symfield_word.set_length(word_length);
@@ -122,10 +124,10 @@ void EncodersConfigView::on_type_change(size_t index) {
format_string += 'D';
}
}
// Ugly :( Pad to erase
format_string.append(24 - format_string.size(), ' ');
text_format.set(format_string);
generate_frame();
@@ -141,28 +143,28 @@ void EncodersConfigView::draw_waveform() {
for (size_t n = 0; n < length; n++)
waveform_buffer[n] = (frame_fragments[n] == '0') ? 0 : 1;
waveform.set_length(length);
waveform.set_dirty();
}
void EncodersConfigView::generate_frame() {
size_t i = 0;
frame_fragments.clear();
for (auto c : encoder_def->word_format) {
if (c == 'S')
frame_fragments += encoder_def->sync;
else
frame_fragments += encoder_def->bit_format[symfield_word.get_sym(i++)];
}
draw_waveform();
}
uint8_t EncodersConfigView::repeat_min() {
return encoder_def->repeat_min;
return field_repeat_min.value();
}
uint32_t EncodersConfigView::samples_per_bit() {
@@ -174,7 +176,7 @@ uint32_t EncodersConfigView::pause_symbols() {
}
void EncodersScanView::focus() {
field_debug.focus();
field_length.focus();
}
EncodersScanView::EncodersScanView(
@@ -182,31 +184,17 @@ EncodersScanView::EncodersScanView(
) {
set_parent_rect(parent_rect);
hidden(true);
add_children({
&labels,
&field_debug,
&text_debug,
&text_length
&field_length,
&bit_length_10,
&bit_length
});
// DEBUG
field_debug.on_change = [this](int32_t value) {
uint32_t l;
size_t length;
de_bruijn debruijn_seq;
length = debruijn_seq.init(value);
l = 1;
l <<= value;
l--;
if (l > 25)
l = 25;
text_debug.set(to_string_bin(debruijn_seq.compute(l), 25));
text_length.set(to_string_dec_uint(length));
};
field_length.set_value(8);
bit_length_10.set_value(40);
bit_length.set_value(0);
}
void EncodersView::focus() {
@@ -215,7 +203,7 @@ void EncodersView::focus() {
EncodersView::~EncodersView() {
// save app settings
app_settings.tx_frequency = transmitter_model.tuning_frequency();
app_settings.tx_frequency = transmitter_model.tuning_frequency();
settings.save("tx_ook", &app_settings);
transmitter_model.disable();
@@ -225,24 +213,11 @@ EncodersView::~EncodersView() {
void EncodersView::update_progress() {
std::string str_buffer;
// text_status.set(" ");
if (tx_mode == SINGLE) {
if (tx_mode == SINGLE || tx_mode == SCAN) {
str_buffer = to_string_dec_uint(repeat_index) + "/" + to_string_dec_uint(repeat_min);
text_status.set(str_buffer);
progressbar.set_value(repeat_index);
/*} else if (tx_mode == SCAN) {
strcpy(str, to_string_dec_uint(repeat_index).c_str());
strcat(str, "/");
strcat(str, to_string_dec_uint(portapack::persistent_memory::afsk_repeats()).c_str());
strcat(str, " ");
strcat(str, to_string_dec_uint(scan_index + 1).c_str());
strcat(str, "/");
strcat(str, to_string_dec_uint(scan_count).c_str());
text_status.set(str);
progress.set_value(scan_progress);*/
} else {
text_status.set("Ready");
progressbar.set_value(0);
@@ -250,89 +225,58 @@ void EncodersView::update_progress() {
}
void EncodersView::on_tx_progress(const uint32_t progress, const bool done) {
//char str[16];
if (!done) {
// Repeating...
repeat_index = progress + 1;
/*if (tx_mode == SCAN) {
scan_progress++;
update_progress();
} else {*/
update_progress();
//}
update_progress();
} else {
// make sure all samples are transmitted before disabling radio
chThdSleepMilliseconds(10);
// Done transmitting
/*if ((tx_mode == SCAN) && (scan_index < (scan_count - 1))) {
transmitter_model.disable();
if (abort_scan) {
// Kill scan process
strcpy(str, "Abort @");
strcat(str, rgsb);
text_status.set(str);
progress.set_value(0);
tx_mode = IDLE;
abort_scan = false;
button_scan.set_style(&style_val);
button_scan.set_text("SCAN");
} else {
// Next address
scan_index++;
strcpy(rgsb, &scan_list[options_scanlist.selected_index()].addresses[scan_index * 5]);
scan_progress++;
repeat_index = 1;
update_progress();
start_tx(true);
}
} else {*/
transmitter_model.disable();
tx_mode = IDLE;
text_status.set("Done");
progressbar.set_value(0);
tx_view.set_transmitting(false);
//}
transmitter_model.disable();
tx_mode = IDLE;
text_status.set("Done");
progressbar.set_value(0);
tx_view.set_transmitting(false);
}
}
void EncodersView::start_tx(const bool scan) {
(void)scan;
size_t bitstream_length = 0;
repeat_min = view_config.repeat_min();
/*if (scan) {
if (tx_mode != SCAN) {
scan_index = 0;
scan_count = scan_list[options_scanlist.selected_index()].count;
scan_progress = 1;
repeat_index = 1;
tx_mode = SCAN;
strcpy(rgsb, &scan_list[options_scanlist.selected_index()].addresses[0]);
progress.set_max(scan_count * afsk_repeats);
update_progress();
}
} else {*/
int scan_width = 0;
uint32_t samples_per_bit;
if (scan) {
tx_mode = SCAN;
scan_width = view_scan.field_length.value();
samples_per_bit =
((view_scan.bit_length_10.value() * 10 + view_scan.bit_length.value()) * OOK_SAMPLERATE) / 1000000UL;
const uint32_t seq_len = ((1 << (scan_width - 1)) * 2) * ((uint64_t) samples_per_bit) / 2048UL;
progressbar.set_max(seq_len);
repeat_min = seq_len;
} else {
tx_mode = SINGLE;
repeat_index = 1;
samples_per_bit = view_config.samples_per_bit();
view_config.generate_frame();
bitstream_length = make_bitstream(view_config.frame_fragments);
progressbar.set_max(repeat_min);
update_progress();
//}
view_config.generate_frame();
bitstream_length = make_bitstream(view_config.frame_fragments);
repeat_min = view_config.repeat_min();
}
repeat_index = 1;
update_progress();
transmitter_model.set_sampling_rate(OOK_SAMPLERATE);
transmitter_model.set_rf_amp(true);
transmitter_model.set_baseband_bandwidth(1750000);
transmitter_model.enable();
baseband::set_ook_data(
bitstream_length,
view_config.samples_per_bit(),
samples_per_bit,
repeat_min,
view_config.pause_symbols()
view_config.pause_symbols(),
scan_width
);
}
@@ -350,14 +294,14 @@ EncodersView::EncodersView(
&progressbar,
&tx_view
});
// load app settings
auto rc = settings.load("tx_ook", &app_settings);
if(rc == SETTINGS_OK) {
if (rc == SETTINGS_OK) {
transmitter_model.set_rf_amp(app_settings.tx_amp);
transmitter_model.set_channel_bandwidth(app_settings.channel_bandwidth);
transmitter_model.set_tuning_frequency(app_settings.tx_frequency);
transmitter_model.set_tx_gain(app_settings.tx_gain);
transmitter_model.set_tx_gain(app_settings.tx_gain);
}
tx_view.on_edit_frequency = [this, &nav]() {
@@ -366,14 +310,16 @@ EncodersView::EncodersView(
transmitter_model.set_tuning_frequency(f);
};
};
tx_view.on_start = [this]() {
tx_view.set_transmitting(true);
start_tx(false);
start_tx(tab_view.selected());
};
tx_view.on_stop = [this]() {
tx_view.set_transmitting(false);
baseband::kill_ook();
transmitter_model.disable();
};
}
+63 -54
View File
@@ -35,43 +35,39 @@ namespace ui {
class EncodersConfigView : public View {
public:
EncodersConfigView(NavigationView& nav, Rect parent_rect);
EncodersConfigView(const EncodersConfigView&) = delete;
EncodersConfigView(EncodersConfigView&&) = delete;
EncodersConfigView& operator=(const EncodersConfigView&) = delete;
EncodersConfigView& operator=(EncodersConfigView&&) = delete;
void focus() override;
void on_show() override;
uint8_t repeat_min();
uint32_t samples_per_bit();
uint32_t pause_symbols();
void generate_frame();
std::string frame_fragments = "0";
private:
//bool abort_scan = false;
//uint8_t scan_count;
//double scan_progress;
//unsigned int scan_index;
int16_t waveform_buffer[550];
const encoder_def_t * encoder_def { };
//uint8_t enc_type = 0;
void draw_waveform();
void on_bitfield();
void on_type_change(size_t index);
Labels labels {
{ { 1 * 8, 0 }, "Type:", Color::light_grey() },
{ { 17 * 8, 0 }, "Repeat:", Color::light_grey() },
{ { 1 * 8, 2 * 8 }, "Clk:", Color::light_grey() },
{ { 10 * 8, 2 * 8 }, "kHz", Color::light_grey() },
{ { 17 * 8, 2 * 8 }, "Step:", Color::light_grey() },
{ { 17 * 8, 2 * 8 }, "Step:", Color::light_grey() },
{ { 1 * 8, 4 * 8 }, "Frame:", Color::light_grey() },
{ { 13 * 8, 4 * 8 }, "us", Color::light_grey() },
{ { 17 * 8, 4 * 8 }, "Step", Color::light_grey() },
{ { 13 * 8, 4 * 8 }, "us", Color::light_grey() },
{ { 17 * 8, 4 * 8 }, "Step:", Color::light_grey() },
{ { 2 * 8, 7 * 8 }, "Symbols:", Color::light_grey() },
{ { 1 * 8, 14 * 8 }, "Waveform:", Color::light_grey() }
};
@@ -91,6 +87,14 @@ private:
' '
};
NumberField field_repeat_min {
{ 24 * 8, 0 },
2,
{ 1, 99 },
1,
' '
};
OptionsField field_clk_step {
{ 22 * 8, 2 * 8 },
7,
@@ -119,18 +123,18 @@ private:
{ "1000", 1000 }
}
};
SymField symfield_word {
{ 2 * 8, 9 * 8 },
20,
SymField::SYMFIELD_DEF
};
Text text_format {
{ 2 * 8, 11 * 8, 24 * 8, 16 },
""
};
Waveform waveform {
{ 0, 17 * 8, 240, 32 },
waveform_buffer,
@@ -145,33 +149,38 @@ private:
class EncodersScanView : public View {
public:
EncodersScanView(NavigationView& nav, Rect parent_rect);
NumberField field_length {
{ 8 * 8, 0 },
2,
{ 3, 24 },
1,
' '
};
NumberField bit_length_10 {
{ 12 * 8, 2 * 8 },
2,
{ 1, 88 },
1,
' '
};
NumberField bit_length {
{ 14 * 8, 2 * 8 },
1,
{ 0, 9 },
1,
' '
};
void focus() override;
private:
Labels labels {
{ { 1 * 8, 1 * 8 }, "Coming soon...", Color::light_grey() }
};
// DEBUG
NumberField field_debug {
{ 1 * 8, 6 * 8 },
2,
{ 3, 16 },
1,
' '
};
// DEBUG
Text text_debug {
{ 1 * 8, 8 * 8, 24 * 8, 16 },
""
};
// DEBUG
Text text_length {
{ 1 * 8, 10 * 8, 24 * 8, 16 },
""
{ { 1 * 8, 0 * 8 }, "Length:", Color::light_grey() },
{ { 1 * 8, 2 * 8 }, "Bit length:", Color::light_grey() },
{ { 16 * 8, 2 * 8 }, "us", Color::light_grey() },
};
};
@@ -179,9 +188,9 @@ class EncodersView : public View {
public:
EncodersView(NavigationView& nav);
~EncodersView();
void focus() override;
std::string title() const override { return "OOK TX"; };
private:
@@ -192,19 +201,19 @@ private:
SINGLE,
SCAN
};
// app save settings
std::app_settings settings { };
std::app_settings settings { };
std::app_settings::AppSettings app_settings { };
tx_modes tx_mode = IDLE;
uint8_t repeat_index { 0 };
uint8_t repeat_min { 0 };
uint32_t repeat_index { 0 };
uint32_t repeat_min { 0 };
void update_progress();
void start_tx(const bool scan);
void on_tx_progress(const uint32_t progress, const bool done);
/*const Style style_address {
.font = font::fixed_8x16,
.background = Color::black(),
@@ -215,32 +224,32 @@ private:
.background = Color::black(),
.foreground = Color::blue(),
};*/
Rect view_rect = { 0, 4 * 8, 240, 168 };
EncodersConfigView view_config { nav_, view_rect };
EncodersScanView view_scan { nav_, view_rect };
TabView tab_view {
{ "Config", Color::cyan(), &view_config },
{ "Scan", Color::green(), &view_scan },
{ "de Bruijn", Color::green(), &view_scan },
};
Text text_status {
{ 2 * 8, 13 * 16, 128, 16 },
"Ready"
};
ProgressBar progressbar {
{ 2 * 8, 13 * 16 + 20, 208, 16 }
};
TransmitterView tx_view {
16 * 16,
50000,
9
};
MessageHandlerRegistration message_handler_tx_progress {
Message::ID::TXProgress,
[this](const Message* const p) {
+6 -2
View File
@@ -270,9 +270,9 @@ void JammerView::start_tx() {
button_transmit.set_text("STOP");
transmitter_model.set_sampling_rate(3072000U);
transmitter_model.set_rf_amp(true);
transmitter_model.set_rf_amp(field_amp.value());
transmitter_model.set_baseband_bandwidth(3500000U);
transmitter_model.set_tx_gain(47);
transmitter_model.set_tx_gain(field_gain.value());
transmitter_model.enable();
baseband::set_jammer(true, (JammerType)options_type.selected_index(), options_speed.selected_index_value());
@@ -368,6 +368,8 @@ JammerView::JammerView(
&field_timetx,
&field_timepause,
&field_jitter,
&field_gain,
&field_amp,
&button_transmit
});
@@ -382,6 +384,8 @@ JammerView::JammerView(
field_timetx.set_value(30);
field_timepause.set_value(1);
field_gain.set_value(transmitter_model.tx_gain());
field_amp.set_value(transmitter_model.rf_amp());
button_transmit.on_select = [this](Button&) {
if (jamming || cooling)
+20 -2
View File
@@ -156,7 +156,9 @@ private:
{ { 0 * 8, 33 * 8 }, "Jitter:", Color::light_grey() }, //Maybe the repository curator can keep the "mystype" for some versions.
{ { 11 * 8, 29 * 8 }, "Secs.", Color::light_grey() },
{ { 11 * 8, 31 * 8 }, "Secs.", Color::light_grey() },
{ { 11 * 8, 33 * 8 }, "/60", Color::light_grey() }
{ { 11 * 8, 33 * 8 }, "/60", Color::light_grey() },
{ { 2 * 8, 35 * 8 }, "Gain:", Color::light_grey() },
{ { 11 * 8, 35 * 8 }, "A:", Color::light_grey() }
};
OptionsField options_type {
@@ -229,8 +231,24 @@ private:
' ',
};
NumberField field_gain {
{ 8 * 8, 35 * 8 },
2,
{ 0, 47 },
1,
' ',
};
NumberField field_amp {
{ 13 * 8, 35 * 8 },
1,
{ 0, 1 },
1,
' ',
};
Button button_transmit {
{ 148, 212, 80, 80},
{ 148, 216, 80, 80},
"START"
};
+92 -33
View File
@@ -159,19 +159,24 @@ void MicTXView::rxaudio(bool is_on) {
audio::input::stop();
baseband::shutdown();
if (enable_am || enable_usb || enable_lsb || enable_dsb) {
if (enable_am || enable_usb || enable_lsb || enable_dsb) { // "NFM/FM",0 ," WFM ",1 , " AM ",2, " USB ", 3, " LSB ",4, " DSB-SC", 5
baseband::run_image(portapack::spi_flash::image_tag_am_audio);
receiver_model.set_modulation(ReceiverModel::Mode::AMAudio);
if (options_mode.selected_index() < 4)
receiver_model.set_am_configuration(options_mode.selected_index() - 1);
else
receiver_model.set_am_configuration(0);
receiver_model.set_modulation(ReceiverModel::Mode::AMAudio); // that AM demodulation engine is common to all Amplitude mod : AM/USB/LSB/DSB (2,3,4,5)
if (options_mode.selected_index() < 5) // We will be called here with 2,3,4,5 . We treat here demod. filter 2,3,4; (excluding DSB-C case (5) it is treated more down).
receiver_model.set_am_configuration(options_mode.selected_index() - 1); // selecting proper filter(2,3,4). 2-1=1=>6k-AM(1) , 3-1=2=>+3k-USB(2), 4-1=3=>-3K-LSB(3),
}
else {
baseband::run_image(portapack::spi_flash::image_tag_nfm_audio);
receiver_model.set_modulation(ReceiverModel::Mode::NarrowbandFMAudio);
else { // We are in NFM/FM or WFM (NFM BW:8k5 or 11k / FM BW 16k / WFM BW:200k)
}
if (enable_wfm) { // WFM , BW 200Khz aprox ,
baseband::run_image(portapack::spi_flash::image_tag_wfm_audio);
receiver_model.set_modulation(ReceiverModel::Mode::WidebandFMAudio);
receiver_model.set_wfm_configuration(0); // there are only 1 x config filters 200k WFM . (not like 8k5/11k/16k)
} else { // NFM BW:8k5 or 11k / FM BW 16k
baseband::run_image(portapack::spi_flash::image_tag_nfm_audio);
receiver_model.set_modulation(ReceiverModel::Mode::NarrowbandFMAudio); //
// receiver_model.set_nbfm_configuration(n); is called above , depending 8k5, 11k, 16k
}
}
receiver_model.set_sampling_rate(3072000);
receiver_model.set_baseband_bandwidth(1750000);
// receiver_model.set_tuning_frequency(field_frequency.value()); //probably this too can be commented out.
@@ -346,7 +351,8 @@ MicTXView::MicTXView(
field_bw.on_change = [this](uint32_t v) {
transmitter_model.set_channel_bandwidth(v * 1000);
};
field_bw.set_value(10);
field_bw.set_value(10); // pre-default first time, TX deviation FM for NFM / FM
tx_gain = transmitter_model.tx_gain();
field_rfgain.on_change = [this](int32_t v) {
@@ -361,50 +367,102 @@ MicTXView::MicTXView(
};
field_rfamp.set_value(rf_amp ? 14 : 0);
options_mode.on_change = [this](size_t, int32_t v) {
enable_am = false;
options_mode.on_change = [this](size_t, int32_t v) { //{ "NFM/FM", 0 }, { " WFM ", 1 },{ "AM", 2 },{ "USB", 3 },{ "LSB", 4 },{ "DSB", 5 }
enable_am = false;
enable_usb = false;
enable_lsb = false;
enable_dsb = false;
enable_wfm = false;
using option_t = std::pair<std::string, int32_t>;
using options_t = std::vector<option_t>;
options_t rxbw; // Aux structure to change dynamically field_rxbw contents,
switch(v) {
case 0:
enable_am = false;
case 0: //{ "FM", 0 }
enable_am = false;
enable_usb = false;
enable_lsb = false;
enable_dsb = false;
field_bw.set_value(transmitter_model.channel_bandwidth() / 1000);
field_bw.set_value(10); // pre-default deviation FM for WFM
// field_bw.set_value(transmitter_model.channel_bandwidth() / 1000);
//if (rx_enabled)
rxaudio(rx_enabled); //Update now if we have RX audio on
options_tone_key.hidden(0); // we are in FM mode , we should have active the Key-tones & CTCSS option.
rxbw.emplace_back(" NFM1:8k5 ", 0); // restore the original dynamic field_rxbw value.
rxbw.emplace_back(" NFM2:11k ", 1);
rxbw.emplace_back(" FM :16k ", 2);
field_rxbw.set_options(rxbw); // store that aux GUI option to the field_rxbw.
field_rxbw.hidden(0); // we are in FM mode, we need to allow the user set up of the RX NFM BW selection (8K5, 11K, 16K)
field_bw.hidden(0); // we are in FM mode, we need to allow FM deviation parameter , in non FM mode.
break;
case 1:
case 1: //{ "WFM", 1 }
enable_am = false;
enable_usb = false;
enable_lsb = false;
enable_dsb = false;
enable_wfm = true;
field_bw.set_value(75); // pre-default deviation FM for WFM
// field_bw.set_value(transmitter_model.channel_bandwidth() / 1000);
//if (rx_enabled)
rxaudio(rx_enabled); //Update now if we have RX audio on
options_tone_key.hidden(0); // we are in WFM mode , we should have active the Key-tones & CTCSS option.
rxbw.emplace_back(" 200k-WFM ", 0); // locked a fixed option , to display it .
field_rxbw.set_options(rxbw); // store that aux GUI option to the field_rxbw.
field_rxbw.hidden(0); // we are in WFM mode, we need to show to the user the selected BW WFM filer .
field_bw.hidden(0); // we are in WFM mode, we need to allow WFM deviation parameter , in non FM mode.
break;
case 2: //{ "AM", 2 }
enable_am = true;
rxaudio(rx_enabled); //Update now if we have RX audio on
options_tone_key.set_selected_index(0); // we are NOT in FM mode , we reset the possible previous key-tones &CTCSS selection.
set_dirty(); // Refresh display
options_tone_key.hidden(1); // we hide that Key-tones & CTCSS input selecction, (no meaning in AM/DSB/SSB).
field_rxbw.hidden(1); // we hide the NFM BW selection in other modes non_FM (no meaning in AM/DSB/SSB)
check_rogerbeep.hidden(0); // make visible again the "rogerbeep" selection.
rxbw.emplace_back(" DSB1-9k ", 0); // we offer in AM DSB two audio BW 9k / 6k .
rxbw.emplace_back(" DSB2-6k ", 1);
field_rxbw.set_options(rxbw); // store that aux GUI option to the field_rxbw.
field_rxbw.hidden(0); // we show fixed RX AM BW 6Khz
field_bw.hidden(1); // we hide the FM TX deviation parameter , in non FM mode.
check_rogerbeep.hidden(0); // make visible again the "rogerbeep" selection.
break;
case 2:
case 3: //{ "USB", 3 }
enable_usb = true;
rxaudio(rx_enabled); //Update now if we have RX audio on
check_rogerbeep.set_value(false); // reset the possible activation of roger beep, because it is not compatible with SSB , by now.
check_rogerbeep.hidden(1); // hide that roger beep selection.
rxbw.emplace_back(" USB+3k ", 0); // locked a fixed option , to display it .
field_rxbw.set_options(rxbw); // store that aux GUI option to the field_rxbw.
set_dirty(); // Refresh display
break;
case 3:
case 4: //{ "LSB", 4 }
enable_lsb = true;
rxaudio(rx_enabled); //Update now if we have RX audio on
check_rogerbeep.set_value(false); // reset the possible activation of roger beep, because it is not compatible with SSB , by now.
check_rogerbeep.hidden(1); // hide that roger beep selection.
rxbw.emplace_back(" LSB-3k ", 0); // locked a fixed option , to display it .
field_rxbw.set_options(rxbw); // store that aux GUI option to the field_rxbw.
set_dirty(); // Refresh display
break;
case 4:
case 5: //{ "DSB-SC", 5 }
enable_dsb = true;
rxaudio(rx_enabled); //Update now if we have RX audio on
check_rogerbeep.hidden(0); // make visible again the "rogerbeep" selection.
rxbw.emplace_back("SSB1:USB+3k", 0); // added dynamically two options (index 0,1) to that DSB-C case to the field_rxbw value.
rxbw.emplace_back("SSB2:LSB-3k", 1);
field_rxbw.set_options(rxbw); // store that aux GUI option to the field_rxbw.
break;
}
//configure_baseband();
@@ -481,19 +539,20 @@ MicTXView::MicTXView(
field_volume.on_change = [this](int32_t v) { this->on_headphone_volume_changed(v); };
field_rxbw.on_change = [this](size_t, int32_t v) {
switch(v) {
case 0:
receiver_model.set_nbfm_configuration(0);
break;
case 1:
receiver_model.set_nbfm_configuration(1);
break;
case 2:
receiver_model.set_nbfm_configuration(2);
break;
if (!(enable_am || enable_usb || enable_lsb || enable_dsb || enable_wfm )) {
// In Previous fw versions, that nbfm_configuration(n) was done in any mode (FM/AM/SSB/DSB)...strictly speaking only need it in (NFM/FM)
receiver_model.set_nbfm_configuration(v ); // we are in NFM/FM case, we need to select proper NFM/FM RX channel filter , NFM BW 8K5(0), NFM BW 11K(1) , FM BW 16K (2)
}
else { // we are not in NFM/FM mode .(we could be in any of the rest : AM /USB/LSB/DSB-SC)
if (enable_am) { // we are in AM TX mode , we will allow both independent RX audio BW : AM 9K (9K00AE3 / AM 6K (6K00AE3). (In AM option v can be 0 (9k) , 1 (6k)
receiver_model.set_am_configuration(v ); // we are in AM TX mode , we need to select proper AM full path config AM-9K filter. 0+0 =>AM-9K(0), 0+1=1 =>AM-6K(1),
}
if (enable_dsb) { // we are in DSB-SC in TX mode , we will allow both independent RX SSB demodulation (USB / LSB side band). in that submenu, v is 0 (SSB1 USB) or 1 (SSB2 LSB)
receiver_model.set_am_configuration(v +2 ); // we are in DSB-SC TX mode , we need to select proper SSB filter. 0+2 =>usb(2), 1+2=3 =>lsb(3),
}
}
};
field_rxbw.set_selected_index(2);
field_squelch.on_change = [this](int32_t v) {
receiver_model.set_squelch_level(100 - v);
+19 -17
View File
@@ -106,13 +106,14 @@ private:
bool enable_dsb { false };
bool enable_usb { false };
bool enable_lsb { false };
bool enable_wfm { false }; // added to distinguish in the FM mode , RX BW : NFM (8K5, 11K), FM (16K), WFM(200K)
Labels labels_WM8731 {
{ { 3 * 8, 1 * 8 }, "MIC-GAIN:", Color::light_grey() },
{ { 17 * 8, 1 * 8 }, "Boost", Color::light_grey() },
{ { 3 * 8, 3 * 8 }, "F:", Color::light_grey() },
{ { 15 * 8, 3 * 8 }, "BW: FM kHz", Color::light_grey() },
{ { 15 * 8, 3 * 8 }, "FM TXBW: kHz", Color::light_grey() }, // to be more symetric and consistent to the below FM RXBW
{ { 3 * 8, 5 * 8 }, "GAIN:", Color::light_grey() },
{ {11 * 8, 5 * 8 }, "Amp:", Color::light_grey() },
{ { 18 * 8, (5 * 8) }, "Mode:", Color::light_grey() },
@@ -122,7 +123,7 @@ private:
{ {20 * 8, 10 * 8 }, "DEC:", Color::light_grey() },
{ { 4 * 8, ( 13 * 8 ) - 2 }, "TONE KEY:", Color::light_grey() },
{ { 7 * 8, 23 * 8 }, "VOL:", Color::light_grey() },
{ {15 * 8, 23 * 8 }, "FM RXBW:", Color::light_grey() },
{ {14 * 8, 23 * 8 }, "RXBW:", Color::light_grey() }, //we remove the label "FM" because we will display all MOD types RX_BW.
{ {17 * 8, 25 * 8 }, "SQ:", Color::light_grey() },
{ { 5 * 8, 25 * 8 }, "F:", Color::light_grey() },
{ { 5 * 8, 27 * 8 }, "LNA:", Color::light_grey()},
@@ -133,7 +134,7 @@ private:
{ { 3 * 8, 1 * 8 }, "MIC-GAIN:", Color::light_grey() },
{ { 17 * 8, 1 * 8 }, "ALC", Color::light_grey() },
{ { 3 * 8, 3 * 8 }, "F:", Color::light_grey() },
{ { 15 * 8, 3 * 8 }, "BW: FM kHz", Color::light_grey() },
{ { 15 * 8, 3 * 8 }, "FM TXBW: kHz", Color::light_grey() },
{ { 3 * 8, 5 * 8 }, "GAIN:", Color::light_grey() },
{ {11 * 8, 5 * 8 }, "Amp:", Color::light_grey() },
{ { 18 * 8, (5 * 8) }, "Mode:", Color::light_grey() },
@@ -142,8 +143,8 @@ private:
{ {12 * 8, 10 * 8 }, "ATT:", Color::light_grey() },
{ {20 * 8, 10 * 8 }, "DEC:", Color::light_grey() },
{ { 4 * 8, ( 13 * 8 ) - 2 }, "TONE KEY:", Color::light_grey() },
{ { 7 * 8, 23 * 8 }, "VOL:", Color::light_grey() },
{ {15 * 8, 23 * 8 }, "FM RXBW:", Color::light_grey() },
{ { (6 * 8)+4, 23 * 8 }, "VOL:", Color::light_grey() },
{ {14 * 8, 23 * 8 }, "RXBW:", Color::light_grey() }, //we remove the label "FM" because we will display all MOD types RX_BW.
{ {17 * 8, 25 * 8 }, "SQ:", Color::light_grey() },
{ { 5 * 8, 25 * 8 }, "F:", Color::light_grey() },
{ { 5 * 8, 27 * 8 }, "LNA:", Color::light_grey()},
@@ -204,7 +205,7 @@ OptionsField options_wm8731_boost_mode {
{ 5 * 8, 3 * 8 },
};
NumberField field_bw {
{ 18 * 8, 3 * 8 },
{ 23 * 8, 3 * 8 },
3,
{ 0, 150 },
1,
@@ -228,13 +229,14 @@ OptionsField options_wm8731_boost_mode {
OptionsField options_mode {
{ 24 * 8, 5 * 8 },
3,
4,
{
{ "FM", 0 },
{ "AM", 1 },
{ "USB", 2 },
{ "LSB", 3 },
{ "DSB", 4 }
{ "NFM/FM", 0 },
{ " WFM ", 1 },
{ " AM ", 2 }, // in fact that TX mode = AM -DSB with carrier .
{ " USB ", 3 },
{ " LSB ", 4 },
{ "DSB-SC", 5 } // We are TX Double Side AM Band with suppressed carrier, and allowing in RX both indep SSB lateral band (USB/LSB).
}
};
/*
@@ -307,13 +309,13 @@ OptionsField options_wm8731_boost_mode {
};
OptionsField field_rxbw {
{ 23* 8, 23 * 8},
{ 19* 8, 23 * 8},
3,
{
{"8k5", 0},
{"11k", 1},
{"16k", 2}
}
{" NFM1:8k5 ", 0},
{" NFM2:11k ", 1},
{" FM :16k ", 2},
}
};
NumberField field_squelch {
+31 -22
View File
@@ -26,12 +26,12 @@
#include "file.hpp"
// Id's for messages between ReconThread and ReconView
#define MSG_RECON_PAUSE 9999 // for handle_retune to know that recon thread triggered a pause. f is not important with that message
#define MSG_RECON_SET_MODULATION 10000 // for handle_retune to know that recon thread triggered a modulation change. f is the index of the modulation
#define MSG_RECON_SET_BANDWIDTH 20000 // for handle_retune to know that recon thread triggered a bandwidth change. f is the new bandwidth value index for current modulation
#define MSG_RECON_SET_STEP 30000 // for handle_retune to know that recon thread triggered a bandwidth change. f is the new bandwidth value index for current modulation
#define MSG_RECON_PAUSE 9999 // for handle_retune to know that recon thread triggered a pause. f is not important with that message
#define MSG_RECON_SET_MODULATION 10000 // for handle_retune to know that recon thread triggered a modulation change. f is the index of the modulation
#define MSG_RECON_SET_BANDWIDTH 20000 // for handle_retune to know that recon thread triggered a bandwidth change. f is the new bandwidth value index for current modulation
#define MSG_RECON_SET_STEP 30000 // for handle_retune to know that recon thread triggered a bandwidth change. f is the new bandwidth value index for current modulation
#define MSG_RECON_SET_RECEIVER_BANDWIDTH 40000 // for handle_retune to know that recon thread triggered a receiver bandwidth change. f is the new bandwidth in hz
#define MSG_RECON_SET_RECEIVER_SAMPLERATE 50000 // for handle_retune to know that recon thread triggered a receiver samplerate change. f is the new samplerate in hz/s
#define MSG_RECON_SET_RECEIVER_SAMPLERATE 50000 // for handle_retune to know that recon thread triggered a receiver samplerate change. f is the new samplerate in hz/s
using namespace portapack;
@@ -1000,23 +1000,32 @@ namespace ui {
delete_file( "FREQMAN/"+output_file+".TXT" );
}
if( recon_thread )
{
recon_thread->set_freq_index( current_index );
timer = 0 ;
if( recon_thread )
{
timer = 0 ;
recon_thread->set_freq_index( current_index );
RetuneMessage message { };
receiver_model.set_tuning_frequency( frequency_list[ current_index ] . frequency_a ); // Retune
message.freq = frequency_list[ current_index ] . frequency_a ;
message.range = current_index ;
EventDispatcher::send_message(message);
chThdSleepMilliseconds( recon_lock_duration ); // give some time to Thread::Run to pause
if( previous_userpause )
{
user_pause();
}
else
{
user_resume();
}
if( previous_userpause )
{
user_pause();
}
else
{
user_resume();
}
recon_thread->set_recon( previous_is_recon );
recon_thread->set_freq_delete(false);
chThdSleepMilliseconds( recon_lock_duration ); // give some time to Thread::Run to pause
}
recon_thread->set_freq_delete(false);
recon_thread->set_recon( previous_is_recon );
}
};
button_remove.on_change = [this]() {
@@ -1690,7 +1699,7 @@ namespace ui {
break;
case WFM_MODULATION:
freqman_set_bandwidth_option( new_mod , field_bw );
//bw 16k (0) only/default
//bw 200k (0) only/default
field_bw.set_selected_index(0);
baseband::run_image(portapack::spi_flash::image_tag_wfm_audio);
receiver_model.set_modulation(ReceiverModel::Mode::WidebandFMAudio);
+5 -5
View File
@@ -207,7 +207,7 @@ namespace ui {
Labels labels
{
{ { 0 * 8 , 0 * 16 }, "LNA: VGA: AMP: VOL: ", Color::light_grey() },
{ { 0 * 8 , 1 * 16 }, "BW : SQ: W,L: , ", Color::light_grey() },
{ { 0 * 8 , 1 * 16 }, "BW: SQ: W,L: , ", Color::light_grey() },
{ { 3 * 8 , 10 * 16 }, "START END MANUAL", Color::light_grey() },
{ { 0 * 8 , (26 * 8) + 4 }, "MODE:", Color::light_grey() },
{ { 11 * 8 , (26 * 8) + 4 }, "STEP:", Color::light_grey() },
@@ -235,12 +235,12 @@ namespace ui {
OptionsField field_bw {
{ 3 * 8, 1 * 16 },
4,
6,
{ }
};
NumberField field_squelch {
{ 10 * 8, 1 * 16 },
{ 12 * 8, 1 * 16 },
3,
{ -90, 20 },
1,
@@ -248,7 +248,7 @@ namespace ui {
};
NumberField field_wait {
{ 18 * 8, 1 * 16 },
{ 20 * 8, 1 * 16 },
5,
{ -9000, 9000 },
100,
@@ -256,7 +256,7 @@ namespace ui {
};
NumberField field_lock_wait {
{ 24 * 8, 1 * 16 },
{ 26 * 8, 1 * 16 },
4,
{ 100 , 9000 },
100,
+128 -52
View File
@@ -31,13 +31,23 @@ ScannerThread::ScannerThread(
std::vector<rf::Frequency> frequency_list
) : frequency_list_ { std::move(frequency_list) }
{
thread = chThdCreateFromHeap(NULL, 1024, NORMALPRIO + 10, ScannerThread::static_fn, this);
create_thread();
}
ScannerThread::ScannerThread(const jammer::jammer_range_t& frequency_range, size_t def_step) : frequency_range_(frequency_range), def_step_(def_step)
{
create_thread();
}
ScannerThread::~ScannerThread() {
stop();
}
void ScannerThread::create_thread()
{
thread = chThdCreateFromHeap(NULL, 1024, NORMALPRIO + 10, ScannerThread::static_fn, this);
}
void ScannerThread::stop() {
if( thread ) {
chThdTerminate(thread);
@@ -102,12 +112,13 @@ void ScannerThread::run() {
else
restart_scan=false; //Effectively skipping first retuning, giving system time
}
message.freq = frequency_list_[frequency_index];
message.range = frequency_index; //Inform freq (for coloring purposes also!)
EventDispatcher::send_message(message);
}
else { //NOT scanning
if (_freq_del != 0) { //There is a frequency to delete
for (uint16_t i = 0; i < frequency_list_.size(); i++) { //Search for the freq to delete
for (uint32_t i = 0; i < frequency_list_.size(); i++) { //Search for the freq to delete
if (frequency_list_[i] == _freq_del)
{ //found: Erase it
frequency_list_.erase(frequency_list_.begin() + i);
@@ -126,16 +137,58 @@ void ScannerThread::run() {
}
chThdSleepMilliseconds(50); //Needed to (eventually) stabilize the receiver into new freq
}
}else if(def_step_ > 0) // manual mode
{
RetuneMessage message { };
int64_t frequency_index = 0;
int64_t size = (frequency_range_.max - frequency_range_.min) / def_step_;
bool restart_scan = false; //Flag whenever scanning is restarting after a pause
while( !chThdShouldTerminate() ) {
if (_scanning) { //Scanning
if (_freq_lock == 0) { //normal scanning (not performing freq_lock)
if (!restart_scan) { //looping at full speed
if (_fwd) { //forward
frequency_index++;
if (frequency_index >= size)
frequency_index = 0;
} else { //reverse
if (frequency_index < 1)
frequency_index = size;
frequency_index--;
}
receiver_model.set_tuning_frequency(frequency_range_.min + frequency_index * def_step_); // Retune
}
else
restart_scan=false; //Effectively skipping first retuning, giving system time
}
message.freq = frequency_range_.min + frequency_index * def_step_;
message.range = 0; //Inform freq (for coloring purposes also!)
EventDispatcher::send_message(message);
}
else { //NOT scanning
restart_scan=true; //Flag the need for skipping a cycle when restarting scan
}
chThdSleepMilliseconds(50); //Needed to (eventually) stabilize the receiver into new freq
}
}
}
void ScannerView::handle_retune(uint32_t i) {
void ScannerView::handle_retune(int64_t freq, uint32_t freq_idx) {
current_index = freq_idx; //since it is an ongoing scan, this is a new index
current_frequency = freq;
switch (scan_thread->is_freq_lock())
{
case 0: //NO FREQ LOCK, ONGOING STANDARD SCANNING
text_cycle.set( to_string_dec_uint(i + 1,3) );
current_index = i; //since it is an ongoing scan, this is a new index
if (description_list[current_index].size() > 0) desc_cycle.set( description_list[current_index] ); //Show new description
if (frequency_list.size() > 0) {
text_cycle.set( to_string_dec_uint(freq_idx + 1,3) );
}
if (freq_idx < description_list.size() && description_list[freq_idx].size() > 0) {
desc_cycle.set( description_list[freq_idx] ); //Show new description
}
break;
case 1: //STARTING LOCK FREQ
big_display.set_style(&style_yellow);
@@ -146,7 +199,7 @@ void ScannerView::handle_retune(uint32_t i) {
default: //freq lock is checking the signal, do not update display
return;
}
big_display.set(frequency_list[current_index]); //UPDATE the big Freq after 0, 1 or MAX_FREQ_LOCK (at least, for color synching)
big_display.set(freq); //UPDATE the big Freq after 0, 1 or MAX_FREQ_LOCK (at least, for color synching)
}
void ScannerView::focus() {
@@ -154,15 +207,17 @@ void ScannerView::focus() {
}
ScannerView::~ScannerView() {
// make sure to stop the thread before shutting down the receiver
scan_thread.reset();
audio::output::stop();
receiver_model.disable();
baseband::shutdown();
}
void ScannerView::show_max() { //show total number of freqs to scan
if (frequency_list.size() == MAX_DB_ENTRY) {
if (frequency_list.size() == FREQMAN_MAX_PER_FILE ) {
text_max.set_style(&style_red);
text_max.set( "/ " + to_string_dec_uint(MAX_DB_ENTRY) + " (DB MAX!)");
text_max.set( "/ " + to_string_dec_uint(FREQMAN_MAX_PER_FILE ) + " (DB MAX!)");
}
else {
text_max.set_style(&style_grey);
@@ -297,23 +352,15 @@ ScannerView::ScannerView(
description_list.clear();
def_step = step_mode.selected_index_value(); //Use def_step from manual selector
description_list.push_back(
"M" + to_string_short_freq(frequency_range.min) + ">"
+ to_string_short_freq(frequency_range.max) + "S"
+ to_string_short_freq(def_step).erase(0,1) //euquiq: lame kludge to reduce spacing in step freq
);
rf::Frequency frequency = frequency_range.min;
while (frequency_list.size() < MAX_DB_ENTRY && frequency <= frequency_range.max) { //add manual range
frequency_list.push_back(frequency);
description_list.push_back(""); //If empty, will keep showing the last description
frequency+=def_step;
}
show_max();
desc_cycle.set("");
text_max.set("");
text_cycle.set("");
if ( userpause ) //If user-paused, resume
user_resume();
big_display.set_style(&style_grey); //Back to grey color
start_scan_thread(); //RESTART SCANNER THREAD
start_scan_thread(frequency_range, def_step); //RESTART SCANNER THREAD
}
};
@@ -333,35 +380,56 @@ ScannerView::ScannerView(
big_display.set_style(&style_grey); //Back to grey color
};
button_add.on_select = [this](Button&) { //frequency_list[current_index]
button_add.on_select = [this](Button&) { // current_frequency
File scanner_file;
std::string freq_file_path = "FREQMAN/" + loaded_file_name + ".TXT";
const std::string freq_file_path = "FREQMAN/" + loaded_file_name + ".TXT";
auto result = scanner_file.open(freq_file_path); //First search if freq is already in txt
if (!result.is_valid()) {
std::string frequency_to_add = "f="
+ to_string_dec_uint(frequency_list[current_index] / 1000)
+ to_string_dec_uint(frequency_list[current_index] % 1000UL, 3, '0');
char one_char[1]; //Read it char by char
std::string line; //and put read line in here
const std::string frequency_to_add = "f="
+ to_string_dec_uint(current_frequency / 1000)
+ to_string_dec_uint(current_frequency % 1000UL, 3, '0');
bool found=false;
for (size_t pointer=0; pointer < scanner_file.size();pointer++) {
constexpr size_t buffer_size = 1024;
char buffer[buffer_size];
for (size_t pointer = 0, freq_str_idx = 0; pointer < scanner_file.size(); pointer += buffer_size) {
size_t adjusted_buffer_size;
if (pointer + buffer_size >= scanner_file.size()) {
memset(buffer, 0, sizeof(buffer));
adjusted_buffer_size = scanner_file.size() - pointer;
}
else {
adjusted_buffer_size = buffer_size;
}
scanner_file.seek(pointer);
scanner_file.read(one_char, 1);
if ((int)one_char[0] > 31) { //ascii space upwards
line += one_char[0]; //Add it to the textline
}
else if (one_char[0] == '\n') { //New Line
if (line.compare(0, frequency_to_add.size(),frequency_to_add) == 0) {
found=true;
break;
scanner_file.read(buffer, adjusted_buffer_size);
for (size_t i = 0; i < adjusted_buffer_size; ++i) {
if (buffer[i] == frequency_to_add.data()[freq_str_idx]) {
++freq_str_idx;
if (freq_str_idx >= frequency_to_add.size()) {
found = true;
break;
}
}
else {
freq_str_idx = 0;
}
line.clear(); //Ready for next textline
}
}
if (found) {
break;
}
}
if (found) {
nav_.display_modal("Error", "Frequency already exists");
big_display.set(frequency_list[current_index]); //After showing an error
big_display.set(current_frequency); //After showing an error
}
else {
scanner_file.append(freq_file_path); //Second: append if it is not there
@@ -370,7 +438,7 @@ ScannerView::ScannerView(
} else
{
nav_.display_modal("Error", "Cannot open " + loaded_file_name + ".TXT\nfor appending freq.");
big_display.set(frequency_list[current_index]); //After showing an error
big_display.set(current_frequency); //After showing an error
}
};
@@ -398,7 +466,7 @@ void ScannerView::frequency_file_load(std::string file_name, bool stop_all_befor
if ( load_freqman_file(file_name, database) ) {
loaded_file_name = file_name; // keep loaded filename in memory
for(auto& entry : database) { // READ LINE PER LINE
if (frequency_list.size() < MAX_DB_ENTRY) { //We got space!
if (frequency_list.size() < FREQMAN_MAX_PER_FILE ) { //We got space!
if (entry.type == RANGE) { //RANGE
switch (entry.step) {
case AM_US: def_step = 10000; break ;
@@ -421,7 +489,7 @@ void ScannerView::frequency_file_load(std::string file_name, bool stop_all_befor
+ ">" + to_string_short_freq(entry.frequency_b)
+ " S" + to_string_short_freq(def_step).erase(0,1) //euquiq: lame kludge to reduce spacing in step freq
);
while (frequency_list.size() < MAX_DB_ENTRY && entry.frequency_a <= entry.frequency_b) { //add the rest of the range
while (frequency_list.size() < FREQMAN_MAX_PER_FILE && entry.frequency_a <= entry.frequency_b) { //add the rest of the range
entry.frequency_a+=def_step;
frequency_list.push_back(entry.frequency_a);
description_list.push_back(""); //Token (keep showing the last description)
@@ -516,9 +584,9 @@ size_t ScannerView::change_mode(uint8_t new_mod) { //Before this, do a scan_thre
switch (new_mod) {
case NFM: //bw 16k (2) default
bw.emplace_back("8k5", 0);
bw.emplace_back("11k", 0);
bw.emplace_back("16k", 0);
bw.emplace_back("8k5 ", 0);
bw.emplace_back("11k ", 0);
bw.emplace_back("16k ", 0);
field_bw.set_options(bw);
baseband::run_image(portapack::spi_flash::image_tag_nfm_audio);
@@ -529,10 +597,12 @@ size_t ScannerView::change_mode(uint8_t new_mod) { //Before this, do a scan_thre
receiver_model.set_sampling_rate(3072000); receiver_model.set_baseband_bandwidth(1750000);
break;
case AM:
bw.emplace_back("DSB", 0);
bw.emplace_back("USB", 0);
bw.emplace_back("LSB", 0);
bw.emplace_back("CW ", 0);
bw.emplace_back("DSB 9k" , 0 );
bw.emplace_back("DSB 6k" , 1 );
bw.emplace_back("USB+3k" , 2 );
bw.emplace_back("LSB-3k" , 3 );
bw.emplace_back("CW " , 4 );
field_bw.set_options(bw);
baseband::run_image(portapack::spi_flash::image_tag_am_audio);
@@ -543,7 +613,7 @@ size_t ScannerView::change_mode(uint8_t new_mod) { //Before this, do a scan_thre
receiver_model.set_sampling_rate(3072000); receiver_model.set_baseband_bandwidth(1750000);
break;
case WFM:
bw.emplace_back("16k", 0);
bw.emplace_back("200k ", 0);
field_bw.set_options(bw);
baseband::run_image(portapack::spi_flash::image_tag_wfm_audio);
@@ -564,4 +634,10 @@ void ScannerView::start_scan_thread() {
scan_thread = std::make_unique<ScannerThread>(frequency_list);
}
void ScannerView::start_scan_thread(const jammer::jammer_range_t& frequency_range, size_t def_step) {
receiver_model.enable();
receiver_model.set_squelch_level(0);
scan_thread = std::make_unique<ScannerThread>(frequency_range, def_step);
}
} /* namespace ui */
+11 -6
View File
@@ -34,7 +34,6 @@
#include "file.hpp"
#define MAX_DB_ENTRY 500
#define MAX_FREQ_LOCK 10 //50ms cycles scanner locks into freq when signal detected, to verify signal is not spureous
namespace ui {
@@ -47,6 +46,7 @@ size_t const mod_step[3] = {9000, 100000, 12500 };
class ScannerThread {
public:
ScannerThread(std::vector<rf::Frequency> frequency_list);
ScannerThread(const jammer::jammer_range_t& frequency_range, size_t def_step);
~ScannerThread();
void set_scanning(const bool v);
@@ -68,6 +68,8 @@ public:
private:
std::vector<rf::Frequency> frequency_list_ { };
jammer::jammer_range_t frequency_range_ {false, 0, 0};
size_t def_step_ { 0 };
Thread* thread { nullptr };
bool _scanning { true };
@@ -76,6 +78,7 @@ private:
uint32_t _freq_del { 0 };
static msg_t static_fn(void* arg);
void run();
void create_thread();
};
class ScannerView : public View {
@@ -121,6 +124,7 @@ private:
NavigationView& nav_;
void start_scan_thread();
void start_scan_thread(const jammer::jammer_range_t& frequency_range, size_t def_step);
size_t change_mode(uint8_t mod_type);
void show_max();
void scan_pause();
@@ -130,7 +134,7 @@ private:
void on_statistics_update(const ChannelStatistics& statistics);
void on_headphone_volume_changed(int32_t v);
void handle_retune(uint32_t i);
void handle_retune(int64_t freq, uint32_t freq_idx);
jammer::jammer_range_t frequency_range { false, 0, 0 }; //perfect for manual scan task too...
int32_t squelch { 0 };
@@ -140,11 +144,12 @@ private:
freqman_db database { };
std::string loaded_file_name;
uint32_t current_index { 0 };
rf::Frequency current_frequency { 0 };
bool userpause { false };
Labels labels {
{ { 0 * 8, 0 * 16 }, "LNA: VGA: AMP: VOL:", Color::light_grey() },
{ { 0 * 8, 1* 16 }, "BW: SQUELCH: db WAIT:", Color::light_grey() },
{ { 0 * 8, 1* 16 }, "BW: SQLCH: db WAIT:", Color::light_grey() },
{ { 3 * 8, 10 * 16 }, "START END MANUAL", Color::light_grey() },
{ { 0 * 8, (26 * 8) + 4 }, "MODE:", Color::light_grey() },
{ { 11 * 8, (26 * 8) + 4 }, "STEP:", Color::light_grey() },
@@ -177,7 +182,7 @@ private:
};
NumberField field_squelch {
{ 15 * 8, 1 * 16 },
{ 18 * 8, 1 * 16 },
3,
{ -90, 20 },
1,
@@ -185,7 +190,7 @@ private:
};
NumberField field_wait {
{ 26 * 8, 1 * 16 },
{ 27 * 8, 1 * 16 },
2,
{ 0, 99 },
1,
@@ -296,7 +301,7 @@ private:
Message::ID::Retune,
[this](const Message* const p) {
const auto message = *reinterpret_cast<const RetuneMessage*>(p);
this->handle_retune(message.range);
this->handle_retune(message.freq, message.range);
}
};
+25 -13
View File
@@ -45,11 +45,11 @@ static void send_message(const Message* const message) {
void AMConfig::apply() const {
const AMConfigureMessage message {
taps_6k0_decim_0,
taps_6k0_decim_1,
taps_6k0_decim_2,
channel,
modulation,
taps_6k0_decim_0, // common FIR filter taps pre-decim_0 to all 5 x AM mod types.(AM-9K, AM-6K, USB, LSB, CW)
taps_6k0_decim_1, // common FIR filter taps pre-decim_1 to all 5 x AM mod. types.
decim_2, // var decim_2 FIR taps filter , variable values, depending selected AM mod(AM 9k / 6k all rest AM modes)
channel, // var channel FIR taps filter , variable values, depending selected AM mode, each one different (DSB-9K, DSB-6K, USB-3K, LSB-3K,CW)
modulation, // var parameter .
audio_12k_hpf_300hz_config
};
send_message(&message);
@@ -146,7 +146,7 @@ void set_btle(const uint32_t baudrate, const uint32_t word_length, const uint32_
};
send_message(&message);
}
void set_nrf(const uint32_t baudrate, const uint32_t word_length, const uint32_t trigger_value, const bool trigger_word) {
const NRFRxConfigureMessage message {
baudrate,
@@ -156,7 +156,7 @@ void set_nrf(const uint32_t baudrate, const uint32_t word_length, const uint32_t
};
send_message(&message);
}
void set_afsk_data(const uint32_t afsk_samples_per_bit, const uint32_t afsk_phase_inc_mark, const uint32_t afsk_phase_inc_space,
const uint8_t afsk_repeat, const uint32_t afsk_bw, const uint8_t symbol_count) {
const AFSKTxConfigureMessage message {
@@ -183,7 +183,7 @@ void kill_afsk() {
}
void set_audiotx_config(const uint32_t divider, const float deviation_hz, const float audio_gain,
uint8_t audio_shift_bits_s16, const uint32_t tone_key_delta, const bool am_enabled,
uint8_t audio_shift_bits_s16, const uint32_t tone_key_delta, const bool am_enabled,
const bool dsb_enabled, const bool usb_enabled, const bool lsb_enabled) {
const AudioTXConfigMessage message {
divider,
@@ -212,16 +212,28 @@ void set_pitch_rssi(int32_t avg, bool enabled) {
enabled,
avg
};
send_message(&message);
send_message(&message);
}
void set_ook_data(const uint32_t stream_length, const uint32_t samples_per_bit, const uint8_t repeat,
const uint32_t pause_symbols) {
const uint32_t pause_symbols, const uint8_t de_bruijn_length) {
const OOKConfigureMessage message {
stream_length,
samples_per_bit,
repeat,
pause_symbols
pause_symbols,
de_bruijn_length
};
send_message(&message);
}
void kill_ook() {
const OOKConfigureMessage message {
0,
0,
0,
0,
0
};
send_message(&message);
}
@@ -251,7 +263,7 @@ void set_adsb() {
void set_jammer(const bool run, const jammer::JammerType type, const uint32_t speed) {
const JammerConfigureMessage message {
run,
run,
type,
speed
};
@@ -312,7 +324,7 @@ void shutdown() {
send_message(&message);
shared_memory.application_queue.reset();
baseband_image_running = false;
}
+4 -2
View File
@@ -36,6 +36,7 @@
namespace baseband {
struct AMConfig {
const fir_taps_real<32> decim_2; // added to handle two types decim_2 9k, 6k
const fir_taps_complex<64> channel;
const AMConfigureMessage::Modulation modulation;
@@ -61,7 +62,7 @@ void set_tones_config(const uint32_t bw, const uint32_t pre_silence, const uint1
void kill_tone();
void set_sstv_data(const uint8_t vis_code, const uint32_t pixel_duration);
void set_audiotx_config(const uint32_t divider, const float deviation_hz, const float audio_gain,
uint8_t audio_shift_bits_s16, const uint32_t tone_key_delta, const bool am_enabled,
uint8_t audio_shift_bits_s16, const uint32_t tone_key_delta, const bool am_enabled,
const bool dsb_enabled, const bool usb_enabled, const bool lsb_enabled);
void set_fifo_data(const int8_t * data);
void set_pitch_rssi(int32_t avg, bool enabled);
@@ -76,7 +77,8 @@ void set_btle(const uint32_t baudrate, const uint32_t word_length, const uint32_
void set_nrf(const uint32_t baudrate, const uint32_t word_length, const uint32_t trigger_value, const bool trigger_word);
void set_ook_data(const uint32_t stream_length, const uint32_t samples_per_bit, const uint8_t repeat,
const uint32_t pause_symbols);
const uint32_t pause_symbols, const uint8_t de_bruijn_length = 0);
void kill_ook();
void set_fsk_data(const uint32_t stream_length, const uint32_t samples_per_bit, const uint32_t shift,
const uint32_t progress_notice);
void set_pocsag();
+9 -91
View File
@@ -34,10 +34,11 @@ options_t freqman_entry_modulations = {
options_t freqman_entry_bandwidths[ 4 ] = {
{ //AM
{ "DSB", 0 },
{ "USB", 1 },
{ "LSB", 2 },
{ "CW" , 3 }
{ "DSB 9k" , 0 },
{ "DSB 6k" , 1 },
{ "USB+3k" , 2 },
{ "LSB-3k" , 3 },
{ "CW" , 4 }
},
{ //NFM
{ "8k5" , 0 },
@@ -45,7 +46,7 @@ options_t freqman_entry_bandwidths[ 4 ] = {
{ "16k" , 2 }
},
{ //WFM
{ "16k" , 0 },
{ "200k" , 0 },
}
};
@@ -58,10 +59,11 @@ options_t freqman_entry_steps = {
{ "12.5KHz(NFM)" , 12500 },
{ "15KHz (HFM)" , 15000 },
{ "25KHz (N1)" , 25000 },
{ "30KHz (OIRT)" , 30000 },
{ "50KHz (FM1)" , 50000 },
{ "100KHz (FM2)" , 100000 },
{ "250KHz (N2)" , 250000 },
{ "500KHz " , 500000 },
{ "500KHz (WFM)" , 500000 },
{ "1MHz " , 1000000 }
};
@@ -74,6 +76,7 @@ options_t freqman_entry_steps_short = {
{ "12.5KHz" , 12500 },
{ "15KHz" , 15000 },
{ "25KHz" , 25000 },
{ "30KHz" , 30000 },
{ "50KHz" , 50000 },
{ "100KHz" , 100000 },
{ "250KHz" , 250000 },
@@ -99,91 +102,6 @@ std::vector<std::string> get_freqman_files() {
bool load_freqman_file(std::string& file_stem, freqman_db &db) {
return load_freqman_file_ex( file_stem , db , true , true , true );
/* File freqman_file;
size_t length, n = 0, file_position = 0;
char * pos;
char * line_start;
char * line_end;
std::string description;
rf::Frequency frequency_a, frequency_b;
char file_data[257];
freqman_entry_type type;
db.clear();
auto result = freqman_file.open("FREQMAN/" + file_stem + ".TXT");
if (result.is_valid())
return false;
while (1) {
// Read a 256 bytes block from file
freqman_file.seek(file_position);
memset(file_data, 0, 257);
auto read_size = freqman_file.read(file_data, 256);
if (read_size.is_error())
return false; // Read error
file_position += 256;
// Reset line_start to beginning of buffer
line_start = file_data;
if (!strstr(file_data, "f=") && !strstr(file_data, "a="))
break;
// Look for complete lines in buffer
while ((line_end = strstr(line_start, "\x0A"))) {
// Read frequency
pos = strstr(line_start, "f=");
frequency_b = 0;
type = SINGLE;
if (pos) {
pos += 2;
frequency_a = strtoll(pos, nullptr, 10);
} else {
// ...or range
pos = strstr(line_start, "a=");
if (pos) {
pos += 2;
frequency_a = strtoll(pos, nullptr, 10);
type = RANGE;
pos = strstr(line_start, "b=");
if (pos) {
pos += 2;
frequency_b = strtoll(pos, nullptr, 10);
} else
frequency_b = 0;
} else
frequency_a = 0;
}
// Read description until , or LF
pos = strstr(line_start, "d=");
if (pos) {
pos += 2;
length = std::min(strcspn(pos, ",\x0A"), (size_t)FREQMAN_DESC_MAX_LEN);
description = string(pos, length);
} else
description = "-";
db.push_back({ frequency_a, frequency_b, description, type , -1 , -1 , -1 , -1 });
n++;
if (n >= FREQMAN_MAX_PER_FILE) return true;
line_start = line_end + 1;
if (line_start - file_data >= 256) break;
}
if (read_size.value() != 256)
break; // End of file
// Restart at beginning of last incomplete line
file_position -= (file_data + 256 - line_start);
}
return true;
*/
}
bool load_freqman_file_ex(std::string& file_stem, freqman_db& db, bool load_freqs , bool load_ranges , bool load_hamradios ) {
+2 -2
View File
@@ -32,8 +32,8 @@
#include "ui_widget.hpp"
#define FREQMAN_DESC_MAX_LEN 30
#define FREQMAN_MAX_PER_FILE 99
#define FREQMAN_MAX_PER_FILE_STR "99"
#define FREQMAN_MAX_PER_FILE 500 /* MAX PER FILES */
#define FREQMAN_MAX_PER_FILE_STR "500" /*STRING OF FREQMAN_MAX_PER_FILE */
using namespace ui;
using namespace std;
+15 -5
View File
@@ -38,11 +38,12 @@ using namespace portapack;
namespace {
static constexpr std::array<baseband::AMConfig, 4> am_configs { {
{ taps_6k0_dsb_channel, AMConfigureMessage::Modulation::DSB },
{ taps_2k8_usb_channel, AMConfigureMessage::Modulation::SSB },
{ taps_2k8_lsb_channel, AMConfigureMessage::Modulation::SSB },
{ taps_0k7_usb_channel, AMConfigureMessage::Modulation::SSB },
static constexpr std::array<baseband::AMConfig, 5> am_configs { { // we config here all the non COMMON parameters to each AM modulation type in RX.
{ taps_9k0_decim_2, taps_9k0_dsb_channel, AMConfigureMessage::Modulation::DSB }, // AM DSB-C BW 9khz (+-4k5) commercial EU bandwidth .
{ taps_6k0_decim_2, taps_6k0_dsb_channel, AMConfigureMessage::Modulation::DSB }, // AM DSB-C BW 6khz (+-3k0) narrow AM , ham equipments.
{ taps_6k0_decim_2, taps_2k8_usb_channel, AMConfigureMessage::Modulation::SSB }, // SSB USB BW 2K8 (+ 2K8)
{ taps_6k0_decim_2, taps_2k8_lsb_channel, AMConfigureMessage::Modulation::SSB }, // SSB LSB BW 2K8 (- 2K8)
{ taps_6k0_decim_2, taps_0k7_usb_channel, AMConfigureMessage::Modulation::SSB }, // SSB USB BW 0K7 (+ 0K7) used to get audio tone from CW Morse, assuming tx shifted +700hz aprox
} };
static constexpr std::array<baseband::NBFMConfig, 3> nbfm_configs { {
@@ -312,3 +313,12 @@ size_t ReceiverModel::wfm_configuration() const {
void ReceiverModel::update_wfm_configuration() {
wfm_configs[wfm_config_index].apply();
}
void ReceiverModel::set_configuration_without_init(const Mode new_mode, const rf::Frequency new_frequency_step, const size_t new_am_config_index, const size_t new_nbfm_config_index, const size_t new_wfm_config_index, uint8_t new_squelch_level) {
mode_ = new_mode;
frequency_step_ = new_frequency_step;
am_config_index = new_am_config_index;
nbfm_config_index = new_nbfm_config_index;
wfm_config_index = new_wfm_config_index;
squelch_level_ = new_squelch_level;
}
+2
View File
@@ -87,6 +87,8 @@ public:
size_t wfm_configuration() const;
void set_wfm_configuration(const size_t n);
void set_configuration_without_init(const Mode new_mode, const rf::Frequency new_frequency_step, const size_t new_am_config_index, const size_t new_nbfm_config_index, const size_t new_wfm_config_index, uint8_t new_squelch_level);
private:
rf::Frequency frequency_step_ { 25000 };
bool enabled_ { false };
+256 -256
View File
@@ -281,262 +281,262 @@ const std::array<ui::Color, 256> spectrum_rgb2_lut { {
} };
const std::array<ui::Color, 256> spectrum_rgb3_lut { {
{ 0, 0, 0 },
{ 0, 0, 3 },
{ 0, 0, 6 },
{ 0, 0, 9 },
{ 0, 0, 12 },
{ 0, 0, 15 },
{ 0, 0, 18 },
{ 0, 0, 21 },
{ 0, 0, 24 },
{ 0, 0, 27 },
{ 0, 0, 30 },
{ 0, 0, 33 },
{ 0, 0, 36 },
{ 0, 0, 39 },
{ 0, 0, 42 },
{ 0, 0, 45 },
{ 0, 0, 48 },
{ 0, 0, 51 },
{ 0, 0, 54 },
{ 0, 0, 57 },
{ 0, 0, 60 },
{ 0, 0, 63 },
{ 0, 0, 66 },
{ 0, 0, 69 },
{ 0, 0, 72 },
{ 0, 0, 75 },
{ 0, 0, 78 },
{ 0, 0, 81 },
{ 0, 0, 84 },
{ 0, 0, 87 },
{ 0, 0, 90 },
{ 0, 0, 93 },
{ 0, 0, 96 },
{ 0, 0, 99 },
{ 0, 0, 102 },
{ 0, 0, 105 },
{ 0, 0, 108 },
{ 0, 0, 111 },
{ 0, 0, 114 },
{ 0, 0, 117 },
{ 0, 0, 120 },
{ 0, 0, 123 },
{ 0, 0, 126 },
{ 0, 0, 129 },
{ 0, 0, 132 },
{ 0, 0, 135 },
{ 0, 0, 138 },
{ 0, 0, 141 },
{ 0, 0, 144 },
{ 0, 0, 147 },
{ 0, 0, 150 },
{ 0, 0, 153 },
{ 0, 0, 156 },
{ 0, 0, 159 },
{ 0, 0, 162 },
{ 0, 0, 165 },
{ 0, 0, 168 },
{ 0, 0, 171 },
{ 0, 0, 174 },
{ 0, 0, 177 },
{ 0, 0, 180 },
{ 0, 0, 183 },
{ 0, 0, 186 },
{ 0, 0, 189 },
{ 0, 0, 192 },
{ 0, 0, 195 },
{ 0, 0, 198 },
{ 0, 0, 201 },
{ 0, 0, 204 },
{ 0, 0, 207 },
{ 0, 0, 210 },
{ 0, 0, 213 },
{ 0, 0, 216 },
{ 0, 0, 219 },
{ 0, 0, 222 },
{ 0, 0, 225 },
{ 0, 0, 228 },
{ 0, 0, 231 },
{ 0, 0, 234 },
{ 0, 0, 237 },
{ 0, 0, 240 },
{ 0, 0, 243 },
{ 0, 0, 246 },
{ 0, 0, 249 },
{ 0, 0, 252 },
{ 0, 0, 255 },
{ 0, 3, 252 },
{ 0, 6, 249 },
{ 0, 9, 246 },
{ 0, 12, 243 },
{ 0, 15, 240 },
{ 0, 18, 237 },
{ 0, 21, 234 },
{ 0, 24, 231 },
{ 0, 27, 228 },
{ 0, 30, 225 },
{ 0, 33, 222 },
{ 0, 36, 219 },
{ 0, 39, 216 },
{ 0, 42, 213 },
{ 0, 45, 210 },
{ 0, 48, 207 },
{ 0, 51, 204 },
{ 0, 54, 201 },
{ 0, 57, 198 },
{ 0, 60, 195 },
{ 0, 63, 192 },
{ 0, 66, 189 },
{ 0, 69, 186 },
{ 0, 72, 183 },
{ 0, 75, 180 },
{ 0, 78, 177 },
{ 0, 81, 174 },
{ 0, 84, 171 },
{ 0, 87, 168 },
{ 0, 90, 165 },
{ 0, 93, 162 },
{ 0, 96, 159 },
{ 0, 99, 156 },
{ 0, 102, 153 },
{ 0, 105, 150 },
{ 0, 108, 147 },
{ 0, 111, 144 },
{ 0, 114, 141 },
{ 0, 117, 138 },
{ 0, 120, 135 },
{ 0, 123, 132 },
{ 0, 126, 129 },
{ 0, 129, 126 },
{ 0, 132, 123 },
{ 0, 135, 120 },
{ 0, 138, 117 },
{ 0, 141, 114 },
{ 0, 144, 111 },
{ 0, 147, 108 },
{ 0, 150, 105 },
{ 0, 153, 102 },
{ 0, 156, 99 },
{ 0, 159, 96 },
{ 0, 162, 93 },
{ 0, 165, 90 },
{ 0, 168, 87 },
{ 0, 171, 84 },
{ 0, 174, 81 },
{ 0, 177, 78 },
{ 0, 180, 75 },
{ 0, 183, 72 },
{ 0, 186, 69 },
{ 0, 189, 66 },
{ 0, 192, 63 },
{ 0, 195, 60 },
{ 0, 198, 57 },
{ 0, 201, 54 },
{ 0, 204, 51 },
{ 0, 207, 48 },
{ 0, 210, 45 },
{ 0, 213, 42 },
{ 0, 216, 39 },
{ 0, 219, 36 },
{ 0, 222, 33 },
{ 0, 225, 30 },
{ 0, 228, 27 },
{ 0, 231, 24 },
{ 0, 234, 21 },
{ 0, 237, 18 },
{ 0, 240, 15 },
{ 0, 243, 12 },
{ 0, 246, 9 },
{ 0, 249, 6 },
{ 0, 252, 3 },
{ 0, 255, 0 },
{ 3, 252, 0 },
{ 6, 249, 0 },
{ 9, 246, 0 },
{ 12, 243, 0 },
{ 15, 240, 0 },
{ 18, 237, 0 },
{ 21, 234, 0 },
{ 24, 231, 0 },
{ 27, 228, 0 },
{ 30, 225, 0 },
{ 33, 222, 0 },
{ 36, 219, 0 },
{ 39, 216, 0 },
{ 42, 213, 0 },
{ 45, 210, 0 },
{ 48, 207, 0 },
{ 51, 204, 0 },
{ 54, 201, 0 },
{ 57, 198, 0 },
{ 60, 195, 0 },
{ 63, 192, 0 },
{ 66, 189, 0 },
{ 69, 186, 0 },
{ 72, 183, 0 },
{ 75, 180, 0 },
{ 78, 177, 0 },
{ 81, 174, 0 },
{ 84, 171, 0 },
{ 87, 168, 0 },
{ 90, 165, 0 },
{ 93, 162, 0 },
{ 96, 159, 0 },
{ 99, 156, 0 },
{ 102, 153, 0 },
{ 105, 150, 0 },
{ 108, 147, 0 },
{ 111, 144, 0 },
{ 114, 141, 0 },
{ 117, 138, 0 },
{ 120, 135, 0 },
{ 123, 132, 0 },
{ 126, 129, 0 },
{ 129, 126, 0 },
{ 132, 123, 0 },
{ 135, 120, 0 },
{ 138, 117, 0 },
{ 141, 114, 0 },
{ 144, 111, 0 },
{ 147, 108, 0 },
{ 150, 105, 0 },
{ 153, 102, 0 },
{ 156, 99, 0 },
{ 159, 96, 0 },
{ 162, 93, 0 },
{ 165, 90, 0 },
{ 168, 87, 0 },
{ 171, 84, 0 },
{ 174, 81, 0 },
{ 177, 78, 0 },
{ 180, 75, 0 },
{ 183, 72, 0 },
{ 186, 69, 0 },
{ 189, 66, 0 },
{ 192, 63, 0 },
{ 195, 60, 0 },
{ 198, 57, 0 },
{ 201, 54, 0 },
{ 204, 51, 0 },
{ 207, 48, 0 },
{ 210, 45, 0 },
{ 213, 42, 0 },
{ 216, 39, 0 },
{ 219, 36, 0 },
{ 222, 33, 0 },
{ 225, 30, 0 },
{ 228, 27, 0 },
{ 231, 24, 0 },
{ 234, 21, 0 },
{ 237, 18, 0 },
{ 240, 15, 0 },
{ 243, 12, 0 },
{ 246, 9, 0 },
{ 249, 6, 0 },
{ 252, 3, 0 },
{ 255, 0, 0 },
{ 0x00, 0x00, 0x02 },
{ 0x00, 0x00, 0x04 },
{ 0x00, 0x00, 0x05 },
{ 0x00, 0x00, 0x07 },
{ 0x00, 0x00, 0x0a },
{ 0x00, 0x00, 0x0c },
{ 0x00, 0x00, 0x0e },
{ 0x00, 0x00, 0x10 },
{ 0x00, 0x00, 0x13 },
{ 0x00, 0x00, 0x15 },
{ 0x00, 0x00, 0x17 },
{ 0x00, 0x00, 0x19 },
{ 0x00, 0x00, 0x1b },
{ 0x00, 0x00, 0x1d },
{ 0x00, 0x00, 0x1f },
{ 0x00, 0x00, 0x21 },
{ 0x00, 0x00, 0x24 },
{ 0x00, 0x00, 0x25 },
{ 0x00, 0x00, 0x28 },
{ 0x00, 0x00, 0x29 },
{ 0x00, 0x00, 0x2c },
{ 0x00, 0x00, 0x2e },
{ 0x00, 0x00, 0x30 },
{ 0x00, 0x00, 0x33 },
{ 0x00, 0x00, 0x35 },
{ 0x00, 0x00, 0x37 },
{ 0x00, 0x00, 0x39 },
{ 0x00, 0x00, 0x3b },
{ 0x00, 0x00, 0x3d },
{ 0x00, 0x00, 0x3f },
{ 0x00, 0x00, 0x41 },
{ 0x00, 0x00, 0x43 },
{ 0x00, 0x00, 0x46 },
{ 0x00, 0x00, 0x48 },
{ 0x00, 0x00, 0x4a },
{ 0x00, 0x00, 0x4c },
{ 0x00, 0x00, 0x4e },
{ 0x00, 0x00, 0x50 },
{ 0x00, 0x00, 0x53 },
{ 0x00, 0x00, 0x55 },
{ 0x00, 0x00, 0x56 },
{ 0x00, 0x00, 0x59 },
{ 0x00, 0x00, 0x5b },
{ 0x00, 0x00, 0x5d },
{ 0x00, 0x00, 0x5f },
{ 0x00, 0x00, 0x62 },
{ 0x00, 0x00, 0x63 },
{ 0x00, 0x00, 0x66 },
{ 0x00, 0x00, 0x68 },
{ 0x00, 0x00, 0x6a },
{ 0x00, 0x00, 0x6c },
{ 0x00, 0x00, 0x6e },
{ 0x00, 0x00, 0x70 },
{ 0x00, 0x00, 0x73 },
{ 0x00, 0x00, 0x75 },
{ 0x00, 0x00, 0x77 },
{ 0x00, 0x00, 0x79 },
{ 0x00, 0x00, 0x7b },
{ 0x00, 0x00, 0x7d },
{ 0x00, 0x00, 0x7f },
{ 0x00, 0x00, 0x82 },
{ 0x00, 0x00, 0x84 },
{ 0x00, 0x00, 0x86 },
{ 0x00, 0x00, 0x88 },
{ 0x00, 0x00, 0x8a },
{ 0x00, 0x00, 0x8c },
{ 0x00, 0x00, 0x8e },
{ 0x00, 0x00, 0x91 },
{ 0x00, 0x00, 0x93 },
{ 0x00, 0x00, 0x95 },
{ 0x00, 0x00, 0x97 },
{ 0x00, 0x00, 0x99 },
{ 0x00, 0x00, 0x9b },
{ 0x00, 0x00, 0x9d },
{ 0x00, 0x00, 0x9f },
{ 0x00, 0x00, 0xa2 },
{ 0x00, 0x00, 0xa4 },
{ 0x00, 0x00, 0xa6 },
{ 0x00, 0x00, 0xa8 },
{ 0x00, 0x00, 0xaa },
{ 0x00, 0x00, 0xac },
{ 0x00, 0x00, 0xae },
{ 0x00, 0x00, 0xb1 },
{ 0x00, 0x00, 0xb3 },
{ 0x00, 0x00, 0xb5 },
{ 0x00, 0x00, 0xb7 },
{ 0x00, 0x00, 0xb9 },
{ 0x00, 0x00, 0xbb },
{ 0x00, 0x00, 0xbd },
{ 0x00, 0x00, 0xbf },
{ 0x00, 0x00, 0xc2 },
{ 0x00, 0x00, 0xc4 },
{ 0x00, 0x00, 0xc6 },
{ 0x00, 0x00, 0xc8 },
{ 0x00, 0x00, 0xca },
{ 0x00, 0x00, 0xcc },
{ 0x00, 0x00, 0xce },
{ 0x00, 0x00, 0xd1 },
{ 0x00, 0x00, 0xd3 },
{ 0x00, 0x00, 0xd5 },
{ 0x00, 0x00, 0xd7 },
{ 0x00, 0x00, 0xd9 },
{ 0x00, 0x00, 0xdb },
{ 0x00, 0x00, 0xdd },
{ 0x00, 0x00, 0xdf },
{ 0x00, 0x00, 0xe2 },
{ 0x00, 0x00, 0xe4 },
{ 0x00, 0x00, 0xe6 },
{ 0x00, 0x00, 0xe8 },
{ 0x00, 0x00, 0xea },
{ 0x00, 0x00, 0xec },
{ 0x00, 0x00, 0xee },
{ 0x00, 0x00, 0xf1 },
{ 0x00, 0x00, 0xf3 },
{ 0x00, 0x00, 0xf5 },
{ 0x00, 0x00, 0xf7 },
{ 0x00, 0x00, 0xf9 },
{ 0x00, 0x00, 0xfb },
{ 0x00, 0x00, 0xfd },
{ 0x01, 0x00, 0xfe },
{ 0x05, 0x00, 0xfa },
{ 0x09, 0x00, 0xf6 },
{ 0x0e, 0x00, 0xf2 },
{ 0x12, 0x00, 0xed },
{ 0x16, 0x00, 0xe9 },
{ 0x1b, 0x00, 0xe4 },
{ 0x1f, 0x00, 0xe0 },
{ 0x24, 0x00, 0xdc },
{ 0x27, 0x00, 0xd8 },
{ 0x2c, 0x00, 0xd3 },
{ 0x30, 0x00, 0xcf },
{ 0x35, 0x00, 0xcb },
{ 0x39, 0x00, 0xc6 },
{ 0x3d, 0x00, 0xc2 },
{ 0x42, 0x00, 0xbd },
{ 0x46, 0x00, 0xb9 },
{ 0x4b, 0x00, 0xb5 },
{ 0x4f, 0x00, 0xb0 },
{ 0x53, 0x00, 0xac },
{ 0x58, 0x00, 0xa7 },
{ 0x5c, 0x00, 0xa3 },
{ 0x61, 0x00, 0x9f },
{ 0x65, 0x00, 0x9a },
{ 0x69, 0x00, 0x96 },
{ 0x6e, 0x00, 0x91 },
{ 0x72, 0x00, 0x8d },
{ 0x77, 0x00, 0x89 },
{ 0x7b, 0x00, 0x84 },
{ 0x7f, 0x00, 0x80 },
{ 0x84, 0x00, 0x7b },
{ 0x88, 0x00, 0x77 },
{ 0x8d, 0x00, 0x73 },
{ 0x91, 0x00, 0x6e },
{ 0x95, 0x00, 0x6a },
{ 0x9a, 0x00, 0x65 },
{ 0x9e, 0x00, 0x61 },
{ 0xa3, 0x00, 0x5d },
{ 0xa7, 0x00, 0x58 },
{ 0xab, 0x00, 0x54 },
{ 0xb0, 0x00, 0x4f },
{ 0xb4, 0x00, 0x4b },
{ 0xb9, 0x00, 0x47 },
{ 0xbd, 0x00, 0x42 },
{ 0xc1, 0x00, 0x3e },
{ 0xc6, 0x00, 0x39 },
{ 0xca, 0x00, 0x35 },
{ 0xcf, 0x00, 0x31 },
{ 0xd3, 0x00, 0x2c },
{ 0xd7, 0x00, 0x28 },
{ 0xdc, 0x00, 0x23 },
{ 0xe0, 0x00, 0x1f },
{ 0xe5, 0x00, 0x1b },
{ 0xe9, 0x00, 0x16 },
{ 0xed, 0x00, 0x12 },
{ 0xf2, 0x00, 0x0d },
{ 0xf6, 0x00, 0x09 },
{ 0xfb, 0x00, 0x05 },
{ 0xfe, 0x01, 0x01 },
{ 0xff, 0x06, 0x00 },
{ 0xff, 0x0d, 0x00 },
{ 0xff, 0x13, 0x00 },
{ 0xff, 0x1a, 0x00 },
{ 0xff, 0x20, 0x00 },
{ 0xff, 0x26, 0x00 },
{ 0xff, 0x2d, 0x00 },
{ 0xff, 0x33, 0x00 },
{ 0xff, 0x3a, 0x00 },
{ 0xff, 0x40, 0x00 },
{ 0xff, 0x46, 0x00 },
{ 0xff, 0x4d, 0x00 },
{ 0xff, 0x53, 0x00 },
{ 0xff, 0x59, 0x00 },
{ 0xff, 0x60, 0x00 },
{ 0xff, 0x66, 0x00 },
{ 0xff, 0x6c, 0x00 },
{ 0xff, 0x73, 0x00 },
{ 0xff, 0x79, 0x00 },
{ 0xff, 0x80, 0x00 },
{ 0xff, 0x86, 0x00 },
{ 0xff, 0x8c, 0x00 },
{ 0xff, 0x93, 0x00 },
{ 0xff, 0x99, 0x00 },
{ 0xff, 0x9f, 0x00 },
{ 0xff, 0xa6, 0x00 },
{ 0xff, 0xac, 0x00 },
{ 0xff, 0xb3, 0x00 },
{ 0xff, 0xb9, 0x00 },
{ 0xff, 0xbf, 0x00 },
{ 0xff, 0xc6, 0x00 },
{ 0xff, 0xcc, 0x00 },
{ 0xff, 0xd2, 0x00 },
{ 0xff, 0xd9, 0x00 },
{ 0xff, 0xdf, 0x00 },
{ 0xff, 0xe6, 0x00 },
{ 0xff, 0xec, 0x00 },
{ 0xff, 0xf2, 0x00 },
{ 0xff, 0xf9, 0x00 },
{ 0xff, 0xfe, 0x01 },
{ 0xff, 0xff, 0x06 },
{ 0xff, 0xff, 0x0d },
{ 0xff, 0xff, 0x14 },
{ 0xff, 0xff, 0x1b },
{ 0xff, 0xff, 0x21 },
{ 0xff, 0xff, 0x28 },
{ 0xff, 0xff, 0x2f },
{ 0xff, 0xff, 0x35 },
{ 0xff, 0xff, 0x3c },
{ 0xff, 0xff, 0x42 },
{ 0xff, 0xff, 0x49 },
{ 0xff, 0xff, 0x4f },
{ 0xff, 0xff, 0x56 },
{ 0xff, 0xff, 0x5d },
{ 0xff, 0xff, 0x63 },
{ 0xff, 0xff, 0x6a },
{ 0xff, 0xff, 0x71 },
{ 0xff, 0xff, 0x77 },
{ 0xff, 0xff, 0x7e },
{ 0xff, 0xff, 0x84 },
{ 0xff, 0xff, 0x8b },
{ 0xff, 0xff, 0x92 },
{ 0xff, 0xff, 0x98 },
{ 0xff, 0xff, 0x9f },
{ 0xff, 0xff, 0xa6 },
{ 0xff, 0xff, 0xac },
{ 0xff, 0xff, 0xb3 },
{ 0xff, 0xff, 0xb9 },
{ 0xff, 0xff, 0xc0 },
{ 0xff, 0xff, 0xc7 },
{ 0xff, 0xff, 0xcd },
{ 0xff, 0xff, 0xd4 },
{ 0xff, 0xff, 0xdb },
{ 0xff, 0xff, 0xe1 },
{ 0xff, 0xff, 0xe8 },
{ 0xff, 0xff, 0xee },
{ 0xff, 0xff, 0xf5 },
{ 0xff, 0xff, 0xfb }
} };
const std::array<ui::Color, 256> spectrum_rgb4_lut { {
+113 -22
View File
@@ -27,15 +27,88 @@
#include <cstdint>
void OOKProcessor::execute(const buffer_c8_t& buffer) {
inline void OOKProcessor::write_sample(const buffer_c8_t& buffer, uint8_t bit_value, size_t i) {
int8_t re, im;
if (bit_value) {
phase = (phase + 200); // What ?
sphase = phase + (64 << 18);
re = (sine_table_i8[(sphase & 0x03FC0000) >> 18]);
im = (sine_table_i8[(phase & 0x03FC0000) >> 18]);
} else {
re = 0;
im = 0;
}
buffer.p[i] = {re, im};
}
inline void OOKProcessor::duval_algo(const buffer_c8_t& buffer) {
size_t buf_ptr = 0;
const unsigned int w = de_bruijn_length;
// Duval's algorithm for generating de Bruijn sequence
while (idx) {
if (w % idx == 0) {
for (; k < idx; k++) {
size_t available_size = buffer.count - buf_ptr;
size_t len = (samples_per_bit > available_size) ? available_size : samples_per_bit;
for (; bit_ptr < len; bit_ptr++) {
write_sample(buffer, v[k], buf_ptr);
buf_ptr++;
}
if (buf_ptr == buffer.count) {
txprogress_message.done = false;
txprogress_message.progress = scan_progress++;
shared_memory.application_queue.push(txprogress_message);
return;
}
bit_ptr = 0;
}
k = 0;
}
for (unsigned int j = 0; j < w - idx; j++)
v[idx + j] = v[j];
for (idx = w; idx > 0 && v[idx - 1]; idx--) ;
if (idx)
v[idx - 1] = 1;
}
// clear the buffer in case we have any bytes left
if (buf_ptr < buffer.count) {
for (size_t i = buf_ptr; i < buffer.count; i++) {
buffer.p[i] = {0, 0};
}
}
if (!scan_done) {
txprogress_message.done = true;
shared_memory.application_queue.push(txprogress_message);
}
scan_done = 1;
}
void OOKProcessor::execute(const buffer_c8_t& buffer) {
// This is called at 2.28M/2048 = 1113Hz
if (!configured) return;
if (de_bruijn_length) {
duval_algo(buffer);
return;
}
for (size_t i = 0; i < buffer.count; i++) {
// Synthesis at 2.28M/10 = 228kHz
if (!s) {
s = 10 - 1;
@@ -49,11 +122,11 @@ void OOKProcessor::execute(const buffer_c8_t& buffer) {
} else if (pause_counter == 1) {
if (repeat_counter < repeat) {
// Repeat
bit_pos = 0;
cur_bit = shared_memory.bb_data.data[0] & 0x80;
txprogress_message.progress = repeat_counter + 1;
txprogress_message.done = false;
shared_memory.application_queue.push(txprogress_message);
bit_pos = 1;
repeat_counter++;
} else {
// Stop
@@ -71,7 +144,7 @@ void OOKProcessor::execute(const buffer_c8_t& buffer) {
bit_pos++;
}
}
sample_count = 0;
} else {
sample_count++;
@@ -79,31 +152,49 @@ void OOKProcessor::execute(const buffer_c8_t& buffer) {
} else {
s--;
}
if (cur_bit) {
phase = (phase + 200); // What ?
sphase = phase + (64 << 18);
re = (sine_table_i8[(sphase & 0x03FC0000) >> 18]);
im = (sine_table_i8[(phase & 0x03FC0000) >> 18]);
} else {
re = 0;
im = 0;
}
buffer.p[i] = {re, im};
write_sample(buffer, cur_bit, i);
}
}
void OOKProcessor::on_message(const Message* const p) {
const auto message = *reinterpret_cast<const OOKConfigureMessage*>(p);
if (message.id == Message::ID::OOKConfigure) {
samples_per_bit = message.samples_per_bit / 10;
configured = false;
repeat = message.repeat - 1;
length = message.stream_length;
pause = message.pause_symbols + 1;
de_bruijn_length = message.de_bruijn_length;
samples_per_bit = message.samples_per_bit;
if (!length && !samples_per_bit) {
// shutdown
return;
}
if (de_bruijn_length) {
if (de_bruijn_length > sizeof(v)) {
return;
}
if (samples_per_bit > 2048) {
// can't handle more than dma::transfer_samples
return;
}
k = 0;
bit_ptr = 0;
idx = 1;
scan_done = false;
scan_progress = 0;
memset(v, 0, sizeof(v));
} else {
samples_per_bit /= 10;
}
pause_counter = 0;
s = 0;
sample_count = samples_per_bit;
+17 -5
View File
@@ -29,19 +29,20 @@
class OOKProcessor : public BasebandProcessor {
public:
void execute(const buffer_c8_t& buffer) override;
void on_message(const Message* const p) override;
private:
bool configured = false;
BasebandThread baseband_thread { 2280000, this, NORMALPRIO + 20, baseband::Direction::Transmit };
uint32_t samples_per_bit { 0 };
uint8_t repeat { 0 };
uint32_t length { 0 };
uint32_t pause { 0 };
uint8_t de_bruijn_length { 0 };
uint32_t pause_counter { 0 };
uint8_t repeat_counter { 0 };
uint8_t s { 0 };
@@ -50,8 +51,19 @@ private:
uint32_t sample_count { 0 };
uint32_t tone_phase { 0 }, phase { 0 }, sphase { 0 };
int32_t tone_sample { 0 }, sig { 0 }, frq { 0 };
TXProgressMessage txprogress_message { };
static constexpr auto MAX_DE_BRUIJN_ORDER = 24;
uint8_t v[MAX_DE_BRUIJN_ORDER];
unsigned int idx { 0 };
unsigned int k { 0 };
size_t bit_ptr{ 0 };
size_t scan_progress{ 0 };
uint8_t scan_done { true };
void write_sample(const buffer_c8_t& buffer, uint8_t bit_value, size_t i);
void duval_algo(const buffer_c8_t& buffer);
};
#endif
+17 -10
View File
@@ -307,26 +307,33 @@ adsb_pos decode_frame_pos(ADSBFrame& frame_even, ADSBFrame& frame_odd) {
void encode_frame_velo(ADSBFrame& frame, const uint32_t ICAO_address, const uint32_t speed,
const float angle, const int32_t v_rate) {
int32_t velo_ew, velo_ns, v_rate_coded;
int32_t velo_ew, velo_ns;
uint32_t velo_ew_abs, velo_ns_abs, v_rate_coded_abs;
// To get NS and EW speeds from speed and bearing, a polar to cartesian conversion is enough
velo_ew = static_cast<int32_t>(sin_f32(DEG_TO_RAD(angle) + (pi / 2)) * speed);
velo_ns = static_cast<int32_t>(sin_f32(DEG_TO_RAD(angle)) * speed);
velo_ew = static_cast<int32_t>(sin_f32(DEG_TO_RAD(angle) ) * speed); // East direction, is the projection from West -> East is directly sin(angle=Compas Bearing) , (90º is the max +1, EAST) max velo_EW
velo_ns = static_cast<int32_t>(sin_f32( (pi/2 - DEG_TO_RAD(angle) ) ) * speed); // North direction,is the projection of North = cos(angle=Compas Bearing), cos(angle)= sen(90-angle) (0º is the max +1 NORTH) max velo_NS
v_rate_coded = (v_rate / 64) + 1;
velo_ew_abs = abs(velo_ew) + 1;
velo_ns_abs = abs(velo_ns) + 1;
v_rate_coded_abs = abs(v_rate_coded);
v_rate_coded_abs = (abs(v_rate) / 64) + 1; //encoding vertical rate source. (Decoding, VR ft/min = (Decimal v_rate_value - 1)* 64)
velo_ew_abs = abs(velo_ew) + 1; // encoding Velo speed EW , when sign Direction is 0 (+): West->East, (-) 1: East->West
velo_ns_abs = abs(velo_ns) + 1; // encoding Velo speed NS , when sign Direction is 0 (+): South->North , (-) 1: North->South
make_frame_adsb(frame, ICAO_address);
frame.push_byte((TC_AIRBORNE_VELO << 3) | 1); // Subtype: 1 (subsonic)
// Airborne velocities are all transmitted with Type Code 19 ( TC=19, using 5 bits ,TC=19 [Binary: 10011]), the following 3 bits are Subt-type Code ,SC= 1,2,3,4
// SC Subtypes code 1 and 2 are used to report ground speeds of aircraft. (SC 3,4 to used to report true airspeed. SC 2,4 are for supersonic aircraft (not used in commercial airline).
frame.push_byte((TC_AIRBORNE_VELO << 3) | 1); // 1st byte , top 5 bits Type Code TC=19, and lower 3 bits (38-40 bits), SC=001 Subtype Code SC: 1 (subsonic) ,
// Message A, (ME bits from 14-35) , 22 bits = Sign ew(1 bit) + V_ew (10 bits) + Sign_ns (1 bit) + V_ns (10 bits)
// Vertical rate source bit VrSrc (ME bit 36) indicates source of the altitude measurements. GNSS altitude(0) / , barometric altitude(1).
// Vertical rate source direction,(ME bit 37) movement can be read from Svr bit , with 0 and 1 referring to climb and descent, respectively (ft/min)
// The encoded vertical rate value VR can be computed using message (ME bits 38 to 46). If the 9-bit block contains all zeros, the vertical rate information is not available.
// + Sign VrSrc (vert rate src) (1 bit)+ VrSrc (9 bits).
frame.push_byte(((velo_ew < 0 ? 1 : 0) << 2) | (velo_ew_abs >> 8));
frame.push_byte(velo_ew_abs);
frame.push_byte(((velo_ns < 0 ? 1 : 0) << 7) | (velo_ns_abs >> 3));
frame.push_byte((velo_ns_abs << 5) | ((v_rate_coded < 0 ? 1 : 0) << 3) | (v_rate_coded_abs >> 6)); // VrSrc = 0
frame.push_byte((velo_ns_abs << 5) | ((v_rate < 0 ? 1 : 0) << 3) | (v_rate_coded_abs >> 6)); // VrSrc = 0
frame.push_byte(v_rate_coded_abs << 2);
frame.push_byte(0);
+48 -1
View File
@@ -245,12 +245,29 @@ constexpr fir_taps_real<32> taps_6k0_decim_2 {
11815, 10413, 7946, 4978, 2134, -83, -1411, -1857,
-1640, -1080, -474, -21, 208, 247, 178, 95,
} },
};
// IFIR prototype filter fs=48000 ; pass=4500 (cutt off -3dBs) , stop=8000 (<-60dBs), decim=4, fout=12000
// For Europe AM commercial broadcasting stations in LF/MF/HF, Emissions Designator 9K00A3E Bandwidth: 9.00 kHz (derivated from taps_6k0_decim_2 )
// Pre-decimate LPF FIR filter design Created with SciPy Python with the "window method", num_taps = 32, cut_off = 5150. sample_rate = 48000 # Hz,
// Created with h = signal.firwin(num_taps, cut_off, nyq=sample_rate/2, window=('chebwin',50)) , achieving good STOP band plot < -60 dB's with some ripple.
// post-scaled h taps to avoid decimals , targeting <= similar int values as previous taps_6k0_dsb_channel peak < 32.767 (2 exp 15) and similar H(f)gain
constexpr fir_taps_real<32> taps_9k0_decim_2 {
.low_frequency_normalized = -4500.0f / 48000.0f, // Negative -cutt off freq -3dB (real achieved data ,in the plot and measurements)
.high_frequency_normalized = 4500.0f / 48000.0f, // Positive +cutt off freq -3dB (idem)
.transition_normalized = 3500.0f / 48000.0f, // 3500 Hz = (8000 Hz - 4500 Hz) (both from plot H(f) curve plot)
.taps = { {
-53, -30, 47, 198, 355, 372, 89, -535,
-1307, -1771, -1353, 370, 3384, 7109, 10535, 12591,
12591, 10535, 7109, 3384, 370, -1353, -1771, -1307,
-535, 89, 372, 355, 198, 47, -30, -53
} },
};
// Channel filter: fs=12000, pass=3000, stop=3300, decim=1, fout=12000
/* NOTE: Slightly less than 1.0 gain (normalized to 65536) due to max(taps) being
* slightly larger than 32767 (33312).
*/
*/
constexpr fir_taps_complex<64> taps_6k0_dsb_channel {
.low_frequency_normalized = -3000.0f / 12000.0f,
.high_frequency_normalized = 3000.0f / 12000.0f,
@@ -275,6 +292,36 @@ constexpr fir_taps_complex<64> taps_6k0_dsb_channel {
} },
};
// Channel filter: fs=12000, pass=4500 (cutt off -3dBs), stop=4940 (<-60dBs), decim=1, fout=12000 (*1) real frec pass / stop , based on plotted H(f) curve)
// For Europe AM commercial broadcasting stations in LF/MF/HF, Emissions Designator 9K00A3E Bandwidth: 9.00 kHz (derivative from taps_6k0_dsb_channel)
// FIR filter design created with SciPy Python using "window method"; selected design parameters: num_taps = 64, cut_off = 4575. sample_rate = 12000 # Hz,
// Created with : h = signal.firwin(num_taps, cut_off, nyq=sample_rate/2, window=('chebwin',50)) , achieving real plot curve (*1) with peak stop band ripple -60dBs.
// post-scaled h taps to avoid decimals , targeting <= similar int values as previous taps_6k0_dsb_channel peak < 32.767 (2 exp 15), (29625) and similar H(f)gain
constexpr fir_taps_complex<64> taps_9k0_dsb_channel {
.low_frequency_normalized = -4500.0f / 12000.0f, // Negative -cutt off freq -3dB (in the H(f) curve plot)
.high_frequency_normalized = 4500.0f / 12000.0f, // Positive +cutt off freq -3dB (in the H(f) curve plot)
.transition_normalized = 440.0f / 12000.0f, // 440Hz = (4940 Hz -4500 Hz) cut-3dB's (both data comes from H(f) curve plot and confirmed by measurements )
.taps = { {
{ 2, 0 }, { -18, 0 }, { 34, 0 }, { -33, 0 },
{ 6, 0 }, { 44, 0 }, { -91, 0 }, { 96, 0 },
{ -35, 0 }, { -80, 0 }, { 193, 0 }, { -223, 0 },
{ 116, 0 }, { 112, 0 }, { -353, 0 }, { 452, 0 },
{ -293, 0 }, { -111, 0 }, { 584, 0 }, { -844, 0 },
{ 653, 0 }, { 22, 0 }, { -921, 0 }, { 1554, 0 },
{ -1422, 0 }, { 301, 0 }, { 1533, 0 }, { -3282, 0 },
{ 3804, 0 }, { -1819, 0 }, { -4605, 0 }, { 29625, 0 },
{ 29625, 0 }, { -4605, 0 }, { -1819, 0 }, { 3804, 0 },
{ -3282, 0 }, { 1533, 0 }, { 301, 0 }, { -1422, 0 },
{ 1554, 0 }, { -921, 0 }, { 22, 0 }, { 653, 0 },
{ -844, 0 }, { 584, 0 }, { -111, 0 }, { -293, 0 },
{ 452, 0 }, { -353, 0 }, { 112, 0 }, { 116, 0 },
{ -223, 0 }, { 193, 0 }, { -80, 0 }, { -35, 0 },
{ 96, 0 }, { -91, 0 }, { 44, 0 }, { 6, 0 },
{ -33, 0 }, { 34, 0 }, { -18, 0 }, { 2, 0 },
} },
};
// USB AM 2K80J3E emission type ///////////////////////////////////////////
// IFIR prototype filter: fs=12000, pass=3000, stop=3300, decim=1, fout=12000
+23 -20
View File
@@ -306,7 +306,7 @@ using ChannelSpectrumFIFO = FIFO<ChannelSpectrum>;
class ChannelSpectrumConfigMessage : public Message {
public:
static constexpr size_t fifo_k = 2;
constexpr ChannelSpectrumConfigMessage(
ChannelSpectrumFIFO* fifo
) : Message { ID::ChannelSpectrumConfig },
@@ -352,7 +352,7 @@ public:
packet { packet }
{
}
pocsag::POCSAGPacket packet;
};
@@ -378,7 +378,7 @@ public:
amp(amp)
{
}
adsb::ADSBFrame frame;
uint32_t amp;
};
@@ -393,7 +393,7 @@ public:
value { value }
{
}
bool is_data;
uint32_t value;
};
@@ -406,7 +406,7 @@ public:
value { value }
{
}
uint32_t value;
};
@@ -584,7 +584,7 @@ public:
used_ += copy_size;
return copy_size;
}
size_t read(void* p, const size_t count) {
const auto copy_size = std::min(used_, count);
memcpy(p, &data_[capacity_ - used_], copy_size);
@@ -595,7 +595,7 @@ public:
bool is_full() const {
return used_ >= capacity_;
}
bool is_empty() const {
return used_ == 0;
}
@@ -607,7 +607,7 @@ public:
size_t size() const {
return used_;
}
size_t capacity() const {
return capacity_;
}
@@ -700,7 +700,7 @@ public:
) : Message { ID::TXProgress }
{
}
uint32_t progress = 0;
bool done = false;
};
@@ -719,7 +719,7 @@ public:
trigger_word(trigger_word)
{
}
const uint32_t baudrate;
const uint32_t word_length;
const uint32_t trigger_value;
@@ -734,7 +734,7 @@ public:
baudrate(baudrate)
{
}
const uint32_t baudrate;
};
@@ -788,7 +788,7 @@ public:
rssi(rssi)
{
}
const bool enabled;
const int32_t rssi;
};
@@ -825,7 +825,7 @@ public:
length(length)
{
}
const uint16_t length = 0;
};
@@ -835,7 +835,7 @@ public:
) : Message { ID::Retune }
{
}
int64_t freq = 0;
uint32_t range = 0;
};
@@ -848,7 +848,7 @@ public:
sample_rate(sample_rate)
{
}
const uint32_t sample_rate = 0;
};
@@ -858,7 +858,7 @@ public:
) : Message { ID::AudioLevelReport }
{
}
uint32_t value = 0;
};
@@ -964,12 +964,14 @@ public:
const uint32_t stream_length,
const uint32_t samples_per_bit,
const uint8_t repeat,
const uint32_t pause_symbols
const uint32_t pause_symbols,
const uint8_t de_bruijn_length
) : Message { ID::OOKConfigure },
stream_length(stream_length),
samples_per_bit(samples_per_bit),
repeat(repeat),
pause_symbols(pause_symbols)
pause_symbols(pause_symbols),
de_bruijn_length(de_bruijn_length)
{
}
@@ -977,6 +979,7 @@ public:
const uint32_t samples_per_bit;
const uint8_t repeat;
const uint32_t pause_symbols;
const uint8_t de_bruijn_length;
};
class SSTVConfigureMessage : public Message {
@@ -1017,7 +1020,7 @@ public:
class POCSAGConfigureMessage : public Message {
public:
constexpr POCSAGConfigureMessage()
constexpr POCSAGConfigureMessage()
: Message { ID::POCSAGConfigure }
{
}
@@ -1031,7 +1034,7 @@ public:
packet { packet }
{
}
aprs::APRSPacket packet;
};
+13 -14
View File
@@ -35,11 +35,12 @@ w = numpy.arange(length, dtype=numpy.float64) * (2 * numpy.pi / length)
v = numpy.sin(w)
print(v)
*/
constexpr size_t sine_table_f32_period_log2 = 8;
constexpr size_t sine_table_f32_period = 1 << sine_table_f32_period_log2;
constexpr uint32_t sine_table_f32_index_mask = sine_table_f32_period - 1;
constexpr uint16_t sine_table_f32_period = 256;
// periode is 256 . means sine_table_f32[0]= sine_table_f32[0+256], sine_table_f32[1]=sine_table_f32[1+256] (those two added manualy)
// Then table has 258 values ,256:[0,..255] + [256] and [257], those two are used when we interpolate[255] with [255+1], and [256] with [256+1]
// [256] index is needed in the function sin_f32() when we are inputing very small radian values , example , sin_f32((-1e-14) in radians)
static constexpr std::array<float, sine_table_f32_period + 1> sine_table_f32 { {
static constexpr std::array<float, sine_table_f32_period + 2> sine_table_f32{
0.00000000e+00, 2.45412285e-02, 4.90676743e-02,
7.35645636e-02, 9.80171403e-02, 1.22410675e-01,
1.46730474e-01, 1.70961889e-01, 1.95090322e-01,
@@ -125,24 +126,22 @@ static constexpr std::array<float, sine_table_f32_period + 1> sine_table_f32 { {
-2.42980180e-01, -2.19101240e-01, -1.95090322e-01,
-1.70961889e-01, -1.46730474e-01, -1.22410675e-01,
-9.80171403e-02, -7.35645636e-02, -4.90676743e-02,
-2.45412285e-02, 0.00000000e+00,
} };
-2.45412285e-02, 0.00000000e+00, 2.45412285e-02
};
inline float sin_f32(const float w) {
constexpr float normalize = 1.0 / (2 * pi);
const float x = w * normalize;
const int32_t x_int = std::floor(x);
const float x_frac = x - x_int;
const float x = w / (2 * pi); // normalization
const float x_frac = x - std::floor(x); // [0, 1]
const float n = x_frac * sine_table_f32_period;
const int32_t n_int = static_cast<uint32_t>(n) & sine_table_f32_index_mask;
const uint16_t n_int = static_cast<uint16_t>(n);
const float n_frac = n - n_int;
const float p0 = sine_table_f32[n_int + 0];
const float p0 = sine_table_f32[n_int];
const float p1 = sine_table_f32[n_int + 1];
const float diff = p1 - p0;
const float result = p0 + n_frac * diff;
const float result = p0 + n_frac * diff; // linear interpolation
return result;
}
+9 -9
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
@@ -80,7 +80,7 @@ def print_block(block):
for n in range(0, len(block), 8):
chunk = block[n:n+8]
line = ['0x%04x,' % v for v in chunk]
print('\t%s' % ' '.join(line))
print(('\t%s' % ' '.join(line)))
def crc32(blocks):
import zlib
@@ -92,7 +92,7 @@ def crc32(blocks):
crc_bytes.append((word >> 8) & 0xff)
return zlib.crc32(bytearray(crc_bytes)) & 0xffffffff
print("""#include "portapack_cpld_data.hpp"
print(("""#include "portapack_cpld_data.hpp"
#include <cstdint>
#include <array>
@@ -100,23 +100,23 @@ print("""#include "portapack_cpld_data.hpp"
namespace portapack {
namespace cpld {
namespace %s {
""" % revision_name)
""" % revision_name))
print('const std::array<uint16_t, %d> block_0 { {' % len(block_0))
print(('const std::array<uint16_t, %d> block_0 { {' % len(block_0)))
print_block(block_0)
print("""} };
""")
print('const std::array<uint16_t, %d> block_1 { {' % len(block_1))
print(('const std::array<uint16_t, %d> block_1 { {' % len(block_1)))
print_block(block_1)
print("""} };
print(("""} };
} /* namespace %s */
} /* namespace cpld */
} /* namespace portapack */
""" % revision_name)
""" % revision_name))
if calculate_crc:
# Apply post-programming modification to make post-programming CRC correct:
@@ -124,4 +124,4 @@ if calculate_crc:
programmed_block_0[0] &= 0xfbff
crc = crc32((programmed_block_0, block_1))
print('%08x' % crc)
print(('%08x' % crc))
+3 -1
View File
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
import math
m = 64 - 1
@@ -6,7 +8,7 @@ ft = 300.0 / 24000.0
taps = []
window = []
print("Normalized ft = " + str(ft))
print(("Normalized ft = " + str(ft)))
for n in range(0, 64):
taps.append(math.sin(2 * math.pi * ft * (n - (m / 2.0))) / (math.pi * (n - (m / 2.0))))
+6 -5
View File
@@ -29,10 +29,10 @@ outfile = open('../../sdcard/ADSB/world_map.bin', 'wb')
Image.MAX_IMAGE_PIXELS = None
im = Image.open("../../sdcard/ADSB/world_map.jpg")
pix = im.load()
outfile.write(struct.pack('H', im.size[0]))
outfile.write(struct.pack('H', im.size[1]))
# Write as unsigned short (2 bytes) as little endian
outfile.write(struct.pack('<H', im.size[0]))
outfile.write(struct.pack('<H', im.size[1]))
print("image \t size[0]=" + str(im.size[0]) + "\tsize[1]=" + str(im.size[1]) + " pixels");
print("Generating: \t" + outfile.name + "\n from\t\t" + im.filename + "\n please wait...");
for y in range (0, im.size[1]):
@@ -47,8 +47,9 @@ for y in range (0, im.size[1]):
# pixel_lcd = (pix[x, y][0] >> 5) << 5
# pixel_lcd |= (pix[x, y][1] >> 5) << 2
# pixel_lcd |= (pix[x, y][2] >> 6)
line += struct.pack('H', pixel_lcd)
line += struct.pack('<H', pixel_lcd)
outfile.write(line)
print(str(y) + '/' + str(im.size[1]) + '\r', end="")
outfile.close();
print("Ready.");
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# Copyright (C) 2016 Furrtek
#
+3 -3
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# Copyright (C) 2016 Furrtek
#
@@ -42,7 +42,7 @@ def convert_png(file):
rgb_im = im.convert('RGBA')
if rgb_im.size[0] % 8 or rgb_im.size[1] % 8:
print(file + ": Size isn\'t a multiple of 8")
print((file + ": Size isn\'t a multiple of 8"))
sys.exit(-1)
name = path.basename(file).split(".")[0].lower();
@@ -112,4 +112,4 @@ f.write("\n")
f.write("} /* namespace ui */\n\n")
f.write("#endif/*__BITMAP_HPP__*/\n")
print("Converted " + str(count) + " files")
print(("Converted " + str(count) + " files"))
+2 -2
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# Copyright (C) 2016 Furrtek
#
@@ -40,4 +40,4 @@ for c in range (0, 0x200): # DCS code is 9 bits
p10 = cb[3] ^ cb[5] ^ cb[6] ^ cb[8] ^ 1;
p11 = cb[0] ^ cb[1] ^ cb[2] ^ cb[3] ^ cb[6] ^ 1;
print ' 0b{0:011b}'.format((p11<<10) | (p10<<9) | (p9<<8) |(p8<<7) | (p7<<6) | (p6<<5) | (p5<<4) | (p4<<3) | (p3<<2) | (p2<<1) | (p1)) + ', // ' + str(c);
print(' 0b{0:011b}'.format((p11<<10) | (p10<<9) | (p9<<8) |(p8<<7) | (p7<<6) | (p6<<5) | (p5<<4) | (p4<<3) | (p3<<2) | (p2<<1) | (p1)) + ', // ' + str(c));
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
+1 -1
Submodule hackrf updated: dfadf6a31c...eff4a20022
+1
View File
@@ -0,0 +1 @@
a=76000000,b=90000000,m=WFM,bw=16k,s=50KHz,d=WFM Japan
+1
View File
@@ -0,0 +1 @@
a=65800000,b=74000000,m=WFM,bw=16k,s=30KHz,d=WFM OIRT
+1
View File
@@ -0,0 +1 @@
a=87500000,b=108000000,m=WFM,bw=16k,s=50KHz,d=WFM Standard
+22
View File
@@ -0,0 +1,22 @@
a=150000,b=285000,m=AM,bw=DSB,s=5KHz,d=Longwave broadcast band|BCB (EU)
a=525000,b=1605000,m=AM,bw=DSB,s=5KHz,d=AM broadcast band|BCB (EU & J)
a=530000,b=1710000,m=AM,bw=DSB,s=5KHz,d=AM broadcast band|BCB (US)
a=1800000,b=29700000,m=WFM,bw=16k,d=Amateur_radio|Amateur
a=26900000,b=27400000,m=WFM,bw=16k,d=Citizens_band_radio|Citizens band
a=28000000,b=30000000,m=WFM,bw=16k,d=Amateur_radio|Amateur
a=29000000,b=54000000,m=WFM,bw=16k,d=Land mobile
a=50000000,b=54000000,m=WFM,bw=16k,d=Amateur_radio|Amateur
a=65000000,b=85000000,m=WFM,bw=16k,d=Land mobile (EU)
a=108000000,b=136000000,m=WFM,bw=16k,d=Aircraft
a=120000000,b=160000000,m=WFM,bw=16k,s=50KHz,d=Land mobile (EU)
a=132000000,b=174000000,m=WFM,bw=16k,s=50KHz,d=Land mobile
a=142000000,b=170000000,m=WFM,bw=16k,s=50KHz,d=Land mobile (J)
a=144000000,b=148000000,m=WFM,bw=16k,s=50KHz,d=Amateur_radio|Amateur
a=216000000,b=222000000,m=WFM,bw=16k,s=50KHz,d=Land mobile
a=222000000,b=225000000,m=WFM,bw=16k,s=50KHz,d=Amateur_radio|Amateur
a=335000000,b=384000000,m=WFM,bw=16k,s=50KHz,d=Land mobile (J)
a=406000000,b=512000000,m=WFM,bw=16k,s=50KHz,d=Land mobile
a=450000000,b=470000000,m=WFM,bw=16k,s=50KHz,d=Land mobile (J)
a=430000000,b=450000000,m=WFM,bw=16k,s=50KHz,d=Amateur_radio|Amateur
a=806000000,b=947000000,m=WFM,bw=16k,s=50KHz,d=Land mobile
a=1200000000,b=1600000000,m=WFM,bw=16k,s=50KHz,d=Amateur|Land mobile|GPS