refactor: simplifying project until runs on embedded system

This commit is contained in:
2025-03-26 21:28:50 +01:00
parent c13310d540
commit 171a48eb71
28 changed files with 1260 additions and 3208 deletions
+30 -11
View File
@@ -36,6 +36,9 @@ struct {
#include "watchMain.hpp"
string MyApp::s_ClientName = "CatasWatchDev";
string MyApp::s_ProjectName = "CatastrphicProj";
extern "C" { // This switch allows the ROS C-implementation to find this main
void app_main(void);
}
@@ -614,6 +617,21 @@ void MovementTask() {
}
}
void SpitClientApp() {
ESP_LOGI(TAG, "Starting SPIT task");
auto ptrMyApp = std::make_unique<MyApp>();
// load a client project and start auto detection of SPITServers
ptrMyApp->init();
while (true) {
fos::Task::delayMs(10000);
ESP_LOGI(TAG, "Test LiveShow");
ptrMyApp->testLiveShowRemote(); //This is an excample how to remote control the liveSHOWsoftware
}
}
void app_main(void) {
esp_err_t ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
@@ -633,6 +651,7 @@ void app_main(void) {
static fos::TaskT<int> telnetSocket(telnetSocketTask, ipVersion, "tcpServer", 4096);
static fos::TaskT<int> dmxNode(dmxSocketTask, ipVersion, "dmxNode", 4096);
// static Task otaUpdate(SystemFunctions::OtaTaskEntry, "otaTask", 8192);
static fos::Task spit(SpitClientApp,"SpitClient");
auto &store = NvsApi::getInstance();
auto logger = store.getValue(ConfigKeys.syslogDest);
@@ -640,17 +659,17 @@ void app_main(void) {
Syslog::setupTask(IpAdr{logger, 0});
}
auto broker = store.getValue(ConfigKeys.mqttBroker);
if (broker != "") {
ESP_LOGI(TAG, "Initializing MQTT");
auto prefix = store.getValue(ConfigKeys.mqttPrefix);
auto &client = MqttClient::init(broker, prefix);
if (!client.isRunning()) {
client.addSubscription(MqttTopics.moveTo, [](std::string d) { moveToSubs(d); });
client.addSubscription(MqttTopics.startShuffle, [](std::string d) { startShuffle(d); });
client.start();
}
}
// auto broker = store.getValue(ConfigKeys.mqttBroker);
// if (broker != "") {
// ESP_LOGI(TAG, "Initializing MQTT");
// auto prefix = store.getValue(ConfigKeys.mqttPrefix);
// auto &client = MqttClient::init(broker, prefix);
// if (!client.isRunning()) {
// client.addSubscription(MqttTopics.moveTo, [](std::string d) { moveToSubs(d); });
// client.addSubscription(MqttTopics.startShuffle, [](std::string d) { startShuffle(d); });
// client.start();
// }
// }
while (true) {
fos::Task::delayMs(5000);
+1
View File
@@ -36,6 +36,7 @@
#include "Processor.hpp"
#include "nvsFunctions.hpp"
#include "mqttClient.hpp"
#include "MyApp.h"
// #include "esp_chip_info.h"
// #include "esp_flash.h"