From dbf35e8b60ba2707a0494c5c71d33d7ed9fe7e50 Mon Sep 17 00:00:00 2001 From: George Norton Date: Tue, 22 Aug 2023 23:00:36 +0100 Subject: [PATCH] Increase filter stages to 20. We cant quite run that many though. --- firmware/code/bqf.h | 6 +++--- firmware/code/configuration_types.h | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/firmware/code/bqf.h b/firmware/code/bqf.h index a347575..5a38ccb 100644 --- a/firmware/code/bqf.h +++ b/firmware/code/bqf.h @@ -41,9 +41,9 @@ typedef struct _bqf_mem_t { fix3_28_t y_2; } bqf_mem_t; -// In reality we do not have enough CPU resource to run 8 filtering -// stages without some optimisation. -#define MAX_FILTER_STAGES 16 +// More filters should be possible, but the config structure +// might grow beyond the current 512 byte size. +#define MAX_FILTER_STAGES 20 extern int filter_stages; extern bqf_coeff_t bqf_filters_left[MAX_FILTER_STAGES]; diff --git a/firmware/code/configuration_types.h b/firmware/code/configuration_types.h index 4b638ac..051edd4 100644 --- a/firmware/code/configuration_types.h +++ b/firmware/code/configuration_types.h @@ -17,8 +17,8 @@ #include #define FLASH_MAGIC 0x2E8AFEDD -#define CONFIG_VERSION 2 -#define MINIMUM_CONFIG_VERSION 1 +#define CONFIG_VERSION 3 +#define MINIMUM_CONFIG_VERSION 3 enum structure_types { // Commands/Responses, these are container TLVs. The Value will be a set of TLV structures. @@ -53,18 +53,20 @@ typedef struct __attribute__((__packed__)) _tlv_header { typedef struct __attribute__((__packed__)) _filter2 { uint8_t type; uint8_t reserved[3]; - double f0; - double Q; + float f0; + float Q; } filter2; typedef struct __attribute__((__packed__)) _filter3 { uint8_t type; uint8_t reserved[3]; - double f0; - double db_gain; - double Q; + float f0; + float db_gain; + float Q; } filter3; +// WARNING: We wont be able to support more than 8 of these filters +// due to the config structure size. typedef struct __attribute__((__packed__)) _filter6 { uint8_t type; uint8_t reserved[3]; @@ -98,7 +100,7 @@ typedef struct __attribute__((__packed__)) _flash_header_tlv { typedef struct __attribute__((__packed__)) _preprocessing_configuration_tlv { tlv_header header; - double preamp; + float preamp; uint8_t reverse_stereo; uint8_t reserved[3]; } preprocessing_configuration_tlv;