Skip to content
Snippets Groups Projects
Commit 3afdacaf authored by fxk8y's avatar fxk8y :spider:
Browse files

Backing up many changes

parent 5597dab4
No related branches found
No related tags found
No related merge requests found
Showing
with 551 additions and 18 deletions
#include "CapMan.hpp"
// C++ system level
// #include <cstring> // memset, strncmp
// #include <cstdlib> // TODO: is this for memcpy?
#include <cinttypes>
// #include <functional>
// ESP32 specific
// #include "esp_err.h"
#include "esp_log.h"
// #include "driver/gpio.h"
// #include "driver/uart.h"
// project specific
// #include ""
// qthing stuff
// #include <qthing>
/*
namespace SiliconTorch {
// CapabilityManager
namespace CapMan {
void CapMan::publish() {
ESP_LOGW(TAG, "Not implemented!");
}
}
}
*/
\ No newline at end of file
#pragma once
// C++ system level
// #include <string>
// #include <cstring> // memset, strncmp
// #include <cstdlib> // TODO: is this for memcpy?
#include <cinttypes>
// #include <functional>
// ESP32 specific
// #include "esp_err.h"
#include "esp_log.h"
// #include "driver/gpio.h"
// #include "driver/uart.h"
// project specific
// #include ""
// qthing stuff
// #include <qthing>
/*
namespace SiliconTorch {
// CapabilityManager
namespace CapMan {
enum ColorType {
RGB,
RGBW,
RGBWYU,
Greyscale,
CyanLight, // Like GreyScale but with differently colored Pixels
Monochrome,
};
class CapMan {
public:
void registerLEDStrip(std::string& name, uint16_t startIdx, uint16_t length, ColorType);
// void registerExtension(std::string& name);
// void registerExtension(std::string& name, std::initializer_list<std::pair<>> properties);
void publish();
// ⬇⬇ Singleton stuff ⬇⬇
static CapMan& instance() {
static CapMan _instance;
return _instance;
}
CapMan(CapMan const&) = delete;
void operator=(CapMan const&) = delete;
// ⬆⬆ Singleton stuff ⬆⬆
private:
};
}
}
*/
\ No newline at end of file
......@@ -14,6 +14,10 @@
#include "SpiderLib/Callback.hpp"
#include "SpiderLib/CallbackMap.hpp"
// qthing stuff
// #include ""
namespace SiliconTorch {
......
#include "FxCyanF.hpp"
// C++ system level
#include <string>
// #include <cstdio>
// #include <cstdlib>
// #include <algorithm>
// #include <functional>
// ESP32 specific
#include "nvs.h"
#include "nvs_flash.h"
#include "esp_log.h"
// misc
// #include <nlohmann/json.hpp>
// qthing stuff
// #include <qthing>
// #include <qthing/mqtt_common.hpp>
// project specific
// #include "FxVSync.hpp"
// #include "CyanBus.hpp"
// #include "Metrics.hpp"
namespace SiliconTorch {
// namespace FxCyanF {
const std::string nameSpace = "FxCyanF";
bool configureFromNVS(FxCyanF& target) {
nvs_flash_init();
nvs_handle_t nvs;
nvs_open(nameSpace.c_str(), NVS_READONLY, &nvs);
return false;
}
// }
}
......@@ -85,5 +85,9 @@ namespace SiliconTorch {
Metrics::Incrementer frameCntInc;
Metrics::Incrementer errorCntInc;
};
bool configureFromNVS(FxCyanF& target);
//}
}
#include "FxPublish.hpp"
// C++ system level
#include <string>
// #include <cstring> // memset, strncmp
// #include <cstdlib> // TODO: is this for memcpy?
// #include <cinttypes>
// #include <functional>
// ESP32 specific
#include "esp_log.h"
// project specific
#include "CyanBus.hpp"
// qthing stuff
#include <qthing>
/*
static const char* TAG = "FxPublish";
namespace SiliconTorch {
namespace FxPublish {
const std::string HEADER("fxPublish");
FxPublish::FxPublish() {}
void FxPublish::registerAtCyanBus(CyanBus::CyanBus& cyanBus) {
if (!registeredAtCB) {
registeredAtCB = true;
} else {
ESP_LOGW(TAG, "Already registered!");
}
}
}
}
*/
\ No newline at end of file
#pragma once
// C++ system level
#include <string>
// #include <cstring> // memset, strncmp
// #include <cstdlib> // TODO: is this for memcpy?
// #include <cinttypes>
// #include <functional>
// ESP32 specific
// #include "esp_log.h"
// project specific
#include "CyanBus.hpp"
// qthing stuff
// #include <qthing>
/*
namespace SiliconTorch {
namespace FxPublish {
extern const std::string HEADER;
class fxPublish {
public:
FxPublish();
void registerAtCyanBus(CyanBus::CyanBus& cyanBus);
private:
bool registeredAtCB = false;
};
}
}
*/
\ No newline at end of file
#include "CapMan.hpp"
// C++ system level
#include <set>
// #include <cstring> // memset, strncmp
// #include <cstdlib> // TODO: is this for memcpy?
#include <cinttypes>
// #include <functional>
// ESP32 specific
#include "esp_log.h"
#include "nvs_flash.h"
// #include "esp_err.h"
// #include "driver/uart.h"
// project specific
// #include ""
// qthing stuff
// #include <qthing>
namespace SiliconTorch {
namespace NVSExplorer {
// NVSExplorer::NVSExplorer() {
void BullShit() {
nvs_flash_init();
ESP_LOGW("NVS", "Scanning 👀");
nvs_iterator_t it = nvs_entry_find("nvs", NULL, NVS_TYPE_ANY);
while (it != NULL) {
nvs_entry_info_t info;
nvs_entry_info(it, &info);
it = nvs_entry_next(it);
ESP_LOGW("NVS", "namespace[ %s ] key[ %s ] type[ %d ]", info.namespace_name, info.key, info.type);
}
}
/* std::set<std::string> listKeys(std::string& _namespace) {
}
std::set<std::string> listNamespaces() {
std::string _namespace = NULL;
return listKeys(_namespace);
} */
}
}
#pragma once
// C++ system level
// #include <cstring> // memset, strncmp
// #include <cstdlib> // TODO: is this for memcpy?
#include <cinttypes>
// #include <functional>
// ESP32 specific
// #include "esp_err.h"
#include "esp_log.h"
// #include "driver/gpio.h"
// #include "driver/uart.h"
// project specific
// #include ""
// qthing stuff
// #include <qthing>
namespace SiliconTorch {
namespace NVSExplorer {
//class NVSExplorer {
//public:
//NVSExplorer();
static void BullShit();
// std::set<std::string> listNamespaces();
// std::set<std::string> listKeys(std::string& _namespace);
// ⬇⬇ Singleton stuff ⬇⬇
/* static NVSExplorer& instance() {
static NVSExplorer _instance;
return _instance;
}
NVSExplorer(NVSExplorer const&) = delete;
void operator=(NVSExplorer const&) = delete;
// ⬆⬆ Singleton stuff ⬆⬆
*/
//private:
//};
}
}
#include "SiliconTorch.hpp"
// C++ system level
#include <cstring> // memset, strncmp
#include <cstdlib> // TODO: is this for memcpy?
#include <cinttypes>
#include <functional>
// ESP32 specific
#include "esp_err.h"
#include "esp_log.h"
#include "driver/gpio.h"
#include "driver/uart.h"
#include "freertos/FreeRTOS.h"
#include "freertos/queue.h"
// project specific
#include "CyanBusCRC.hpp"
#include "LambdaTask.hpp"
#include "SpiderLib/Callback.hpp"
#include "SpiderLib/CallbackMap.hpp"
// qthing stuff
// #include ""
static const char* const TAG = "SiliconTorch";
namespace SiliconTorch {
namespace SiliconTorch {
SiliconTorch::SiliconTorch() {
}
}
}
#pragma once
// C++ system level
#include <string>
#include <cinttypes>
#include <functional>
// ESP32 specific
#include "freertos/FreeRTOS.h"
#include "freertos/queue.h"
// project specific
#include "LambdaTask.hpp"
#include "SpiderLib/Callback.hpp"
#include "SpiderLib/CallbackMap.hpp"
// qthing stuff
// #include ""
namespace SiliconTorch {
namespace SiliconTorch {
class SiliconTorch {
public:
SiliconTorch();
private:
};
}
}
......@@ -4,4 +4,3 @@
#include "Time.hpp"
// ESP32 specific
#include "esp_timer.h"
// C++ system level
#include <cinttypes>
// project specific
// #include "MyHeader.hpp"
namespace SpiderLib {
uint32_t Time::s() { return (uint32_t)(esp_timer_get_time() / 1000000ULL); }
uint64_t Time::ms() { return (uint64_t)(esp_timer_get_time() / 1000ULL); }
uint64_t Time::us() { return (uint64_t) esp_timer_get_time(); }
}
#pragma once
// ESP32 specific
// #include "MyHeader.h"
// C++ system level
#include <cinttypes>
// project specific
// #include "MyHeader.hpp"
namespace SpiderLib {
class Time {
public:
static uint32_t s();
static uint64_t ms();
static uint64_t us();
};
}
#include "Util.hpp"
// ESP32 specific
#include "esp_timer.h"
// #include "esp_log.h"
// C++ system level
#include <cinttypes>
#include <string>
#include <vector>
#include <sstream>
// #include <cinttypes>
// project specific
// #include "MyHeader.hpp"
......@@ -13,9 +16,23 @@
namespace SpiderLib {
namespace Util {
uint32_t Time::s() { return (uint32_t)(esp_timer_get_time() / 1000000ULL); }
uint64_t Time::ms() { return (uint64_t)(esp_timer_get_time() / 1000ULL); }
uint64_t Time::us() { return (uint64_t) esp_timer_get_time(); }
// Taken from: https://stackoverflow.com/a/27511119
// slightly modified by fxk8y
std::vector<std::string> split(const std::string& s, char delim) {
std::string item;
std::stringstream ss(s);
std::vector<std::string> out;
while (std::getline(ss, item, delim)) {
out.push_back(item);
// out.push_back(std::move(item)); // if C++11 (based on comment from @mchiasson)
}
return out;
}
}
}
#pragma once
// ESP32 specific
// #include "MyHeader.h"
// #include "esp_log.h"
// C++ system level
#include <vector>
#include <string>
#include <cinttypes>
// project specific
......@@ -12,11 +14,9 @@
namespace SpiderLib {
namespace Util {
class Time {
public:
static uint32_t s();
static uint64_t ms();
static uint64_t us();
};
std::vector<std::string> split(const std::string& s, char delim);
}
}
// hostname and device namespace
#define DEVICE_NAME "CyanLight"
#define DEVICE_NAME "CLC-Drucker"
#define NTP_SERVER "pool.ntp.org"
......
......@@ -23,6 +23,8 @@
#include "SiliconTorch/FxCyanRGB8.hpp"
//#include "SiliconTorch/FxPublish.hpp"
// ### END LIBS ###
......@@ -31,14 +33,23 @@
SiliconTorch::CyanBus::CyanBus* cyanBus = NULL;
//SiliconTorch::FxPublish::FxPublish* fxPub = NULL;
SiliconTorch::FxCyanRGB8::FxCyanRGB8* cyanRGB = NULL;
CyanLight::CyanLightControl* ctrl;
#include "SiliconTorch/NVSExplorer.hpp"
void device_main() {
//SiliconTorch::NVSExplorer::BullShit();
//return;
qthing::Config cfg;
// Needed for packet parsing, animation rendering and stuff
......@@ -48,18 +59,20 @@ void device_main() {
cyanBus = new SiliconTorch::CyanBus::CyanBus(13, 14, 12, 15, 2000000); // Pinout of CyanStripe
//cyanBus = new SiliconTorch::CyanBus::CyanBus(13, 14, 12, 15, 2000000); // Pinout of CyanStripe
auto led0 = cfg.add<qthing::leds::WS2812B_V3>(GPIO_NUM_27, 8);
/* auto led0 = cfg.add<qthing::leds::WS2812B_V3>(GPIO_NUM_27, 8);
cyanRGB = new SiliconTorch::FxCyanRGB8::FxCyanRGB8(8);
cyanRGB->registerUDPHandler();
cyanRGB->registerAtCyanBus(*cyanBus);
auto bullshitPtr = std::shared_ptr<qthing::Animation<qthing::RGB>>(cyanRGB, [](void*){});
cfg.add<qthing::Animator<qthing::RGBW8>>(led0)->setAnimation(bullshitPtr);
cfg.add<qthing::Animator<qthing::RGBW8>>(led0)->setAnimation(bullshitPtr); */
//fxPub = new SiliconTorch::FxPublish::FxPublish();
//fxPub->registerAtCyanBus(*cyanBus);
......@@ -69,7 +82,7 @@ void device_main() {
qthing::enable_wifi();
cfg.apply();
return;
//return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment