Skip to content

Commit

Permalink
Merge branch 'next' into feature/disableTouch
Browse files Browse the repository at this point in the history
  • Loading branch information
ArjanOnwezen committed Apr 8, 2022
2 parents cebbc12 + a81d630 commit a9d2b2f
Show file tree
Hide file tree
Showing 84 changed files with 37,039 additions and 35,913 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/changelog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import os
import re
import sys

raw_git = os.popen('git log next --since="24 hours" --pretty=format:"- %h - {USERNAME}*+%al-%an*: %s"').read()


def compute_username(line):
stripped = re.search(r'(?<=\*)(.*?)(?=\*)', line).group(0)

pattern = re.compile("[$@+&?].*[$@+&?]")
if pattern.match(stripped):
stripped = re.sub("[$@+&?].*[$@+&?]", "", stripped)
stripped = re.match(r'.+?(?=-)', stripped).group(0)
else:
stripped = re.sub(r'^.*?-', "", stripped)
return "@" + stripped


def compile_line(line):
username = compute_username(line)
line = re.sub(r'[*].*[*]', "", line)
line = line.replace("{USERNAME}", username)
return line


for row in raw_git.splitlines():
print(compile_line(row))
99 changes: 99 additions & 0 deletions .github/workflows/create_nightly_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Nightly Release

on:
schedule:
- cron: "0 0 * * *"

workflow_dispatch:

jobs:
check_date:
runs-on: ubuntu-latest
name: Check latest commit
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v2
- name: print latest_commit
run: echo ${{ github.sha }}

- name: check latest commit is less than a day
id: should_run
continue-on-error: true
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "::set-output name=should_run::false"
build:
needs: check_date
if: ${{ needs.check_date.outputs.should_run != 'false' }}
runs-on: ubuntu-latest
steps:
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Get version date
id: version_date
run: echo "::set-output name=date::n_$(date +'%y%m%d')"
- name: Checkout
uses: actions/checkout@master
with:
fetch-depth: 0
ref: next
submodules: true
- name: Git Sumbodule Update
run: |
git submodule update --init --recursive
- name: Build the Docker image
run: docker build -t portapack-dev -f dockerfile-nogit . --tag my-image-name:$(date +%s)
- name: Make build folder
run: mkdir ${{ github.workspace }}/build
- name: Run the Docker image
run: docker run -e VERSION_STRING=${{ steps.version_date.outputs.date }} -i -v ${{ github.workspace }}:/havoc portapack-dev
- name: Create Firmware ZIP
run: |
zip -j firmware.zip build/firmware/portapack-h1_h2-mayhem.bin && cd flashing && zip -r ../firmware.zip *
- name: Create SD Card ZIP
run: |
zip -r sdcard.zip sdcard
- name: Create changelog
run: |
CHANGELOG=$(python3 .github/workflows/changelog.py)
CHANGELOG="${CHANGELOG//'%'/'%25'}"
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
echo "::set-output name=content::$CHANGELOG"
id: changelog
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: nightly-tag-${{ steps.date.outputs.date }}
release_name: Nightly Release - ${{ steps.date.outputs.date }}
body: |
**Nightly release - ${{ steps.date.outputs.date }}**
This build is the latest and greatest, although may not be the most stable as this is a nightly release.
## Release notes
### Revision (${{ steps.version_date.outputs.date }}):
${{ steps.changelog.outputs.content }}
draft: false
prerelease: true
- name: Upload Firmware Asset
id: upload-firmware-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./firmware.zip
asset_name: mayhem_nightly_${{ steps.version_date.outputs.date }}_FIRMWARE.zip
asset_content_type: application/zip
- name: Upload SD Card Assets
id: upload-sd-card-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./sdcard.zip
asset_name: mayhem_nightly_${{ steps.version_date.outputs.date }}_COPY_TO_SDCARD.zip
asset_content_type: application/zip
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
*.lib

