forked from NaxdyOrg/NaxGCC-FW
Compare commits
1 commit
main
...
naxdy-filt
Author | SHA1 | Date | |
---|---|---|---|
8b4f0fe12a |
7 changed files with 94 additions and 14 deletions
|
@ -13,6 +13,10 @@ jobs:
|
|||
echo "extra-trusted-public-keys = attic:05LdE8Nav5Qd1E+KOJqSwdr+WE1z8AUmSb3oKL7s8dk=" >> /etc/nix/nix.conf
|
||||
nix profile install nixpkgs#nodejs "github:zhaofengli/attic?ref=6eabc3f02fae3683bffab483e614bebfcd476b21"
|
||||
echo "PATH=/nix/var/nix/profiles/per-user/root/profile/bin:$PATH" >> "$GITHUB_ENV"
|
||||
- name: Set up attic binary cache
|
||||
run: |
|
||||
attic login "${{ vars.BINARY_CACHE_NAME }}" "${{ vars.BINARY_CACHE_URL }}" "${{ secrets.BINARY_CACHE_AUTH_KEY }}"
|
||||
attic use "${{ vars.BINARY_CACHE_NAME }}"
|
||||
- uses: actions/checkout@v4
|
||||
- name: Run Clippy
|
||||
run: |
|
||||
|
|
|
@ -21,8 +21,12 @@ jobs:
|
|||
echo "PATH=/nix/var/nix/profiles/per-user/root/profile/bin:$PATH" >> "$GITHUB_ENV"
|
||||
- name: Set up attic binary cache
|
||||
run: |
|
||||
attic login "${{ vars.PUBLIC_BINARY_CACHE_NAME }}" "${{ vars.BINARY_CACHE_URL }}" "${{ secrets.PUBLIC_BINARY_CACHE_AUTH_KEY }}"
|
||||
attic use "${{ vars.PUBLIC_BINARY_CACHE_NAME }}"
|
||||
attic login "${{ vars.BINARY_CACHE_NAME }}" "${{ vars.BINARY_CACHE_URL }}" "${{ secrets.BINARY_CACHE_AUTH_KEY }}"
|
||||
attic use "${{ vars.BINARY_CACHE_NAME }}"
|
||||
- name: Prepare SSH key
|
||||
run: |
|
||||
mkdir -p dist && mkdir -p ~/.ssh
|
||||
ssh-keyscan git.naxdy.org >> ~/.ssh/known_hosts
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build firmware image
|
||||
run: |
|
||||
|
@ -30,7 +34,7 @@ jobs:
|
|||
- name: Push derivations to binary cache
|
||||
run: |
|
||||
cd /nix/store
|
||||
attic push "${{ vars.PUBLIC_BINARY_CACHE_NAME }}" $(ls /nix/store --ignore='*.drv' --ignore='*fake_nixpkgs*')
|
||||
attic push "${{ vars.BINARY_CACHE_NAME }}" $(ls /nix/store --ignore='*.drv' --ignore='*fake_nixpkgs*')
|
||||
- name: (Re-)generate tag
|
||||
run: |
|
||||
git config --global user.email "noreply@naxdy.org"
|
||||
|
@ -47,9 +51,5 @@ jobs:
|
|||
tag_name: nightly
|
||||
prerelease: true
|
||||
name: "Nightly Release"
|
||||
body: >
|
||||
This is an automatically generated nightly release.
|
||||
|
||||
**WARNING:** This release may contain untested changes and could potentially break your configuration. Use at your own risk. **Do not report issues you encounter with nightly releases.**
|
||||
files: |
|
||||
dist/bin/*
|
||||
|
|
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -1,6 +1,5 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
# A Comment
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
|
|
4
flake.lock
generated
4
flake.lock
generated
|
@ -9,12 +9,12 @@
|
|||
"rev": "2ee4657727b9679998d941de00b43e1754f570bf",
|
||||
"revCount": 6754,
|
||||
"type": "git",
|
||||
"url": "https://gitea@git.naxdy.org/NaxdyOrg/embassy"
|
||||
"url": "ssh://gitea@git.naxdy.org/NaxdyOrg/embassy"
|
||||
},
|
||||
"original": {
|
||||
"ref": "naxgcc-fw",
|
||||
"type": "git",
|
||||
"url": "https://gitea@git.naxdy.org/NaxdyOrg/embassy"
|
||||
"url": "ssh://gitea@git.naxdy.org/NaxdyOrg/embassy"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
embassy-rs-patched = {
|
||||
url = "git+https://gitea@git.naxdy.org/NaxdyOrg/embassy?ref=naxgcc-fw";
|
||||
url = "git+ssh://gitea@git.naxdy.org/NaxdyOrg/embassy?ref=naxgcc-fw";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ use crate::{
|
|||
filter::{run_waveshaping, FilterGains, KalmanState, WaveshapingValues, FILTER_GAINS},
|
||||
gcc_hid::GcReport,
|
||||
helpers::XyValuePair,
|
||||
input_filter::{DummyFilter, InputFilter},
|
||||
input_filter::{InputFilter, NaxdyFilter},
|
||||
stick::{linearize, notch_remap, StickParams},
|
||||
};
|
||||
|
||||
|
@ -446,7 +446,7 @@ pub async fn update_button_state_task(
|
|||
let mut override_stick_state: Option<OverrideStickState> = None;
|
||||
|
||||
// replace this with the input filter of your choice, if you so desire.
|
||||
let mut input_filter = DummyFilter;
|
||||
let mut input_filter = NaxdyFilter::new();
|
||||
|
||||
loop {
|
||||
update_button_states(
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use defmt::warn;
|
||||
use defmt::{warn, Format};
|
||||
|
||||
use crate::{
|
||||
config::{is_awaitable_button_pressed, AwaitableButtons},
|
||||
|
@ -107,3 +107,80 @@ pub struct DummyFilter;
|
|||
impl InputFilter for DummyFilter {
|
||||
fn apply_filter(&mut self, _gcc_state: &mut GcReport) {}
|
||||
}
|
||||
|
||||
#[derive(Debug, Format, Clone, Copy, PartialEq, Eq)]
|
||||
enum NaxdyFilterMode {
|
||||
Steve,
|
||||
Snake,
|
||||
Inactive,
|
||||
}
|
||||
|
||||
pub struct NaxdyFilter {
|
||||
mode: NaxdyFilterMode,
|
||||
short_hop_filter: SingleButtonMacroFilter,
|
||||
item_pickup_filter: SingleButtonMacroFilter,
|
||||
cstick_up_tilt_filter: CStickUpTiltFilter,
|
||||
}
|
||||
|
||||
impl NaxdyFilter {
|
||||
#[allow(dead_code)]
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
mode: NaxdyFilterMode::Snake,
|
||||
short_hop_filter: SingleButtonMacroFilter {
|
||||
btn_instigator: AwaitableButtons::Y,
|
||||
btn_to_press: AwaitableButtons::X,
|
||||
},
|
||||
item_pickup_filter: SingleButtonMacroFilter {
|
||||
btn_instigator: AwaitableButtons::Y,
|
||||
btn_to_press: AwaitableButtons::L,
|
||||
},
|
||||
cstick_up_tilt_filter: CStickUpTiltFilter,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl InputFilter for NaxdyFilter {
|
||||
fn apply_filter(&mut self, gcc_state: &mut GcReport) {
|
||||
if gcc_state.buttons_1.button_a
|
||||
&& gcc_state.buttons_1.button_b
|
||||
&& gcc_state.buttons_1.dpad_right
|
||||
&& self.mode != NaxdyFilterMode::Inactive
|
||||
{
|
||||
self.mode = NaxdyFilterMode::Snake
|
||||
}
|
||||
|
||||
if gcc_state.buttons_1.button_a
|
||||
&& gcc_state.buttons_1.button_b
|
||||
&& gcc_state.buttons_1.dpad_left
|
||||
&& self.mode != NaxdyFilterMode::Inactive
|
||||
{
|
||||
self.mode = NaxdyFilterMode::Steve;
|
||||
}
|
||||
|
||||
if gcc_state.buttons_1.button_a
|
||||
&& gcc_state.buttons_1.button_b
|
||||
&& gcc_state.buttons_1.dpad_up
|
||||
&& self.mode == NaxdyFilterMode::Inactive
|
||||
{
|
||||
self.mode = NaxdyFilterMode::Snake;
|
||||
} else if gcc_state.buttons_1.button_a
|
||||
&& gcc_state.buttons_1.button_b
|
||||
&& gcc_state.buttons_1.dpad_down
|
||||
&& self.mode != NaxdyFilterMode::Inactive
|
||||
{
|
||||
self.mode = NaxdyFilterMode::Inactive;
|
||||
}
|
||||
|
||||
match self.mode {
|
||||
NaxdyFilterMode::Steve => {
|
||||
self.short_hop_filter.apply_filter(gcc_state);
|
||||
}
|
||||
NaxdyFilterMode::Snake => {
|
||||
self.cstick_up_tilt_filter.apply_filter(gcc_state);
|
||||
self.item_pickup_filter.apply_filter(gcc_state);
|
||||
}
|
||||
NaxdyFilterMode::Inactive => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue