Compare commits

..

47 Commits

Author SHA1 Message Date
gustice c247b38f7b changing app 2026-10-18 16:28:09 +02:00
gustice 348a1a1e14 tests: Make more tests run 2026-01-06 17:01:31 +01:00
gustice 118291f8ab refactor: Tidy up SPIT 2 2026-01-05 19:53:30 +01:00
gustice 4a97988227 refactor: Tidy up SPIT 2025-11-15 20:57:26 +01:00
gustice 7aec14cbb9 feat: shuffle mode 2025-11-15 18:19:06 +01:00
gustice 331258692b temp 2025-11-15 00:48:13 +01:00
gustice 0ecd846183 fix: Spit working again also with linux 2025-11-14 23:29:44 +01:00
gustice 66140ea823 refactor: Working on SPIT yet again 2025-11-14 21:31:10 +01:00
gustice c01439dc05 proj: cleaning project files 2025-11-13 21:07:37 +01:00
gustice 20d1ca79b8 cli improvement 2025-11-13 00:39:48 +01:00
gustice bd4a593963 feat: Full featured Telnet implementation (not integrated) 2025-11-13 00:24:43 +01:00
gustice 3afaf3848f refactor: Heavy refactoring of SPIT 2025-11-11 14:24:34 +01:00
gustice a18ddf2cb1 feat: Switching to mqtt 2025-11-10 20:52:14 +01:00
gustice de9ff6f807 refactor repo 2025-11-10 15:34:07 +01:00
gustice f064794499 refactoring message 2025-11-10 10:43:13 +01:00
gustice 598f1262d7 proj: refinement 2025-11-09 19:04:54 +01:00
gustice 889523f0c8 temp 2025-10-30 17:38:36 +01:00
gustice 8f0dbd4cbd proj: switching to Linux 2025-07-06 11:00:34 +02:00
gustice 9ebbedb04a refactor: Heavy refactoring to modern code style 2025-04-08 23:50:09 +02:00
gustice 04a8904cbe refactor/bringup: Bringup full project
moving SPIT-App parts to main app
LiveShowDemoProject added
Debugging motor movements
2025-04-08 23:49:05 +02:00
gustice 810264aa71 feat: Migrating features from newer implementation 2025-03-29 21:29:14 +01:00
gustice 171a48eb71 refactor: simplifying project until runs on embedded system 2025-03-29 21:28:36 +01:00
gustice c13310d540 migrate fully to freeRTOS 2025-02-15 22:21:19 +01:00
gustice 4e94d7ad78 feature: Project builds with integrated SPIT client (however with some exclusions) 2025-02-15 22:20:39 +01:00
gustice 500641a6e2 feature: Add SPIT-Source as is 2025-02-15 22:02:17 +01:00
gustice a5805aceb2 proj: Migrate to core as git-submodule 2025-02-15 21:49:15 +01:00
gustice c7e1b4805b proj: added dependency to core project 2025-02-15 16:44:23 +01:00
gustice b667f9c255 proj: Simple logo created 2025-02-15 16:43:52 +01:00
gustice 199007c0c5 refactor: Rewiring MQTT constants to toplevel defined constants 2025-02-15 16:43:26 +01:00
gustice c872f1a9ae feature: Pictogram illumination queue 2025-01-18 22:46:00 +01:00
gustice 5fcc0dda1e feature: Including MQTT client 2025-01-16 22:44:55 +01:00
gustice 968d078c07 Adding NVS to project 2025-01-01 21:15:01 +01:00
gustice dd9f59e418 motor control changed to infinit pipeline with continuous buffer 2024-12-23 19:51:25 +01:00
gustice eb0eb436ed added utils from different project 2024-12-15 23:07:25 +01:00
gustice 6db9bd85a5 including light effects from different project 2024-12-15 22:46:44 +01:00
gustice e4621f8ad8 including ArtNet feature from different Project 2024-12-15 22:21:39 +01:00
gustice 1cf86768c0 including tftp based shell and sockets from different project 2024-12-15 12:09:32 +01:00
gustice bd923e4fdc proj: switching to ESP32C6 2024-12-15 00:47:32 +01:00
gustice 2dc06e8d79 including homing sensor 2024-11-23 22:01:01 +01:00
gustice de2c0c167c add gpio and finalisation of pinning 2024-11-16 21:23:26 +01:00
gustice 0181c72a9d PWM based motor driver added from other project 2024-11-16 20:04:38 +01:00
gustice f6608075ff I2C PWM expander added from different Project 2024-11-16 16:42:29 +01:00
gustice deccb3186c adding freeRtos API from different project 2024-11-16 15:50:59 +01:00
gustice 49b3b46ffe migrate to cpp app remove irrelevant parts 2024-11-16 15:30:33 +01:00
gustice 33c875c6bd removing wifi support and include net-IF 2024-11-16 12:59:57 +01:00
gustice 3f627f08f7 simple demo runs 2024-11-16 12:02:17 +01:00
gustice bc651eff27 Compiles but does not run 2024-11-16 11:53:28 +01:00
14 changed files with 279 additions and 192 deletions
+1 -1
View File
@@ -78,5 +78,5 @@
}, },
"idf.currentSetup": "C:\\esp\\v5.4.3\\esp-idf", "idf.currentSetup": "C:\\esp\\v5.4.3\\esp-idf",
"idf.port": "COM16" "idf.port": "COM4"
} }
+1 -1
View File
@@ -20,6 +20,6 @@ else()
) )
include($ENV{IDF_PATH}/tools/cmake/project.cmake) include($ENV{IDF_PATH}/tools/cmake/project.cmake)
message("Using Main App") message("Using Main App")
project(LeoLightShow) project(WatchController)
endif() endif()
endif() endif()
@@ -2,6 +2,8 @@
* @file TestableUTest.cpp * @file TestableUTest.cpp
* @author Gustice * @author Gustice
* @brief * @brief
*
* @copyright Copyright (c) 2024
*/ */
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
+1 -1
Submodule core updated: c80f61a60a...e584259b31
+12 -1
View File
@@ -1,10 +1,21 @@
dependencies: dependencies:
frozen-eye/esp_telnet:
component_hash: e00a16d6372fa31df46b32e330847d6e09af2ec184d8c7cac4d183b3daac02e5
dependencies:
- name: idf
require: private
version: '>=4.0'
source:
registry_url: https://components.espressif.com/
type: service
version: 0.0.2
idf: idf:
source: source:
type: idf type: idf
version: 5.4.3 version: 5.4.3
direct_dependencies: direct_dependencies:
- frozen-eye/esp_telnet
- idf - idf
manifest_hash: f963becbad30dee4a0a46222b7f0ae7dd40100701f7b7147a846011f8dabe9ca manifest_hash: f3dbb2beffe19f6e4fa3818b79ea2bfac679eaaf47effee78f152007a2be54f5
target: esp32 target: esp32
version: 2.0.0 version: 2.0.0
+28
View File
@@ -0,0 +1,28 @@
menu "Example Configuration"
config DEVICE_WIFI_SSID
string "Wi-Fi SSID"
default "eth2ap"
help
Set the SSID of Wi-Fi ap interface.
config DEVICE_WIFI_PASSWORD
string "Wi-Fi Password"
default "12345678"
help
Set the password of Wi-Fi ap interface.
config DEVICE_WIFI_CHANNEL
int "WiFi channel"
range 1 13
default 1
help
Set the channel of Wi-Fi ap.
config DEVICE_MAX_STA_CONN
int "Maximum STA connections"
default 4
help
Maximum number of the station that allowed to connect to current Wi-Fi hotspot.
endmenu
+6
View File
@@ -0,0 +1,6 @@
## IDF Component Manager Manifest File
# https://docs.espressif.com/projects/idf-component-manager/en/latest/reference/manifest_file.html
# https://components.espressif.com
dependencies:
frozen-eye/esp_telnet: "^0.0.2"
+6 -7
View File
@@ -1,6 +1,8 @@
/** /**
* @file watchMain.hpp * @file watchMain.hpp
* @author Gustice * @author Gustice
*
* @copyright Copyright (c) 2024
*/ */
#pragma once #pragma once
@@ -8,11 +10,6 @@
#include <cstring> #include <cstring>
#include <cstdlib> #include <cstdlib>
#include <cmath> #include <cmath>
#include <chrono>
#include <string>
#include <map>
#include <vector>
#include "sdkconfig.h" #include "sdkconfig.h"
#include "esp_event.h" #include "esp_event.h"
#include "esp_log.h" #include "esp_log.h"
@@ -46,5 +43,7 @@
#include "spit_player.hpp" #include "spit_player.hpp"
#include "spit_type.hpp" #include "spit_type.hpp"
#include "spit_client.hpp" #include "spit_client.hpp"
#include "addressableLeRtz.hpp" #include <chrono>
#include "systemFunctions.hpp" #include <string>
#include <map>
#include <vector>
+188 -151
View File
@@ -13,9 +13,6 @@
// ETH_PHY_LAN8720, // eth_type, // ETH_PHY_LAN8720, // eth_type,
// ETH_CLOCK_GPIO0_IN // eth_clk_mode as input // ETH_CLOCK_GPIO0_IN // eth_clk_mode as input
// }, // },
//
// LED-Strips: 14 - 22 - 30
// >> update http://172.16.16.10:8000/LeoLightShow.bin
#include "config.hpp" #include "config.hpp"
#include "lighsMain.hpp" #include "lighsMain.hpp"
@@ -25,32 +22,63 @@ using namespace std;
string ClientName = "LeoLightsDev"; string ClientName = "LeoLightsDev";
string ProjectName = "LeoLightsProj"; string ProjectName = "LeoLightsProj";
gpio_num_t LedPin = gpio_num_t::GPIO_NUM_16;
gpio_num_t RelayPin = gpio_num_t::GPIO_NUM_18;
extern "C" { // This switch allows the ROS C-implementation to find this main extern "C" { // This switch allows the ROS C-implementation to find this main
void app_main(void); void app_main(void);
} }
struct DeviceState { struct DeviceState {
Color color{0x80, 0x80, 0x40}; // Color for the chosen bottle Color color{0x80, 0x80, 0x80};
vector<uint8_t> grouping; // LED groups for LED-Strip vector<uint8_t> counts;
vector<uint8_t> times; // Step times for effects vector<uint8_t> times;
}; };
struct MasterRequest {}; struct StartCommand {
struct SlaveResponse {}; uint8_t pos; // 0 for none / Valid indexes 1 .. 6
static fos::Queue<MasterRequest> commandQ(2); };
static fos::Queue<SlaveResponse> responseQ(2); static fos::Queue<StartCommand> commandQ(2);
DeviceState State; DeviceState State;
static const char* TAG = "Light"; static const char* TAG = "Light";
static const char* VERSION = "V 0.7.0";
unique_ptr<Cli> pShell; unique_ptr<Cli> pShell;
void onCommand(string name, Cli::CArgs args) { void onCommand(string name, Cli::CArgs args) {
ESP_LOGI(TAG, "Invoking: %s", name.c_str()); ESP_LOGI(TAG, "Invoking: %s", name.c_str());
} }
void startUpdate(Cli::CArgs args) {
ESP_LOGI(TAG, "Invoking Update");
if (args.size() != 1) {
pShell->writeLine("Need URL to application");
return;
}
// @ToDo: Start Update here
}
void getConfig(Cli::CArgs args) {
if (args.size() != 1) {
pShell->writeLine("Needs string key for query");
return;
}
auto key = args[0];
auto& store = NvsApi::getInstance();
auto val = store.getValue(key);
pShell->writeLine(key + ": " + val + "");
}
void setConfig(Cli::CArgs args) {
if (args.size() != 2) {
pShell->writeLine("Needs string key and value");
return;
}
auto key = args[0];
auto val = args[1];
auto& store = NvsApi::getInstance();
pShell->writeLine(string{"Storing value = '"} + val + "'");
store.setValue(key, val);
}
void setLogServerConfig(Cli::CArgs args) { void setLogServerConfig(Cli::CArgs args) {
ESP_LOGI(TAG, "on showLogServerConfig:"); ESP_LOGI(TAG, "on showLogServerConfig:");
auto& store = NvsApi::getInstance(); auto& store = NvsApi::getInstance();
@@ -66,7 +94,7 @@ void setLogServerConfig(Cli::CArgs args) {
void testLights(Cli::CArgs args) { void testLights(Cli::CArgs args) {
ESP_LOGI(TAG, "on testLights:"); ESP_LOGI(TAG, "on testLights:");
commandQ.enqueue(make_unique<MasterRequest>()); commandQ.enqueue(make_unique<StartCommand>());
} }
void showProcessValues(Cli::CArgs args) { void showProcessValues(Cli::CArgs args) {
@@ -75,7 +103,7 @@ void showProcessValues(Cli::CArgs args) {
sprintf(buff, "%02x,%02x,%02x", State.color.getRed(), State.color.getGreen(), State.color.getBlue()); sprintf(buff, "%02x,%02x,%02x", State.color.getRed(), State.color.getGreen(), State.color.getBlue());
std::stringstream ssC; std::stringstream ssC;
for (auto& c : State.grouping) { for (auto& c : State.counts) {
ssC << string{c} << ","; ssC << string{c} << ",";
} }
std::stringstream ssT; std::stringstream ssT;
@@ -87,6 +115,24 @@ void showProcessValues(Cli::CArgs args) {
pShell->writeLine(string{" Switch-Times: "} + ssT.str()); pShell->writeLine(string{" Switch-Times: "} + ssT.str());
} }
void setSyslogLevel(Cli::CArgs args) {
if (args.size() != 1) {
pShell->writeLine("Needs SyslogLevel Warning = 4, Notice = 5, Informational = 6, Debug = 7");
return;
}
try {
auto lvl = stoi(args[0]);
if (lvl >= (int)Syslog::Severity::Warning && lvl <= (int)Syslog::Severity::Debug) {
Syslog::setSeverity((Syslog::Severity)lvl);
} else {
pShell->writeLine("New level was not accepted");
}
} catch (const exception& e) {
ESP_LOGI(TAG, "Failed to parse %s", args[0].c_str());
}
}
/** /**
* @brief Telnet socket via TCP/IP * @brief Telnet socket via TCP/IP
* *
@@ -100,14 +146,22 @@ static void telnetSocketTask(int addrFamily) {
telnet.run( telnet.run(
[](TcpSession& session) { [](TcpSession& session) {
pShell = make_unique<Cli>(session, [](string n, Cli::CArgs a) { onCommand(n, a); }); pShell = make_unique<Cli>(session, [](string n, Cli::CArgs a) { onCommand(n, a); });
pShell->addBinding(
{"update", "Start OTA-Update-Process",
[](Cli::CArgs a) { startUpdate(a); }});
pShell->addBinding( pShell->addBinding(
{"setLogserver", "Set log server config ip", {"setLogserver", "Set log server config ip",
[](Cli::CArgs a) { setLogServerConfig(a); }}); [](Cli::CArgs a) { setLogServerConfig(a); }});
pShell->addBinding(
{"setLogLevel", "Set severity log server",
[](Cli::CArgs a) { setSyslogLevel(a); }});
Syslog::registerCli(*pShell); pShell->addBinding(
auto& store = NvsApi::getInstance(); {"getcfg", "Get configuration value for key",
store.registerCli(*pShell); [](Cli::CArgs a) { getConfig(a); }});
SystemFunctions::registerCli(*pShell); pShell->addBinding(
{"setcfg", "Set configuration value by key and value",
[](Cli::CArgs a) { setConfig(a); }});
pShell->addBinding( pShell->addBinding(
{"setDyn", "set dynamics of movement (velocity,accelerations) as floats", {"setDyn", "set dynamics of movement (velocity,accelerations) as floats",
@@ -130,62 +184,29 @@ void startShow(string data) {
ESP_LOGI(TAG, "StartShuffle command %s", data.c_str()); ESP_LOGI(TAG, "StartShuffle command %s", data.c_str());
try { try {
Syslog::logv(Syslog::Severity::Informational, "got Shuffle-Command"); Syslog::logv(Syslog::Severity::Informational, "got Shuffle-Command");
commandQ.enqueue(make_unique<MasterRequest>()); commandQ.enqueue(make_unique<StartCommand>());
} catch (const exception& e) { } catch (const exception& e) {
ESP_LOGE(TAG, "Error to process data %s, with ex: %s", data.c_str(), e.what()); ESP_LOGE(TAG, "Error to process data %s, with ex: %s", data.c_str(), e.what());
} }
} }
constexpr uint32_t DmxUniverse = 0;
constexpr int DmxChannelCount = 9;
array<uint8_t, 512> LedData;
static void UniverseCallback(const uint8_t* data, const uint16_t size) {
ESP_LOGD(TAG, "Got DMX");
ESP_LOG_BUFFER_HEXDUMP("DMX", data, size, ESP_LOG_DEBUG);
Syslog::logv(Syslog::Severity::Debug, "Got DMX: r%0x g%0x b%0x i%0x ...",
/* RGB*/ data[0], data[1], data[2], /*Intens*/ data[3]);
// DMX 512
for (int i = 0; i < LedData.size() / 4;) {
LedData[i] = data[i];
i++;
LedData[i] = data[i];
i++;
LedData[i] = data[i];
i++;
LedData[i] = data[i];
i++;
}
}
/** /**
* @brief DMX-Socket for ArtNet TCP/IP * @brief DMX-Socket for ArtNet TCP/IP
* *
* @details Tested with [Q Light Controller+](https://www.qlcplus.org/) * @details Tested with [Q Light Controller+](https://www.qlcplus.org/)
* @param args ignored task argument * @param args ignored task argument
*/ */
static void dmxSocketTask(int addrFamily) { static void dmxSocketSenderTask(UdpSocket& socket) {
ESP_LOGI(TAG, "Starting ArtNet task");
constexpr uint16_t ArtNetPort = arx::artnet::DEFAULT_PORT;
IpAdr address = addrFamily == AF_INET ? IpAdr(INADDR_ANY, ArtNetPort) : IpAdr(ArtNetPort);
try { try {
while (true) { ArtnetSender artnet(socket);
UdpSocket socket(address); array<uint8_t, 16> data;
socket.bindTo();
ArtnetReceiver artnet(socket);
artnet.subscribe(DmxUniverse, UniverseCallback);
artnet.parse();
// parse artnet as long socket is active, then restart socket
while (socket.isActive()) { while (socket.isActive()) {
ESP_LOGD(TAG, "Waiting for data"); data[0]++;
artnet.parse(); artnet.send("", 0, data.data(), data.size());
} fos::Task::delayMs(500);
} }
} catch (const std::exception& e) { } catch (const exception& e) {
ESP_LOGE("UDP", "%s", e.what()); ESP_LOGE("UDP", "%s", e.what());
} }
} }
@@ -264,19 +285,31 @@ const Macro macDemoFlicker = {
void LightingTask() { void LightingTask() {
ESP_LOGI(TAG, "Start Lighting"); ESP_LOGI(TAG, "Start Lighting");
auto const& colorSource = State.color; auto const& colorSource = State.color;
array<Effect::EffectProcessor, 2> processors{
Effect::EffectProcessor(8),
Effect::EffectProcessor(8)};
processors[0].setEffect(Effect::macDark, &colorSource, 0);
processors[1].setEffect(Effect::macDark, &colorSource, 0);
AddressableLeRtz strip(LedPin, AddressableLeRtz::Type::Rgb, LedData.size() / 4); const array<Effect::Macro, 2> PictoEffects{
OutputPort relay(RelayPin); Effect::macDemoPulse,
relay.write(true); Effect::macDemoPulse};
while (true) { while (true) {
for (int i = 0; i < (LedData.size() / 4); i++) { // ESP_LOGI(TAG, "Current color set r%i g%i b%i ",
auto* c = &LedData[i * 4]; // State.color.getRed(), State.color.getGreen(), State.color.getBlue());
Color C{c[0], c[1], c[2], c[3]}; // processors[0].setEffect(Effect::macDark, &colorSource, 0);
strip.set(C, i, 1); // auto idx = 0;
} // Syslog::logv(Syslog::Severity::Informational, "Running show");
strip.send(); // takes ca. 5ms to send all the data // processors[idx].setEffect(PictoEffects[idx], &colorSource, 0);
fos::Task::delayMs(20);
// for (size_t i = 0; i < processors.size(); i++) {
// auto col = processors[i].tick();
// }
// fos::Task::delayMs(40);
static int cnt{};
fos::Task::delayMs(1000);
printf("running %d\n", cnt++);
} }
} }
@@ -285,7 +318,7 @@ struct LocalSpitObj {
string groupName; string groupName;
string name; string name;
}; };
map<string, MasterRequest> ProvidedSpitActions; map<string, StartCommand> ProvidedSpitActions;
map<string, string> ExpectedObjects; map<string, string> ExpectedObjects;
void onServerEvent(SClient::ServerEvent event, const SadDetectedServer& p_DetectedServer) { void onServerEvent(SClient::ServerEvent event, const SadDetectedServer& p_DetectedServer) {
@@ -481,8 +514,8 @@ void onPlaySpitType(string p_PlayerID, string spitTypeId, bool p_PlayerIsRunning
if (p_Started == true) { if (p_Started == true) {
auto command = ProvidedSpitActions[spitTypeId]; auto command = ProvidedSpitActions[spitTypeId];
// ESP_LOGI(TAG, "Player: %s is running: %s Object", p_PlayerID.data(), spitTypeId.c_str()); // ESP_LOGI(TAG, "Player: %s is running: %s Object", p_PlayerID.data(), spitTypeId.c_str());
commandQ.enqueue(make_unique<MasterRequest>()); commandQ.enqueue(make_unique<StartCommand>());
Syslog::logv(Syslog::Severity::Informational, "Got SPIT command"); Syslog::logv(Syslog::Severity::Informational, "Got SPIT command for move ot : r%d", command.pos);
} }
} }
@@ -498,83 +531,90 @@ void onPlayRemoteObjectStatus(const SType& sType, const SObject& sObject, uint64
ESP_EARLY_LOGD(TAG, "eventPlayRemoteObjectStatus RemoteSPITType: %s RemoteSPITObject: %s Position: %lld Value: %d", sType.Name.get().data(), sObject.Name.get().data(), frameInsideObject, value); ESP_EARLY_LOGD(TAG, "eventPlayRemoteObjectStatus RemoteSPITType: %s RemoteSPITObject: %s Position: %lld Value: %d", sType.Name.get().data(), sObject.Name.get().data(), frameInsideObject, value);
} }
void SpitClientApp() { // void SpitClientApp() {
ESP_LOGI(TAG, "Starting SPIT task"); // ESP_LOGI(TAG, "Starting SPIT task");
auto& provided = SpitTypes.Provided; // auto& provided = SpitTypes.Provided;
auto& expected = SpitTypes.Expected; // auto& expected = SpitTypes.Expected;
// vector<LocalSpitObj> ProvidedObj;
// ProvidedSpitActions[provided.startShuffle] = MoveCommand{.type = MoveType::Shuffle, .pos = 0};
// ProvidedObj.push_back(LocalSpitObj{.iD = provided.startShuffle, .groupName = provided.group, .name = provided.startShuffle});
// ExpectedObjects[expected.changingPos] = "";
// for (size_t i = 0; i < 6; i++) {
// ProvidedSpitActions[provided.moveToX[i]] = MoveCommand{.type = MoveType::StepTo, .pos = (uint8_t)(i + 1)};
// ProvidedObj.push_back(LocalSpitObj{.iD = provided.moveToX[i], .groupName = provided.group, .name = provided.moveToX[i]});
// ExpectedObjects[expected.inPosX[i]] = "";
// }
vector<LocalSpitObj> ProvidedObj; // auto ip = spit::Socket::getAdaptersInfo();
ProvidedSpitActions[provided.group] = MasterRequest{}; // spit::Socket socket(ip);
ProvidedObj.push_back(LocalSpitObj{.iD = provided.group, .groupName = provided.group, .name = provided.group}); // SClient spitClient(ClientName, ProjectName, socket,
ProvidedSpitActions[provided.startShow] = MasterRequest{}; // {
ProvidedObj.push_back(LocalSpitObj{.iD = provided.startShow, .groupName = provided.group, .name = provided.startShow}); // .onServerEvent = onServerEvent,
// .onConnectionStatus = onConnectionStatus,
// .onProjectUpdate = onProjectUpdate,
// .onSpitType = onSpitType,
// .onSpitObject = onSpitObject,
// .onPlay = onPlay,
// .onPlaySpitType = onPlaySpitType,
// .onPlayRemoteObjectStatus = onPlayRemoteObjectStatus,
// .onCheckSpitTypeVeto = onCheckSpitTypeVeto,
// .onCheckSpitObjectVeto = onCheckSpitObjectVeto,
// });
ExpectedObjects[expected.showDone] = ""; // for (auto& obj : ProvidedObj) {
// SType* ptrSPITType1Fix = spitClient.createTypeFixed(obj.iD, obj.groupName, obj.name, 0, 0);
// spitClient.setActionType(ptrSPITType1Fix->getID(), true); // should be executed whenever a SPITObject with this SPITType is played
// }
// spitClient.clientProjectLoaded();
// spitClient.startServerAutoDetect();
auto ip = spit::Socket::getAdaptersInfo(); // spitProjectFinish.take();
spit::Socket socket(ip); // string serverProjectID = spitClient.getServerProjectID();
SClient spitClient(ClientName, ProjectName, socket, // string serverProjectName = spitClient.getClientProjectName();
{ // int serverFramesPerSecond = spitClient.getServerFramesPerSecond(); // set when the server reports his project, see eventProjectReport
.onServerEvent = onServerEvent, // ESP_LOGI(TAG, "eventProjectReport ID: %s Name: %s FramesPerSecond: %d", serverProjectID.data(), serverProjectName.data(), serverFramesPerSecond);
.onConnectionStatus = onConnectionStatus,
.onProjectUpdate = onProjectUpdate,
.onSpitType = onSpitType,
.onSpitObject = onSpitObject,
.onPlay = onPlay,
.onPlaySpitType = onPlaySpitType,
.onPlayRemoteObjectStatus = onPlayRemoteObjectStatus,
.onCheckSpitTypeVeto = onCheckSpitTypeVeto,
.onCheckSpitObjectVeto = onCheckSpitObjectVeto,
});
for (auto& obj : ProvidedObj) { // for (auto&& obj : ExpectedObjects) {
SType* ptrSPITType1Fix = spitClient.createTypeFixed(obj.iD, obj.groupName, obj.name, 0, 0); // if (obj.second == "") {
spitClient.setActionType(ptrSPITType1Fix->getID(), true); // should be executed whenever a SPITObject with this SPITType is played // ESP_LOGE(TAG, "No matching Remote ID for %s", obj.first.c_str());
} // }
spitClient.clientProjectLoaded(); // }
spitClient.startServerAutoDetect();
spitProjectFinish.take(); // while (true) {
string serverProjectID = spitClient.getServerProjectID(); // auto res = responseQueue.dequeue();
string serverProjectName = spitClient.getClientProjectName(); // if (res->type == ResponseType::StartMoving) {
int serverFramesPerSecond = spitClient.getServerFramesPerSecond(); // set when the server reports his project, see eventProjectReport // spitClient.sendRemoteObject(ExpectedObjects[expected.changingPos]);
ESP_LOGI(TAG, "eventProjectReport ID: %s Name: %s FramesPerSecond: %d", serverProjectID.data(), serverProjectName.data(), serverFramesPerSecond); // } else if (res->type == ResponseType::StepAt) {
// spitClient.sendRemoteObject(ExpectedObjects[expected.inPosX[res->pos - 1]]);
// }
// }
// }
for (auto&& obj : ExpectedObjects) { // void MqttThread() {
if (obj.second == "") { // ESP_LOGI(TAG, "Starting MQTT task");
ESP_LOGE(TAG, "No matching Remote ID for %s", obj.first.c_str());
}
}
while (true) { // auto& store = NvsApi::getInstance();
auto res = responseQ.dequeue(); // auto broker = store.getValue(ConfigKeys.mqttBroker);
spitClient.sendRemoteObject(ExpectedObjects[expected.showDone]); // 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, [](string d) { startShuffle(d); });
// client.start();
// }
void MqttThread() { // while (true) {
ESP_LOGI(TAG, "Starting MQTT task"); // auto res = responseQueue.dequeue();
// if (res->type == ResponseType::StartMoving) {
auto& store = NvsApi::getInstance(); // client.publish(MqttTopics.showDone, "");
auto broker = store.getValue(ConfigKeys.mqttBroker); // } else if (res->type == ResponseType::StepAt) {
if (broker != "") { // client.publish(MqttTopics.inPosition, to_string(res->pos));
ESP_LOGI(TAG, "Initializing MQTT"); // }
auto prefix = store.getValue(ConfigKeys.mqttPrefix); // }
auto& client = MqttClient::init(broker, prefix); // }
if (!client.isRunning()) { // }
client.addSubscription(MqttTopics.startShow, [](string d) {
commandQ.enqueue(make_unique<MasterRequest>());
});
client.start();
}
while (true) {
auto res = responseQ.dequeue();
client.publish(MqttTopics.showDone, "");
}
}
}
void app_main(void) { void app_main(void) {
initialize_ethernet(); initialize_ethernet();
@@ -584,11 +624,11 @@ void app_main(void) {
etherActive.take(); etherActive.take();
ESP_LOGI(TAG, "Start net services"); ESP_LOGI(TAG, "Start net services");
static int ipVersion = AF_INET; // static int ipVersion = AF_INET;
static fos::TaskT<int> telnetSocket(telnetSocketTask, ipVersion, "tcpServer", 4096); // static fos::TaskT<int> telnetSocket(telnetSocketTask, ipVersion, "tcpServer", 4096);
// static fos::Task spit(SpitClientApp, "SpitClient"); // static fos::Task spit(SpitClientApp, "SpitClient");
// static fos::Task mqtt(MqttThread, "MqttEndpoint"); // // static fos::Task mqtt(MqttThread, "MqttEndpoint");
static fos::TaskT<int> dmxNode(dmxSocketTask, ipVersion, "dmxNode", 4096); // // static Task otaUpdate(SystemFunctions::OtaTaskEntry, "otaTask", 8192);
auto& store = NvsApi::getInstance(); auto& store = NvsApi::getInstance();
auto logger = store.getValue(ConfigKeys.syslogDest); auto logger = store.getValue(ConfigKeys.syslogDest);
@@ -598,12 +638,9 @@ void app_main(void) {
ESP_LOGI(TAG, "Configuration"); ESP_LOGI(TAG, "Configuration");
ESP_LOGI(TAG, "%s: %s", ConfigKeys.syslogDest, store.getValue(ConfigKeys.syslogDest).c_str()); ESP_LOGI(TAG, "%s: %s", ConfigKeys.syslogDest, store.getValue(ConfigKeys.syslogDest).c_str());
// ESP_LOGI(TAG, "%s: %s", ConfigKeys.mqttBroker, store.getValue(ConfigKeys.mqttBroker).c_str()); ESP_LOGI(TAG, "%s: %s", ConfigKeys.mqttBroker, store.getValue(ConfigKeys.mqttBroker).c_str());
// ESP_LOGI(TAG, "%s: %s", ConfigKeys.mqttPrefix, store.getValue(ConfigKeys.mqttPrefix).c_str()); ESP_LOGI(TAG, "%s: %s", ConfigKeys.mqttPrefix, store.getValue(ConfigKeys.mqttPrefix).c_str());
// ESP_LOGI(TAG, "%s: %s", ConfigKeys.spitServer, store.getValue(ConfigKeys.spitServer).c_str()); ESP_LOGI(TAG, "%s: %s", ConfigKeys.spitServer, store.getValue(ConfigKeys.spitServer).c_str());
ESP_LOGI(TAG, "## Starting : %s : %s",
CONFIG_LWIP_LOCAL_HOSTNAME, VERSION);
while (true) { while (true) {
fos::Task::delayMs(5000); fos::Task::delayMs(5000);
-8
View File
@@ -1,8 +0,0 @@
# Name, Type, SubType, Offset, Size, Flags
# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
nvs, data, nvs, , 0x4000,
otadata, data, ota, , 0x2000,
phy_init, data, phy, , 0x1000,
ota_0, app, ota_0, , 1536K,
ota_1, app, ota_1, , 1536K,
spiffs, data, spiffs, , 936K,
1 # Name, Type, SubType, Offset, Size, Flags
2 # Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
3 nvs, data, nvs, , 0x4000,
4 otadata, data, ota, , 0x2000,
5 phy_init, data, phy, , 0x1000,
6 ota_0, app, ota_0, , 1536K,
7 ota_1, app, ota_1, , 1536K,
8 spiffs, data, spiffs, , 936K,
+28 -8
View File
@@ -373,14 +373,14 @@ CONFIG_ESPTOOLPY_FLASHFREQ_40M=y
# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set # CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set
CONFIG_ESPTOOLPY_FLASHFREQ="40m" CONFIG_ESPTOOLPY_FLASHFREQ="40m"
# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set
# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y # CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set
# CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set
# CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set
# CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set
# CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set
# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set
CONFIG_ESPTOOLPY_FLASHSIZE="4MB" CONFIG_ESPTOOLPY_FLASHSIZE="2MB"
# CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE is not set # CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE is not set
CONFIG_ESPTOOLPY_BEFORE_RESET=y CONFIG_ESPTOOLPY_BEFORE_RESET=y
# CONFIG_ESPTOOLPY_BEFORE_NORESET is not set # CONFIG_ESPTOOLPY_BEFORE_NORESET is not set
@@ -394,17 +394,26 @@ CONFIG_ESPTOOLPY_MONITOR_BAUD=115200
# #
# Partition Table # Partition Table
# #
# CONFIG_PARTITION_TABLE_SINGLE_APP is not set CONFIG_PARTITION_TABLE_SINGLE_APP=y
# CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE is not set # CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE is not set
# CONFIG_PARTITION_TABLE_TWO_OTA is not set # CONFIG_PARTITION_TABLE_TWO_OTA is not set
# CONFIG_PARTITION_TABLE_TWO_OTA_LARGE is not set # CONFIG_PARTITION_TABLE_TWO_OTA_LARGE is not set
CONFIG_PARTITION_TABLE_CUSTOM=y # CONFIG_PARTITION_TABLE_CUSTOM is not set
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv" CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp.csv"
CONFIG_PARTITION_TABLE_OFFSET=0x8000 CONFIG_PARTITION_TABLE_OFFSET=0x8000
CONFIG_PARTITION_TABLE_MD5=y CONFIG_PARTITION_TABLE_MD5=y
# end of Partition Table # end of Partition Table
#
# Example Configuration
#
CONFIG_DEVICE_WIFI_SSID="eth2ap"
CONFIG_DEVICE_WIFI_PASSWORD="12345678"
CONFIG_DEVICE_WIFI_CHANNEL=1
CONFIG_DEVICE_MAX_STA_CONN=4
# end of Example Configuration
# #
# Example Ethernet Configuration # Example Ethernet Configuration
# #
@@ -829,7 +838,7 @@ CONFIG_HTTPD_SERVER_EVENT_POST_TIMEOUT=2000
# ESP HTTPS OTA # ESP HTTPS OTA
# #
# CONFIG_ESP_HTTPS_OTA_DECRYPT_CB is not set # CONFIG_ESP_HTTPS_OTA_DECRYPT_CB is not set
CONFIG_ESP_HTTPS_OTA_ALLOW_HTTP=y # CONFIG_ESP_HTTPS_OTA_ALLOW_HTTP is not set
CONFIG_ESP_HTTPS_OTA_EVENT_POST_TIMEOUT=2000 CONFIG_ESP_HTTPS_OTA_EVENT_POST_TIMEOUT=2000
# end of ESP HTTPS OTA # end of ESP HTTPS OTA
@@ -2018,6 +2027,17 @@ CONFIG_LITTLEFS_MALLOC_STRATEGY_DEFAULT=y
# CONFIG_LITTLEFS_MALLOC_STRATEGY_INTERNAL is not set # CONFIG_LITTLEFS_MALLOC_STRATEGY_INTERNAL is not set
CONFIG_LITTLEFS_ASSERTS=y CONFIG_LITTLEFS_ASSERTS=y
# end of LittleFS # end of LittleFS
#
# Telnet Server
#
CONFIG_TELNET_SERVER_DEFAULT_PORT=23
CONFIG_TELNET_SERVER_MAX_CONNECTIONS=5
CONFIG_TELNET_SERVER_STACK_SIZE=4096
CONFIG_TELNET_SERVER_TASK_PRIORITY=24
CONFIG_TELNET_SERVER_TASK_CORE=0
CONFIG_TELNET_SERVER_REDIRECT_LOGS=0
# end of Telnet Server
# end of Component config # end of Component config
# CONFIG_IDF_EXPERIMENTAL_FEATURES is not set # CONFIG_IDF_EXPERIMENTAL_FEATURES is not set
@@ -2068,7 +2088,7 @@ CONFIG_POST_EVENTS_FROM_ISR=y
CONFIG_POST_EVENTS_FROM_IRAM_ISR=y CONFIG_POST_EVENTS_FROM_IRAM_ISR=y
CONFIG_GDBSTUB_SUPPORT_TASKS=y CONFIG_GDBSTUB_SUPPORT_TASKS=y
CONFIG_GDBSTUB_MAX_TASKS=32 CONFIG_GDBSTUB_MAX_TASKS=32
CONFIG_OTA_ALLOW_HTTP=y # CONFIG_OTA_ALLOW_HTTP is not set
# CONFIG_TWO_UNIVERSAL_MAC_ADDRESS is not set # CONFIG_TWO_UNIVERSAL_MAC_ADDRESS is not set
CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS=y CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS=y
CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS=4 CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS=4
-12
View File
@@ -23,15 +23,3 @@ CONFIG_ETH_MDC_GPIO=23
CONFIG_ETH_MDIO_GPIO=33 CONFIG_ETH_MDIO_GPIO=33
CONFIG_ETH_PHY_RST_GPIO=5 CONFIG_ETH_PHY_RST_GPIO=5
CONFIG_ETH_PHY_ADDR=1 CONFIG_ETH_PHY_ADDR=1
#
# OTA over plain HTTP (no TLS server in use yet)
#
CONFIG_ESP_HTTPS_OTA_ALLOW_HTTP=y
# Enable filesystem
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
+2
View File
@@ -2,6 +2,8 @@
* @file watchMain.cpp * @file watchMain.cpp
* @author Gustice * @author Gustice
* @brief ChaosWatch Application * @brief ChaosWatch Application
*
* @copyright Copyright (c) 2024
*/ */
/// NOTE: Create IDF shell navigate to directory ("test/integration") /// NOTE: Create IDF shell navigate to directory ("test/integration")
+2
View File
@@ -2,6 +2,8 @@
* @file unitTest.cpp * @file unitTest.cpp
* @author Gustice * @author Gustice
* @brief Unit/Integration-Test frame for hardware bound components * @brief Unit/Integration-Test frame for hardware bound components
*
* @copyright Copyright (c) 2024
*/ */
#include "unity.h" #include "unity.h"