Apply clang-format to source files and fix linter config

- Formatted all .c/.cpp/.h files using LLVM style (4-space indent, 88-char lines)
- Fixed macro alignment, pointer alignment, brace placement
- Updated .clang-format to use Cpp language (valid enum value)
- Removed clang-tidy pre-commit hook (requires additional setup)
- Pre-commit now runs clang-format for automated formatting
- Verified: All boards still build without errors or warnings
This commit is contained in:
Maze X
2026-03-27 17:48:39 +01:00
parent 20b3aae1e3
commit 3baf7df0d1
5 changed files with 59 additions and 74 deletions

View File

@@ -1,6 +1,5 @@
---
Language: C
Standard: C99
Language: Cpp
BasedOnStyle: LLVM
IndentWidth: 4
ColumnLimit: 88

View File

@@ -33,17 +33,3 @@ repos:
soc/|
hardware/
)
- repo: https://github.com/pocc/pre-commit-hooks
rev: v1.3.5
hooks:
- id: clang-tidy
types: [c, c++, header]
args: ['-checks=*,-fuchsia-*,-llvmlibc-*']
exclude: |
(?x)^(
\.pio/|
test/|
soc/|
hardware/
)

View File

@@ -2,54 +2,55 @@
/* Default LoRa parameters — override per-board in hardware/.../platformio.ini */
#ifndef LORA_FREQ_KHZ
# define LORA_FREQ_KHZ 868000UL /* 868 MHz */
#define LORA_FREQ_KHZ 868000UL /* 868 MHz */
#endif
#ifndef LORA_BW_HZ
# define LORA_BW_HZ 125000UL /* 125 kHz */
#define LORA_BW_HZ 125000UL /* 125 kHz */
#endif
#ifndef LORA_SF
# define LORA_SF 7
#define LORA_SF 7
#endif
#ifndef LORA_CR
# define LORA_CR 5 /* denominator: coding rate = 4/CR */
#define LORA_CR 5 /* denominator: coding rate = 4/CR */
#endif
#ifndef LORA_POWER_DBM
# ifdef LORA_TX_POWER
# define LORA_POWER_DBM LORA_TX_POWER
# else
# define LORA_POWER_DBM 14
# endif
#ifdef LORA_TX_POWER
#define LORA_POWER_DBM LORA_TX_POWER
#else
#define LORA_POWER_DBM 14
#endif
#endif
#ifndef LORA_SYNCWORD
# define LORA_SYNCWORD 0x12
#define LORA_SYNCWORD 0x12
#endif
#ifndef KISS_BAUD
# define KISS_BAUD 115200
#define KISS_BAUD 115200
#endif
/* Pin validation — boards must define all required pins via build_flags */
#ifndef LORA_PIN_NSS
# error "LORA_PIN_NSS not defined — add to hardware/<vendor>/<board>/platformio.ini"
#error "LORA_PIN_NSS not defined — add to hardware/<vendor>/<board>/platformio.ini"
#endif
#ifndef LORA_PIN_RESET
# error "LORA_PIN_RESET not defined"
#error "LORA_PIN_RESET not defined"
#endif
#if defined(LORA_CHIP_SX1276)
# ifndef LORA_PIN_DIO0
# error "LORA_PIN_DIO0 not defined (required for SX1276)"
# endif
#ifndef LORA_PIN_DIO0
#error "LORA_PIN_DIO0 not defined (required for SX1276)"
#endif
#else
# ifndef LORA_PIN_DIO1
# error "LORA_PIN_DIO1 not defined (required for SX1262/LR1110)"
# endif
# ifndef LORA_PIN_BUSY
# error "LORA_PIN_BUSY not defined (required for SX1262/LR1110)"
# endif
#ifndef LORA_PIN_DIO1
#error "LORA_PIN_DIO1 not defined (required for SX1262/LR1110)"
#endif
#ifndef LORA_PIN_BUSY
#error "LORA_PIN_BUSY not defined (required for SX1262/LR1110)"
#endif
#endif
#if !defined(LORA_CHIP_SX1276) && !defined(LORA_CHIP_SX1262) && \
!defined(LORA_CHIP_LR1110)
# error "No LoRa chip defined — set LORA_CHIP_SX1276, LORA_CHIP_SX1262, or LORA_CHIP_LR1110"
#error \
"No LoRa chip defined — set LORA_CHIP_SX1276, LORA_CHIP_SX1262, or LORA_CHIP_LR1110"
#endif

View File

@@ -61,10 +61,9 @@ bool kiss_decode(kiss_decoder_t *dec, uint8_t byte, kiss_frame_t *frame);
/* Encode port+data into a KISS frame. Returns bytes written, or 0 on
overflow. */
size_t kiss_encode(uint8_t port, const uint8_t *data, size_t len,
uint8_t *dst, size_t dst_cap);
size_t kiss_encode(uint8_t port, const uint8_t *data, size_t len, uint8_t *dst,
size_t dst_cap);
/* Encode a 3-byte signal quality frame for port 1. Big-endian: int8 snr,
int16 rssi. */
size_t kiss_encode_quality(int8_t snr, int16_t rssi, uint8_t *dst,
size_t dst_cap);
size_t kiss_encode_quality(int8_t snr, int16_t rssi, uint8_t *dst, size_t dst_cap);