# Executables
*.exe
*.out
*.app
/firmware/baseband/*.bin
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_LIST_DIR}/firmware/toolchain-arm-cortex

project(portapack-h1)

#set(VERSION "")
if (NOT DEFINED VERSION)
set(VERSION "$ENV{VERSION_STRING}")
if ("$ENV{VERSION_STRING}" STREQUAL "")
execute_process(
COMMAND git log -n 1 --format=%h
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
Expand All @@ -38,7 +38,7 @@ if (NOT DEFINED VERSION)
if (GIT_VERSION_FOUND)
set(VERSION "unknown")
else (GIT_VERSION_FOUND)
set(VERSION "local-${GIT_VERSION}")
set(VERSION "${GIT_VERSION}")
endif (GIT_VERSION_FOUND)
endif()

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ To support the people behind the hardware, please buy a genuine [HackRF](https:/

## Where is the latest firmware?

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/).

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.

## 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*.
Expand Down
1 change: 1 addition & 0 deletions firmware/application/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ set(CPPSRC
capture_thread.cpp
clock_manager.cpp
core_control.cpp
database.cpp
de_bruijn.cpp
#emu_cc1101.cpp
rfm69.cpp
Expand Down
35 changes: 31 additions & 4 deletions firmware/application/apps/ais_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "ais_app.hpp"

#include "string_format.hpp"
#include "database.hpp"

#include "baseband_api.hpp"

Expand Down Expand Up @@ -62,6 +63,25 @@ static std::string mmsi(
return to_string_dec_uint(mmsi, 9, '0'); // MMSI is always is always 9 characters pre-padded with zeros
}


static std::string mid(
const ais::MMSI& mmsi
) {
std::database db;
std::string mid_code = "";
std::database::MidDBRecord mid_record = {};
int return_code = 0;

// Try getting the country name from mids.db using MID code for given MMSI
mid_code = to_string_dec_uint(mmsi, 9, ' ').substr(0, 3);
return_code = db.retrieve_mid_record(&mid_record, mid_code);
switch(return_code) {
case DATABASE_RECORD_FOUND: return mid_record.country;
case DATABASE_NOT_FOUND: return "No mids.db file";
default: return "";
}
}

static std::string navigational_status(const unsigned int value) {
switch(value) {
case 0: return "under way w/engine";
Expand Down Expand Up @@ -271,6 +291,7 @@ void AISRecentEntryDetailView::paint(Painter& painter) {
auto field_rect = Rect { rect.left(), rect.top() + 16, rect.width(), 16 };

field_rect = draw_field(painter, field_rect, s, "MMSI", ais::format::mmsi(entry_.mmsi));
field_rect = draw_field(painter, field_rect, s, "Ctry", ais::format::mid(entry_.mmsi));
field_rect = draw_field(painter, field_rect, s, "Name", entry_.name);
field_rect = draw_field(painter, field_rect, s, "Call", entry_.call_sign);
field_rect = draw_field(painter, field_rect, s, "Dest", entry_.destination);
Expand Down Expand Up @@ -307,17 +328,22 @@ AISAppView::AISAppView(NavigationView& nav) : nav_ { nav } {
recent_entry_detail_view.hidden(true);

target_frequency_ = initial_target_frequency;

receiver_model.set_tuning_frequency(tuning_frequency());
receiver_model.set_sampling_rate(sampling_rate);
receiver_model.set_baseband_bandwidth(baseband_bandwidth);
receiver_model.enable(); // Before using radio::enable(), but not updating Ant.DC-Bias.

radio::enable({
/* radio::enable({ // this can be removed, previous version,no DC-bias control.
tuning_frequency(),
sampling_rate,
baseband_bandwidth,
rf::Direction::Receive,
receiver_model.rf_amp(),
static_cast<int8_t>(receiver_model.lna()),
static_cast<int8_t>(receiver_model.vga()),
});

}); */
options_channel.on_change = [this](size_t, OptionsField::value_t v) {
this->on_frequency_changed(v);
};
Expand All @@ -337,7 +363,8 @@ AISAppView::AISAppView(NavigationView& nav) : nav_ { nav } {
}

