Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
625765d
feat(chirp): predict closed-loop response from the identified plant
Sep 19, 2026
7660331
fix(chirp): treat a wrapping sinarg as one window instead of one per …
Sep 19, 2026
052b9f1
fix(firmware): DEBUG_CHIRP is 97, not the enum count
Sep 19, 2026
3cb1b2e
fix(parser): undo blackbox high resolution scaling on load
Sep 19, 2026
a580636
feat(chirp): read PID gains and PID loop rate from the log header
Sep 19, 2026
5c7ef0d
feat(chirp): live PID sliders predicting the closed loop on the Bode …
Sep 19, 2026
9f62b58
fix(filter-sim): use the firmware formula for notch Q from centre and…
Sep 19, 2026
ad981bb
chore: bump version to 26.09.0-alpha
Sep 19, 2026
eb709b5
ci: ship the flatpak in releases and stop rebuilding it on every push
Sep 19, 2026
3c78fdf
ci: run the flatpak build on demand only, not on push or PR
Sep 19, 2026
b648450
fix(chirp): scale feedforward by 0.01 and yaw I gain by 2.5 as the fi…
Sep 19, 2026
d75656c
chore: bump version to 26.09.0-rc1
Sep 19, 2026
0b10ff1
test(chirp): pin the PID scaling constants to the firmware and cover …
Sep 19, 2026
c4132d6
fix(firmware): correct debug mode indices per Betaflight version
Sep 19, 2026
138e7c9
ci: cache docker layers and the macOS decoder, stop releases clobberi…
Sep 19, 2026
230ae30
ci: run unit tests in a dedicated image instead of the appimage builder
Sep 19, 2026
a4b0703
Revert "ci: run unit tests in a dedicated image instead of the appima…
Sep 19, 2026
e398509
fix(chirp): take the feedforward path from the log instead of modelli…
Sep 19, 2026
c5d37b7
fix(filter-sim): hide the notch column with Show Both and end the ste…
Sep 19, 2026
a649a25
fix(ui): keep the font size usable when the toolkit reports no screen
Sep 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/build-builders.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ jobs:
context: ./packaging/appimage
push: true
tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/pidscope-builder-appimage:latest
cache-from: type=gha,scope=builder-appimage
cache-to: type=gha,mode=max,scope=builder-appimage

build-windows-builder:
runs-on: ubuntu-latest
Expand All @@ -52,6 +54,8 @@ jobs:
context: ./packaging/windows
push: true
tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/pidscope-builder-windows:latest
cache-from: type=gha,scope=builder-windows
cache-to: type=gha,mode=max,scope=builder-windows

build-macos-builder:
runs-on: ubuntu-latest
Expand All @@ -74,3 +78,5 @@ jobs:
context: ./packaging/macos
push: true
tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/pidscope-builder-macos:latest
cache-from: type=gha,scope=builder-macos
cache-to: type=gha,mode=max,scope=builder-macos
24 changes: 0 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,3 @@ jobs:

- name: Run unit tests
run: octave --no-gui --eval "run('tests/run_tests.m')"

flatpak:
runs-on: ubuntu-24.04
timeout-minutes: 60
permissions:
contents: read
container:
image: ghcr.io/flathub-infra/flatpak-github-actions:kde-6.10
options: --privileged
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

- name: Add Flathub remote for the Octave base app
run: |
flatpak remote-add --if-not-exists --user flathub \
https://dl.flathub.org/repo/flathub.flatpakrepo

- uses: flatpak/flatpak-github-actions/flatpak-builder@79327416609af08178ad73b352877e51450790b3 # v6.8
with:
bundle: PIDscope.flatpak
manifest-path: packaging/flatpak/com.pidscope.PIDscope.yml
cache-key: flatpak-builder-${{ github.sha }}
37 changes: 37 additions & 0 deletions .github/workflows/flatpak.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Flatpak

# Packaging, not a test. Release builds and ships the bundle; this is here for
# checking a manifest change without cutting a tag.
on:
workflow_dispatch:

permissions: {}

concurrency:
group: flatpak-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
flatpak:
runs-on: ubuntu-24.04
timeout-minutes: 60
permissions:
contents: read
container:
image: ghcr.io/flathub-infra/flatpak-github-actions:kde-6.10
options: --privileged
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

- name: Add Flathub remote for the Octave base app
run: |
flatpak remote-add --if-not-exists --user flathub \
https://dl.flathub.org/repo/flathub.flatpakrepo

- uses: flatpak/flatpak-github-actions/flatpak-builder@79327416609af08178ad73b352877e51450790b3 # v6.8
with:
bundle: PIDscope.flatpak
manifest-path: packaging/flatpak/com.pidscope.PIDscope.yml
cache-key: flatpak-builder-${{ github.sha }}
49 changes: 34 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,21 @@ jobs:
with:
persist-credentials: false

- uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0

- uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push builder image
run: |
docker build -t ${{ env.REGISTRY }}/${{ github.repository_owner }}/pidscope-builder-appimage:latest ./packaging/appimage
docker push ${{ env.REGISTRY }}/${{ github.repository_owner }}/pidscope-builder-appimage:latest
- uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
with:
context: ./packaging/appimage
push: true
tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/pidscope-builder-appimage:${{ github.sha }}
cache-from: type=gha,scope=builder-appimage
cache-to: type=gha,mode=max,scope=builder-appimage

build-windows-builder:
needs: test
Expand All @@ -72,16 +77,21 @@ jobs:
with:
persist-credentials: false

- uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0

- uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push builder image
run: |
docker build -t ${{ env.REGISTRY }}/${{ github.repository_owner }}/pidscope-builder-windows:latest ./packaging/windows
docker push ${{ env.REGISTRY }}/${{ github.repository_owner }}/pidscope-builder-windows:latest
- uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
with:
context: ./packaging/windows
push: true
tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/pidscope-builder-windows:${{ github.sha }}
cache-from: type=gha,scope=builder-windows
cache-to: type=gha,mode=max,scope=builder-windows

build-macos-blackbox:
needs: test
Expand All @@ -96,10 +106,17 @@ jobs:
timeout-minutes: 20
permissions:
contents: read
env:
BF_BLACKBOX_REV: f832acf9cd9dbe5ad8220de1a5f4eb4021523d72
steps:
- id: bbcache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: blackbox_decode.${{ matrix.arch_name }}
key: blackbox-decode-${{ matrix.arch_name }}-${{ env.BF_BLACKBOX_REV }}

- name: Build blackbox_decode
env:
BF_BLACKBOX_REV: f832acf9cd9dbe5ad8220de1a5f4eb4021523d72
if: steps.bbcache.outputs.cache-hit != 'true'
run: |
git clone https://github.com/betaflight/blackbox-tools.git
cd blackbox-tools
Expand Down Expand Up @@ -135,18 +152,19 @@ jobs:
- name: Build AppImage
run: |
mkdir -p dist
docker pull ${{ env.REGISTRY }}/${{ github.repository_owner }}/pidscope-builder-appimage:latest
docker pull ${{ env.REGISTRY }}/${{ github.repository_owner }}/pidscope-builder-appimage:${{ github.sha }}
docker run --rm \
-v ${{ github.workspace }}:/src \
-v ${{ github.workspace }}/dist:/dist \
${{ env.REGISTRY }}/${{ github.repository_owner }}/pidscope-builder-appimage:latest
${{ env.REGISTRY }}/${{ github.repository_owner }}/pidscope-builder-appimage:${{ github.sha }}

- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: appimage
path: dist/PIDscope-*-x86_64.AppImage

build-flatpak:
needs: test
runs-on: ubuntu-24.04
timeout-minutes: 60
permissions:
Expand Down Expand Up @@ -196,11 +214,11 @@ jobs:
- name: Build Windows ZIP
run: |
mkdir -p dist
docker pull ${{ env.REGISTRY }}/${{ github.repository_owner }}/pidscope-builder-windows:latest
docker pull ${{ env.REGISTRY }}/${{ github.repository_owner }}/pidscope-builder-windows:${{ github.sha }}
docker run --rm \
-v ${{ github.workspace }}:/src \
-v ${{ github.workspace }}/dist:/dist \
${{ env.REGISTRY }}/${{ github.repository_owner }}/pidscope-builder-windows:latest
${{ env.REGISTRY }}/${{ github.repository_owner }}/pidscope-builder-windows:${{ github.sha }}

- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
Expand Down Expand Up @@ -271,7 +289,7 @@ jobs:
# Stage 3: Create GitHub Release
release:
if: startsWith(github.ref, 'refs/tags/')
needs: [build-appimage, build-windows, build-macos]
needs: [build-appimage, build-windows, build-macos, build-flatpak]
runs-on: ubuntu-24.04
timeout-minutes: 15
permissions:
Expand All @@ -288,6 +306,7 @@ jobs:
artifacts/appimage/*
artifacts/windows-zip/*
artifacts/macos-zip/*
artifacts/flatpak/*
generate_release_notes: true
draft: ${{ contains(github.ref_name, 'beta') }}
prerelease: ${{ contains(github.ref_name, 'rc') || contains(github.ref_name, 'beta') }}
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
26.08.0
26.09.0-rc1
30 changes: 30 additions & 0 deletions src/core/PSapplyHighRes.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
function T = PSapplyHighRes(T, setupInfo)
%% PSapplyHighRes - undo blackbox high resolution scaling
% With blackbox_high_resolution on, BF logs gyroADC, gyroUnfilt, rcCommand and
% setpoint multiplied by 10 (blackbox.c). setpoint[3] carries the mixer throttle
% and is written past that loop without the scale, so it is left alone.
% blackbox_decode keeps the raw values; Blackbox Explorer divides on load and
% this does the same, so everything downstream stays in deg/s and stick units.

scale = 1;
for k = 1:size(setupInfo, 1)
if strcmp(strtrim(setupInfo{k,1}), 'blackbox_high_resolution')
v = str2double(strtrim(setupInfo{k,2}));
if ~isnan(v) && v > 0, scale = 10; end
break
end
end

if scale == 1, return; end

fn = fieldnames(T);
for k = 1:numel(fn)
nm = fn{k};
scaled = ~isempty(regexp(nm, '^(gyroADC|gyroUnfilt|rcCommand)_\d+_$', 'once')) || ...
~isempty(regexp(nm, '^setpoint_[0-2]_$', 'once'));
if scaled && isnumeric(T.(nm))
T.(nm) = T.(nm) / scale;
end
end

end
94 changes: 94 additions & 0 deletions src/core/PSbuildController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
function [A, D, F] = PSbuildController(gains, fp, Fs, freq)
%% PSbuildController - Betaflight PID controller as a frequency response
% Splits the controller the way the loop actually uses it: the PI part acts on
% the error, the D part on the gyro, the feedforward part on the setpoint.
% Output units match the logged axisP/axisI/axisD/axisF, so the result can be
% checked straight against a log.
%
% gains - struct with P, I, D, F (as entered in the firmware), optional tpa
% and axis (0=Roll, 1=Pitch, 2=Yaw; yaw runs 2.5x the I gain)
% fp - filter params from PSparseFilterParams, or [] for no dterm filtering
% Fs - PID loop rate (Hz)
% freq - frequency vector (Hz)
%
% A - Kp + Ki/s, on the error
% D - Kd*s*Hdterm, on the gyro (enters the loop with a minus sign)
% F - Kff*s, on the setpoint
%
% F is the weakest of the three. The firmware differentiates the setpoint at
% the RX rate, not the PID rate, then puts it through PT3 smoothing, boost and
% jitter reduction (rc.c:439,463,505,510). This models a plain derivative at
% the PID rate, so hold F against the logged axisF before trusting it.

PTERM_SCALE = 0.032029;
ITERM_SCALE = 0.244381;
DTERM_SCALE = 0.000529;
FF_SCALE = 0.013754;

tpa = 1;
if isfield(gains, 'tpa') && ~isempty(gains.tpa), tpa = gains.tpa; end
axis = 0;
if isfield(gains, 'axis') && ~isempty(gains.axis), axis = gains.axis; end

Kp = gains.P * PTERM_SCALE * tpa;
Ki = gains.I * ITERM_SCALE;
Kd = gains.D * DTERM_SCALE * tpa;
% pid_init.c divides the feedforward slider by 100 before scaling it
Kf = gains.F * FF_SCALE * 0.01;

if axis == 2
Ki = Ki * 2.5;
end

Ts = 1 / Fs;
freq = freq(:);
zinv = exp(-2j*pi*freq*Ts);

A = Kp + Ki * Ts ./ (1 - zinv);
dc = (freq == 0);
if any(dc)
if Ki > 0, A(dc) = Inf; else, A(dc) = Kp; end
end

deriv = (1 - zinv) / Ts;
D = Kd * deriv .* dtermChain(fp, Fs, freq);
F = Kf * deriv;

end


function H = dtermChain(fp, Fs, freq)
def = struct('dterm_lpf1_type', 0, 'dterm_lpf1_hz', 0, ...
'dterm_lpf2_type', 0, 'dterm_lpf2_hz', 0, ...
'dterm_notch_hz', 0, 'dterm_notch_cut', 0);
fn = fieldnames(def);
for k = 1:numel(fn)
if isstruct(fp) && isfield(fp, fn{k}) && ~isempty(fp.(fn{k}))
def.(fn{k}) = fp.(fn{k});
end
end

H = notchResp(def.dterm_notch_hz, def.dterm_notch_cut, Fs, freq);
H = H .* lpfResp(def.dterm_lpf1_type, def.dterm_lpf1_hz, Fs, freq);
H = H .* lpfResp(def.dterm_lpf2_type, def.dterm_lpf2_hz, Fs, freq);
end


function H = lpfResp(type, hz, Fs, freq)
types = {'pt1', 'biquad', 'pt2', 'pt3'}; % BF enum 0..3
H = ones(numel(freq), 1);
if hz <= 0 || type < 0 || type >= numel(types), return; end
[b, a] = PSbfFilters(types{type+1}, hz, Fs);
H = freqz(b, a, freq, Fs);
H = H(:);
end


function H = notchResp(center_hz, cutoff_hz, Fs, freq)
H = ones(numel(freq), 1);
Q = PSnotchQ(center_hz, cutoff_hz);
if Q <= 0, return; end
[b, a] = PSbfFilters('notch', center_hz, Fs, Q);
H = freqz(b, a, freq, Fs);
H = H(:);
end
Loading
Loading