From fedbdd2739a038d2adc905c711befac64b4deda1 Mon Sep 17 00:00:00 2001 From: Hector van der Aa Date: Fri, 27 Mar 2026 23:43:56 +0100 Subject: [PATCH] Added teng low and high update in config on task --- src/modules/config/config.cpp | 28 ++++++++++++++++++++++++++++ src/modules/config/config.h | 2 ++ 2 files changed, 30 insertions(+) diff --git a/src/modules/config/config.cpp b/src/modules/config/config.cpp index 935eec0..932f9c6 100644 --- a/src/modules/config/config.cpp +++ b/src/modules/config/config.cpp @@ -109,6 +109,16 @@ int config::write_vbat_low(double val) { return this->write_cfg(); } +int config::write_teng_low(double val) { + _config.teng_low = val; + return this->write_cfg(); +} + +int config::write_teng_high(double val) { + _config.teng_high = val; + return this->write_cfg(); +} + config::config() : _logger(nullptr), _valid_config(true) {} config::config(system_logger *logger) : _logger(logger), _valid_config(true) {} @@ -249,6 +259,7 @@ int config::handle_active_task(unsigned long timeout_ms) { memcpy(&cal_value, &_active_task.data, sizeof(double)); int res = this->write_vbat_cal(cal_value); this->task_complete(); + return res; } case TASK_CONFIG_VBAT_SET_LOW: { @@ -256,6 +267,23 @@ int config::handle_active_task(unsigned long timeout_ms) { memcpy(&low_value, &_active_task.data, sizeof(double)); int res = this->write_vbat_low(low_value); this->task_complete(); + return res; + } + + case TASK_CONFIG_TENG_SET_LOW: { + double low_value; + memcpy(&low_value, &_active_task.data, sizeof(double)); + int res = this->write_teng_low(low_value); + this->task_complete(); + return res; + } + + case TASK_CONFIG_TENG_SET_HIGH: { + double high_value; + memcpy(&high_value, &_active_task.data, sizeof(double)); + int res = this->write_teng_high(high_value); + this->task_complete(); + return res; } default: diff --git a/src/modules/config/config.h b/src/modules/config/config.h index 31ab65b..68b3a6a 100644 --- a/src/modules/config/config.h +++ b/src/modules/config/config.h @@ -49,6 +49,8 @@ private: int reset_cfg(); int write_vbat_cal(double val); int write_vbat_low(double val); + int write_teng_low(double val); + int write_teng_high(double val); public: int push(const Task &task) override;