Skip to content

Commit 8f311ea

Browse files
authored
Merge pull request #1 from eried/next
Sync with upstream
2 parents 848dba4 + 98c0ff1 commit 8f311ea

77 files changed

Lines changed: 471791 additions & 1023 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,10 @@ CMakeFiles/
6363

6464
# Host OS leftovers
6565
.DS_Store
66-
/firmware/CMakeCache.txt
66+
/firmware/CMakeCache.txt
67+
68+
# Python env
69+
env/
70+
71+
# Other
72+
*.bak

LICENSE

Lines changed: 620 additions & 285 deletions
Large diffs are not rendered by default.

LICENSE.GPL-2.0-or-later

Lines changed: 339 additions & 0 deletions
Large diffs are not rendered by default.

LICENSE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# License
2+
Portapack Mayhem is distributed under [GPL v3.0](LICENSE), however some sub projects might have different (GPL v3.0 compatible) licenses.
3+
4+
## Other Licenses (compatible with GPL v3.0)
5+
- Most of Portapack Mayhem is distributed under GPL-2.0-or-later. [license](LICENSE.GPL-2.0-or-later)
6+
- ChibiOS is distributed under GPL v3.0. [license](/firmware/chibios/license.txt)
7+
- Portapack-ChibiOS is distributed under Apache-2.0 [license](http://www.apache.org/licenses/LICENSE-2.0)

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# PortaPack Mayhem
22

3-
[![Build Status](https://travis-ci.com/eried/portapack-mayhem.svg?branch=master)](https://travis-ci.com/eried/portapack-mayhem) [![buddy pipeline](https://app.buddy.works/eried/portapack/pipelines/pipeline/252276/badge.svg?token=48cd59d53de0589a8fbe26bc751d77a59a011cf72581da049343879402991c34 "buddy pipeline")](https://app.buddy.works/eried/portapack/pipelines/pipeline/252276) [![CodeScene Code Health](https://codescene.io/projects/8381/status-badges/code-health)](https://codescene.io/projects/8381) [![GitHub All Releases](https://img.shields.io/github/downloads/eried/portapack-mayhem/total)](https://github.com/eried/portapack-mayhem/releases) [![GitHub Releases](https://img.shields.io/github/downloads/eried/portapack-mayhem/latest/total)](https://github.com/eried/portapack-mayhem/releases/latest) [![Docker Hub Pulls](https://img.shields.io/docker/pulls/eried/portapack.svg)](https://hub.docker.com/r/eried/portapack) [![Discord Chat](https://img.shields.io/discord/719669764804444213.svg)](https://discord.gg/tuwVMv3) [![Check bounties!](https://img.shields.io/bountysource/team/portapack-mayhem/activity?color=%2333ccff&label=bountysource%20%28USD%29&style=plastic)](https://www.bountysource.com/teams/portapack-mayhem/issues)
3+
[![Build Status](https://travis-ci.com/eried/portapack-mayhem.svg?branch=master)](https://travis-ci.com/eried/portapack-mayhem) [![CodeScene Code Health](https://codescene.io/projects/8381/status-badges/code-health)](https://codescene.io/projects/8381) [![GitHub All Releases](https://img.shields.io/github/downloads/eried/portapack-mayhem/total)](https://github.com/eried/portapack-mayhem/releases) [![GitHub Releases](https://img.shields.io/github/downloads/eried/portapack-mayhem/latest/total)](https://github.com/eried/portapack-mayhem/releases/latest) [![Docker Hub Pulls](https://img.shields.io/docker/pulls/eried/portapack.svg)](https://hub.docker.com/r/eried/portapack) [![Discord Chat](https://img.shields.io/discord/719669764804444213.svg)](https://discord.gg/tuwVMv3) [![Check bounties!](https://img.shields.io/bountysource/team/portapack-mayhem/activity?color=%2333ccff&label=bountysource%20%28USD%29&style=plastic)](https://www.bountysource.com/teams/portapack-mayhem/issues)
44

55
This is a fork of the [Havoc](https://github.com/furrtek/portapack-havoc/) firmware, which itself was a fork of the [PortaPack](https://github.com/sharebrained/portapack-hackrf) firmware, an add-on for the [HackRF](http://greatscottgadgets.com/hackrf/). A fork is a derivate, in this case one that has extra features and fixes when compared to the older versions.
66

77
[<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)
88

9-
*[PortaPack H2+HackRF+battery](https://s.click.aliexpress.com/e/_dZ7lA96) (clone) with a custom [3d printed case](https://github.com/eried/portapack-mayhem/wiki/H2-Enclosure)*
9+
*[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)*
1010

1111
# Quick overview
1212

@@ -20,13 +20,13 @@ This repository expands upon the previous work by many people and aims to consta
2020

2121
## Does it work on H1/H2 PortaPack?
2222

23-
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/_dZ7lA96), 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.
23+
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.
2424

2525
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).
2626

2727
## Where is the latest firmware?
2828

29-
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. There is also [nightly builds](https://github.com/eried/portapack-mayhem/releases/tag/nightly) generated periodically, which include the latest commits, but they may contain incomplete or buggy functionality.
29+
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.
3030

3131
## Is this the newest firmware for my PortaPack?
3232
Most probably: **YES**. *If you find new features somewhere else, please [suggest](https://github.com/eried/portapack-mayhem/issues/new/choose) them*.

firmware/application/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ set(CPPSRC
172172
irq_rtc.cpp
173173
log_file.cpp
174174
portapack.cpp
175+
qrcodegen.cpp
175176
radio.cpp
176177
receiver_model.cpp
177178
recent_entries.cpp
@@ -206,6 +207,7 @@ set(CPPSRC
206207
ui/ui_channel.cpp
207208
ui/ui_font_fixed_8x16.cpp
208209
ui/ui_geomap.cpp
210+
ui/ui_qrcode.cpp
209211
ui/ui_menu.cpp
210212
ui/ui_btngrid.cpp
211213
ui/ui_receiver.cpp

firmware/application/apps/ais_app.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static float latlon_float(const int32_t normalized) {
5959
static std::string mmsi(
6060
const ais::MMSI& mmsi
6161
) {
62-
return to_string_dec_uint(mmsi, 9);
62+
return to_string_dec_uint(mmsi, 9, '0'); // MMSI is always is always 9 characters pre-padded with zeros
6363
}
6464

6565
static std::string navigational_status(const unsigned int value) {
@@ -240,7 +240,7 @@ AISRecentEntryDetailView::AISRecentEntryDetailView(NavigationView& nav) {
240240

241241
void AISRecentEntryDetailView::update_position() {
242242
if (send_updates)
243-
geomap_view->update_position(ais::format::latlon_float(entry_.last_position.latitude.normalized()), ais::format::latlon_float(entry_.last_position.longitude.normalized()), (float)entry_.last_position.true_heading);
243+
geomap_view->update_position(ais::format::latlon_float(entry_.last_position.latitude.normalized()), ais::format::latlon_float(entry_.last_position.longitude.normalized()), (float)entry_.last_position.true_heading, 0);
244244
}
245245

246246
void AISRecentEntryDetailView::focus() {
@@ -307,17 +307,22 @@ AISAppView::AISAppView(NavigationView& nav) : nav_ { nav } {
307307
recent_entry_detail_view.hidden(true);
308308

309309
target_frequency_ = initial_target_frequency;
310+
311+
receiver_model.set_tuning_frequency(tuning_frequency());
312+
receiver_model.set_sampling_rate(sampling_rate);
313+
receiver_model.set_baseband_bandwidth(baseband_bandwidth);
314+
receiver_model.enable(); // Before using radio::enable(), but not updating Ant.DC-Bias.
310315

311-
radio::enable({
316+
/* radio::enable({ // this can be removed, previous version,no DC-bias control.
312317
tuning_frequency(),
313318
sampling_rate,
314319
baseband_bandwidth,
315320
rf::Direction::Receive,
316321
receiver_model.rf_amp(),
317322
static_cast<int8_t>(receiver_model.lna()),
318323
static_cast<int8_t>(receiver_model.vga()),
319-
});
320-
324+
}); */
325+
321326
options_channel.on_change = [this](size_t, OptionsField::value_t v) {
322327
this->on_frequency_changed(v);
323328
};
@@ -337,7 +342,8 @@ AISAppView::AISAppView(NavigationView& nav) : nav_ { nav } {
337342
}
338343

339344
AISAppView::~AISAppView() {
340-
radio::disable();
345+
/* radio::disable(); */
346+
receiver_model.disable(); // to switch off all, including DC bias.
341347

342348
baseband::shutdown();
343349
}

firmware/application/apps/capture_app.cpp

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,58 @@ CaptureAppView::CaptureAppView(NavigationView& nav) {
7474

7575
option_bandwidth.on_change = [this](size_t, uint32_t base_rate) {
7676
sampling_rate = 8 * base_rate; // Decimation by 8 done on baseband side
77-
77+
/* base_rate is used for FFT calculation and display LCD, and also in recording writing SD Card rate. */
78+
/* ex. sampling_rate values, 4Mhz, when recording 500 kHz (BW) and fs 8 Mhz , when selected 1 Mhz BW ...*/
79+
/* ex. recording 500kHz BW to .C16 file, base_rate clock 500kHz x2(I,Q) x 2 bytes (int signed) =2MB/sec rate SD Card */
80+
7881
waterfall.on_hide();
7982
record_view.set_sampling_rate(sampling_rate);
8083
receiver_model.set_sampling_rate(sampling_rate);
84+
/* Set up proper anti aliasing BPF bandwith in MAX2837 before ADC sampling according to the new added BW Options . */
85+
86+
switch(sampling_rate) { // we use the var fs (sampling_rate) , to set up BPF aprox < fs_max/2 by Nyquist theorem.
87+
88+
case 0 ... 2000000: // BW Captured range (0 <= 250kHz max ) fs = 8 x 250 kHz
89+
anti_alias_baseband_bandwidth_filter = 1750000; // Minimum BPF MAX2837 for all those lower BW options.
90+
break;
91+
92+
case 4000000 ... 6000000: // BW capture range (500k ... 750kHz max ) fs_max = 8 x 750kHz = 6Mhz
93+
// BW 500k ... 750kHz , ex. 500kHz (fs = 8*BW = 4Mhz) , BW 600kHz (fs = 4,8Mhz) , BW 750 kHz (fs = 6Mhz)
94+
anti_alias_baseband_bandwidth_filter = 2500000; // in some IC MAX2837 appear 2250000 , but both works similar.
95+
break;
96+
97+
case 8800000: // BW capture 1,1Mhz fs = 8 x 1,1Mhz = 8,8Mhz . (1Mhz showed slightly higher noise background).
98+
anti_alias_baseband_bandwidth_filter = 3500000;
99+
break;
100+
101+
case 14000000: // BW capture 1,75Mhz , fs = 8 x 1,75Mhz = 14Mhz
102+
// good BPF ,good matching, but LCD making flicker , refresh rate should be < 20 Hz , but reasonable picture
103+
anti_alias_baseband_bandwidth_filter = 5000000;
104+
break;
105+
106+
case 16000000: // BW capture 2Mhz , fs = 8 x 2Mhz = 16Mhz
107+
// good BPF ,good matching, but LCD making flicker , refresh rate should be < 20 Hz , but reasonable picture
108+
anti_alias_baseband_bandwidth_filter = 6000000;
109+
break;
110+
111+
case 20000000: // BW capture 2,5Mhz , fs= 8 x 2,5 Mhz = 20Mhz
112+
// good BPF ,good matching, but LCD making flicker , refresh rate should be < 20 Hz , but reasonable picture
113+
anti_alias_baseband_bandwidth_filter = 7000000;
114+
break;
115+
116+
default: // BW capture 2,75Mhz, fs = 8 x 2,75Mhz= 22Mhz max ADC sampling) and others.
117+
// We tested also 9Mhz FPB stightly too much noise floor , better 8Mhz
118+
anti_alias_baseband_bandwidth_filter = 8000000;
119+
}
120+
receiver_model.set_baseband_bandwidth(anti_alias_baseband_bandwidth_filter);
121+
122+
81123
waterfall.on_show();
82124
};
83125

84-
option_bandwidth.set_selected_index(7); // 500k
126+
option_bandwidth.set_selected_index(7); // 500k, Preselected starting default option 500kHz
85127

86128
receiver_model.set_modulation(ReceiverModel::Mode::Capture);
87-
receiver_model.set_baseband_bandwidth(baseband_bandwidth);
88129
receiver_model.enable();
89130

90131
record_view.on_error = [&nav](std::string message) {

firmware/application/apps/capture_app.hpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class CaptureAppView : public View {
4848
static constexpr ui::Dim header_height = 3 * 16;
4949

5050
uint32_t sampling_rate = 0;
51-
static constexpr uint32_t baseband_bandwidth = 2500000;
51+
uint32_t anti_alias_baseband_bandwidth_filter = 2500000; // we rename the previous var , and change type static constexpr to normal var.
5252

5353
void on_tuning_frequency_changed(rf::Frequency f);
5454

@@ -95,7 +95,14 @@ class CaptureAppView : public View {
9595
{ " 50k ", 50000 },
9696
{ "100k ", 100000 },
9797
{ "250k ", 250000 },
98-
{ "500k ", 500000 }
98+
{ "500k ", 500000 }, // Previous Limit bandwith Option with perfect micro SD write .C16 format operaton.
99+
{ "600k ", 600000 }, // That extended option is still possible to record with FW version Mayhem v1.41 (< 2,5MB/sec)
100+
{ "750k ", 750000 }, // From that BW onwards, the LCD is ok, but the recorded file is auto decimated,(not real file size)
101+
{ "1100k", 1100000 },
102+
{ "1750k", 1750000 },
103+
{ "2000k", 2000000 },
104+
{ "2500k", 2500000 },
105+
{ "2750k", 2750000 } // That is our max Capture option , to keep using later / 8 decimation (22Mhz sampling ADC)
99106
}
100107
};
101108

0 commit comments

Comments
 (0)