From e0168cd4dfe3105d462ec3edd0f9ffd22e967784 Mon Sep 17 00:00:00 2001 From: theshaun Date: Sun, 1 Feb 2026 13:45:37 +1000 Subject: [PATCH] temp fix for airtime till sync from upstream --- .github/instructions/snyk_rules.instructions.md | 14 ++++++++++++++ repeater/airtime.py | 5 +++-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 .github/instructions/snyk_rules.instructions.md diff --git a/.github/instructions/snyk_rules.instructions.md b/.github/instructions/snyk_rules.instructions.md new file mode 100644 index 0000000..eef0634 --- /dev/null +++ b/.github/instructions/snyk_rules.instructions.md @@ -0,0 +1,14 @@ +--- +alwaysApply: true +always_on: true +trigger: always_on +applyTo: "**" +description: Snyk Security At Inception +--- + +# Project security best practices + +- Always run snyk_code_scan tool for new first party code that is generated in a Snyk-supported language. +- If any security issues are found based on newly introduced or modified code or dependencies, attempt to fix the issues using the results context from Snyk. +- Rescan the code after fixing the issues to ensure that the issues were fixed and that there are no newly introduced issues. +- Repeat this process until no new issues are found. diff --git a/repeater/airtime.py b/repeater/airtime.py index bd8ae26..8977489 100644 --- a/repeater/airtime.py +++ b/repeater/airtime.py @@ -53,14 +53,15 @@ class AirtimeManager: Airtime in milliseconds """ sf = spreading_factor or self.spreading_factor - bw_khz = (bandwidth_hz or self.bandwidth) / 1000 + bw_hz = (bandwidth_hz or self.bandwidth) + bw_khz = bw_hz / 1000 cr = coding_rate or self.coding_rate preamble_len = preamble_len or self.preamble_length crc = 1 if crc_enabled else 0 h = 0 if explicit_header else 1 # H=0 for explicit, H=1 for implicit # Low data rate optimization: required for SF11/SF12 at 125kHz - de = 1 if (sf >= 11 and bandwidth_hz <= 125000) else 0 + de = 1 if (sf >= 11 and bw_hz <= 125000) else 0 # Symbol time in milliseconds: T_sym = 2^SF / BW_kHz t_sym = (2 ** sf) / bw_khz