AISAppView::~AISAppView() {
radio::disable();
/* radio::disable(); */
receiver_model.disable(); // to switch off all, including DC bias.

baseband::shutdown();
}
Expand Down
5 changes: 3 additions & 2 deletions firmware/application/apps/ais_app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ class AISRecentEntryDetailView : public View {
AISRecentEntry entry_ { };

Button button_done {
{ 125, 216, 96, 24 },
{ 125, 224, 96, 24 },
"Done"
};
Button button_see_map {
{ 19, 216, 96, 24 },
{ 19, 224, 96, 24 },
"See on map"
};
GeoMapView* geomap_view { nullptr };
Expand Down Expand Up @@ -169,6 +169,7 @@ class AISAppView : public View {
static constexpr uint32_t initial_target_frequency = 162025000;
static constexpr uint32_t sampling_rate = 2457600;
static constexpr uint32_t baseband_bandwidth = 1750000;

NavigationView& nav_;

AISRecentEntries recent { };
Expand Down
3 changes: 3 additions & 0 deletions firmware/application/apps/analog_audio_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ AnalogAudioView::AnalogAudioView(
&waterfall
});

//Filename Datetime and Frequency
record_view.set_filename_date_frequency(true);

field_frequency.set_value(receiver_model.tuning_frequency());
field_frequency.set_step(receiver_model.frequency_step());
field_frequency.on_change = [this](rf::Frequency f) {
Expand Down
7 changes: 5 additions & 2 deletions firmware/application/apps/analog_audio_app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
#include "ui_receiver.hpp"
#include "ui_spectrum.hpp"
#include "ui_record_view.hpp"

#include "ui_font_fixed_8x16.hpp"

#include "tone_key.hpp"


namespace ui {

constexpr Style style_options_group {
Expand Down Expand Up @@ -216,7 +216,10 @@ class AnalogAudioView : public View {

RecordView record_view {
{ 0 * 8, 2 * 16, 30 * 8, 1 * 16 },
u"AUD_????", RecordView::FileType::WAV, 4096, 4
u"AUD",
RecordView::FileType::WAV,
4096,
4
};

spectrum::WaterfallWidget waterfall { true };
Expand Down
12 changes: 6 additions & 6 deletions firmware/application/apps/capture_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ CaptureAppView::CaptureAppView(NavigationView& nav) {
option_bandwidth.on_change = [this](size_t, uint32_t base_rate) {
sampling_rate = 8 * base_rate; // Decimation by 8 done on baseband side
/* base_rate is used for FFT calculation and display LCD, and also in recording writing SD Card rate. */
/* ex. sampling_rate values, 4Mhz, when recording 500 khz (BW) and fs 8 Mhz , when selected 1 Mhz BW ...*/
/* ex. recording 500khz BW to .C16 file, base_rate clock 500khz x2(I,Q) x 2 bytes (int signed) =2MB/sec rate SD Card */
/* ex. sampling_rate values, 4Mhz, when recording 500 kHz (BW) and fs 8 Mhz , when selected 1 Mhz BW ...*/
/* ex. recording 500kHz BW to .C16 file, base_rate clock 500kHz x2(I,Q) x 2 bytes (int signed) =2MB/sec rate SD Card */

waterfall.on_hide();
record_view.set_sampling_rate(sampling_rate);
Expand All @@ -85,12 +85,12 @@ CaptureAppView::CaptureAppView(NavigationView& nav) {

switch(sampling_rate) { // we use the var fs (sampling_rate) , to set up BPF aprox < fs_max/2 by Nyquist theorem.

case 0 ... 2000000: // BW Captured range (0 <= 250Khz max ) fs = 8 x 250 Khz
case 0 ... 2000000: // BW Captured range (0 <= 250kHz max ) fs = 8 x 250 kHz
anti_alias_baseband_bandwidth_filter = 1750000; // Minimum BPF MAX2837 for all those lower BW options.
break;

case 4000000 ... 6000000: // BW capture range (500k ... 750Khz max ) fs_max = 8 x 750Khz = 6Mhz
// BW 500k ... 750khz , ex. 500khz (fs = 8*BW = 4Mhz) , BW 600Khz (fs = 4,8Mhz) , BW 750 Khz (fs = 6Mhz)
case 4000000 ... 6000000: // BW capture range (500k ... 750kHz max ) fs_max = 8 x 750kHz = 6Mhz
// BW 500k ... 750kHz , ex. 500kHz (fs = 8*BW = 4Mhz) , BW 600kHz (fs = 4,8Mhz) , BW 750 kHz (fs = 6Mhz)
anti_alias_baseband_bandwidth_filter = 2500000; // in some IC MAX2837 appear 2250000 , but both works similar.
break;

Expand Down Expand Up @@ -123,7 +123,7 @@ CaptureAppView::CaptureAppView(NavigationView& nav) {
waterfall.on_show();
};

option_bandwidth.set_selected_index(7); // 500k, Preselected starting default option 500khz
option_bandwidth.set_selected_index(7); // 500k, Preselected starting default option 500kHz

receiver_model.set_modulation(ReceiverModel::Mode::Capture);
receiver_model.enable();
Expand Down
20 changes: 17 additions & 3 deletions firmware/application/apps/gps_sim_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,24 @@ void GpsSimAppView::start() {
}
);
}
field_rfgain.on_change = [this](int32_t v) {
tx_gain = v;
};
field_rfgain.set_value(tx_gain);
receiver_model.set_tx_gain(tx_gain);


field_rfamp.on_change = [this](int32_t v) {
rf_amp = (bool)v;
};
field_rfamp.set_value(rf_amp ? 14 : 0);

radio::enable({
receiver_model.tuning_frequency(),
sample_rate ,
baseband_bandwidth,
rf::Direction::Transmit,
receiver_model.rf_amp(),
rf_amp, // previous code line : "receiver_model.rf_amp()," was passing the same rf_amp of all Receiver Apps
static_cast<int8_t>(receiver_model.lna()),
static_cast<int8_t>(receiver_model.vga())
});
Expand Down Expand Up @@ -181,6 +192,9 @@ GpsSimAppView::GpsSimAppView(
NavigationView& nav
) : nav_ (nav)
{
tx_gain = 35;field_rfgain.set_value(tx_gain); // Initial default value (-12 dB's max 47dBs ).
field_rfamp.set_value(rf_amp ? 14 : 0); // Initial default value True. (TX RF amp on , +14dB's)

baseband::run_image(portapack::spi_flash::image_tag_gps);

add_children({
Expand All @@ -191,8 +205,8 @@ GpsSimAppView::GpsSimAppView(
&text_duration,
&progressbar,
&field_frequency,
&field_lna,
&field_rf_amp,
&field_rfgain,
&field_rfamp, // let's not use common persistent rf_amp , local rfamp is enough
&check_loop,
&button_play,
&waterfall,
Expand Down

1 comment on commit a9d2b2f

@jLynx
Copy link
Contributor

@jLynx jLynx commented on a9d2b2f Apr 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to have PR's open for this sort of stuff

Please sign in to comment.