diff --git a/CLC-qthing/SiliconTorch/FxCyanF-configureFromNVS.cpp b/CLC-qthing/SiliconTorch/FxCyanF-configureFromNVS.cpp deleted file mode 100644 index 49e83fd52a7685847586fb3360b25381630633cc..0000000000000000000000000000000000000000 --- a/CLC-qthing/SiliconTorch/FxCyanF-configureFromNVS.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include "FxCyanF.hpp" - -// C++ system level -#include <cstdio> // snprintf -// #include <cstdlib> -// #include <algorithm> -// #include <functional> - -// ESP32 specific -#include "esp_log.h" - -// misc -// #include <nlohmann/json.hpp> - -// qthing stuff -// #include <qthing> -// #include <qthing/mqtt_common.hpp> - -// project specific -#include "NVSExplorer.hpp" -#include <SpiderLib/NumberTypes.hpp> -#include <SpiderLib/ObjectTypes.hpp> - - -const char* TAG_nvs = "FxCyanF-NVS"; - - -namespace SiliconTorch { - - namespace FxCyanF { - - - const str ServiceNamespace = "fxCyan"; - - - FxCyanF* configureFromNVS() { - - u8 state = 0; // disabled -> 0 enabled -> 1 - state = NVSExplorer::NVSExplorer::instance().getUnsignedInt(ServiceNamespace, "state", state); - - if (state == 0) { - ESP_LOGI(TAG_nvs, "Service[ FxCyanF ] disabled[âŒ]"); - return NULL; - } - - FxCyanF* target = new FxCyanF(); - - ESP_LOGI(TAG_nvs, "Service[ FxCyanF ] enabling[✅]…"); - - u32 frq = DefaultFrequency; - u8 res = DefaultResolution; - - frq = NVSExplorer::NVSExplorer::instance().getUnsignedInt(ServiceNamespace, "frequency", frq); - res = NVSExplorer::NVSExplorer::instance().getUnsignedInt(ServiceNamespace, "resolution", res); - - - ESP_LOGI(TAG_nvs, "Configuring: FxCyanF{ frequency[ %d Hz ] resolution[ %d Bit ] }", frq, res); - target->setFrqRes(frq, res); - - for (u8 ch = 0; ch < MAX_CHANNELS; ch++) { - - - char buffer[32]; - snprintf(buffer, 32, "ch%d_gpio", ch); - - u8 gpio = NVSExplorer::NVSExplorer::instance().getUnsignedInt(ServiceNamespace, buffer, 0xFF) & 0xFF; - - snprintf(buffer, 32, "ch%d_pwm", ch); - f32 pwm = NVSExplorer::NVSExplorer::instance().getFloat(ServiceNamespace, buffer); - - // NaN == "no value stored" or any other reading error - if (std::isnan(pwm)) pwm = 0.0f; - - if (gpio != 0xFF) { // key exists - - if ( target->addChannel(gpio, pwm) ) { // channel creation successful - - ESP_LOGI(TAG_nvs, "Configuring: FxCyanF{ channel[ %d ] gpio[ %d ] pwm[ %f ] }", ch, gpio, pwm); - - target->setPWM(ch, pwm); - - } else { - ESP_LOGW(TAG_nvs, "Configuring: FxCyanF{ channel[ %d ] gpio[ %d ] } FAILED[âŒ]", ch, gpio); - break; - } - - } else { - break; - } - } - - return target; - } - - - } -} diff --git a/CLC-qthing/SiliconTorch/FxCyanF-classImplementation.cpp b/CLC-qthing/SiliconTorch/FxCyanF.cpp similarity index 100% rename from CLC-qthing/SiliconTorch/FxCyanF-classImplementation.cpp rename to CLC-qthing/SiliconTorch/FxCyanF.cpp diff --git a/CLC-qthing/SiliconTorch/FxCyanF.hpp b/CLC-qthing/SiliconTorch/FxCyanF.hpp index b85de525316a670e3db509729398e71abbae15a8..4b0c0c8127fe200a4f3af1dd8899c81a971e380f 100644 --- a/CLC-qthing/SiliconTorch/FxCyanF.hpp +++ b/CLC-qthing/SiliconTorch/FxCyanF.hpp @@ -97,8 +97,5 @@ namespace SiliconTorch { Metrics::Incrementer errorCntInc; }; - - FxCyanF* configureFromNVS(); - } }