From 5824028b54e5614dd093964c6e78b113f71036b2 Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Thu, 1 Dec 2022 13:50:21 -0800 Subject: [PATCH] update libfirmware (#169) * update * fragments * livedata * livedata --- firmware/libfirmware | 2 +- firmware/livedata.cpp | 21 +++++++++++++-------- firmware/livedata.h | 6 ++---- firmware/max31855.cpp | 8 +++++--- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/firmware/libfirmware b/firmware/libfirmware index ba9e280..16a8e0b 160000 --- a/firmware/libfirmware +++ b/firmware/libfirmware @@ -1 +1 @@ -Subproject commit ba9e280fc477c577dda124981b52f6108ff43015 +Subproject commit 16a8e0b636f0a8d5f88dfdd6a1a4639ad90da936 diff --git a/firmware/livedata.cpp b/firmware/livedata.cpp index 3954c90..77ca9a6 100644 --- a/firmware/livedata.cpp +++ b/firmware/livedata.cpp @@ -33,24 +33,29 @@ void SamplingUpdateLiveData() livedata_common.vbatt = GetInternalBatteryVoltage(0); } -const livedata_common_s * getCommonLiveDataStructAddr() +template<> +const livedata_common_s* getLiveData(size_t) { return &livedata_common; } -const struct livedata_afr_s * getAfrLiveDataStructAddr(const int ch) +template<> +const struct livedata_afr_s * getLiveData(size_t ch) { if (ch < AFR_CHANNELS) + { return &livedata_afr[ch]; - return NULL; + } + + return nullptr; } static const FragmentEntry fragments[] = { - getCommonLiveDataStructAddr(), - getAfrLiveDataStructAddr(0), - getAfrLiveDataStructAddr(1), - getEgtLiveDataStructAddr(0), - getEgtLiveDataStructAddr(1) + decl_frag{}, + decl_frag{}, + decl_frag{}, + decl_frag{}, + decl_frag{}, }; FragmentList getFragments() { diff --git a/firmware/livedata.h b/firmware/livedata.h index 442c575..0a0af25 100644 --- a/firmware/livedata.h +++ b/firmware/livedata.h @@ -2,6 +2,8 @@ #include +#include + #include "wideband_config.h" /* +0 offset */ @@ -34,7 +36,3 @@ struct livedata_afr_s { /* update functions */ void SamplingUpdateLiveData(); - -/* access functions */ -const struct livedata_common_s * getCommonLiveDataStructAddr(); -const struct livedata_afr_s * getAfrLiveDataStructAddr(const int ch); diff --git a/firmware/max31855.cpp b/firmware/max31855.cpp index c84a74d..4c9c72c 100644 --- a/firmware/max31855.cpp +++ b/firmware/max31855.cpp @@ -144,7 +144,8 @@ Max31855* getEgtDrivers() { return instances; } -const struct livedata_egt_s * getEgtLiveDataStructAddr(const int ch) +template<> +const livedata_egt_s* getLiveData(size_t ch) { if (ch < EGT_CHANNELS) return &getEgtDrivers()[ch].livedata; @@ -153,9 +154,10 @@ const struct livedata_egt_s * getEgtLiveDataStructAddr(const int ch) #else -const struct livedata_egt_s * getEgtLiveDataStructAddr(const int) +template<> +const livedata_egt_s* getLiveData(size_t) { - return NULL; + return nullptr; } #endif /* EGT_CHANNELS > 0 */