This commit is contained in:
2026-10-24 23:23:20 +02:00
parent d45c14f714
commit b29432cdba
6 changed files with 16 additions and 106 deletions
+14 -39
View File
@@ -15,7 +15,7 @@
// },
//
// LED-Strips: 14 - 22 - 30
// >> update http://172.16.16.10:8000/LeoLightShow.bin
// >> update http://172.16.16.10:8000/LeoLightShow.bin
#include "config.hpp"
#include "lighsMain.hpp"
@@ -33,16 +33,12 @@ void app_main(void);
}
struct DeviceState {
Color color{0x80, 0x80, 0x80};
vector<uint8_t> counts;
vector<uint8_t> times;
};
struct MasterRequest {
uint8_t pos; // 0 for none / Valid indexes 1 .. 6
};
struct SlaveResponse {
uint8_t pos; // 0 for none / Valid indexes 1 .. 6
Color color{0x80, 0x80, 0x40}; // Color for the chosen bottle
vector<uint8_t> grouping; // LED groups for LED-Strip
vector<uint8_t> times; // Step times for effects
};
struct MasterRequest {};
struct SlaveResponse {};
static fos::Queue<MasterRequest> commandQ(2);
static fos::Queue<SlaveResponse> responseQ(2);
@@ -55,7 +51,6 @@ void onCommand(string name, Cli::CArgs args) {
ESP_LOGI(TAG, "Invoking: %s", name.c_str());
}
void setLogServerConfig(Cli::CArgs args) {
ESP_LOGI(TAG, "on showLogServerConfig:");
auto& store = NvsApi::getInstance();
@@ -80,7 +75,7 @@ void showProcessValues(Cli::CArgs args) {
sprintf(buff, "%02x,%02x,%02x", State.color.getRed(), State.color.getGreen(), State.color.getBlue());
std::stringstream ssC;
for (auto& c : State.counts) {
for (auto& c : State.grouping) {
ssC << string{c} << ",";
}
std::stringstream ssT;
@@ -92,24 +87,6 @@ void showProcessValues(Cli::CArgs args) {
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
*
@@ -126,10 +103,8 @@ static void telnetSocketTask(int addrFamily) {
pShell->addBinding(
{"setLogserver", "Set log server config ip",
[](Cli::CArgs a) { setLogServerConfig(a); }});
pShell->addBinding(
{"setLogLevel", "Set severity log server",
[](Cli::CArgs a) { setSyslogLevel(a); }});
Syslog::registerCli(*pShell);
auto& store = NvsApi::getInstance();
store.registerCli(*pShell);
SystemFunctions::registerCli(*pShell);
@@ -290,7 +265,7 @@ void LightingTask() {
ESP_LOGI(TAG, "Start Lighting");
auto const& colorSource = State.color;
AddressableLeRtz strip(LedPin, AddressableLeRtz::Type::Rgb, LedData.size()/4);
AddressableLeRtz strip(LedPin, AddressableLeRtz::Type::Rgb, LedData.size() / 4);
OutputPort relay(RelayPin);
relay.write(true);
@@ -507,7 +482,7 @@ void onPlaySpitType(string p_PlayerID, string spitTypeId, bool p_PlayerIsRunning
auto command = ProvidedSpitActions[spitTypeId];
// ESP_LOGI(TAG, "Player: %s is running: %s Object", p_PlayerID.data(), spitTypeId.c_str());
commandQ.enqueue(make_unique<MasterRequest>());
Syslog::logv(Syslog::Severity::Informational, "Got SPIT command for move ot : r%d", command.pos);
Syslog::logv(Syslog::Severity::Informational, "Got SPIT command");
}
}
@@ -530,9 +505,9 @@ void SpitClientApp() {
auto& expected = SpitTypes.Expected;
vector<LocalSpitObj> ProvidedObj;
ProvidedSpitActions[provided.group] = MasterRequest{.pos = 0};
ProvidedSpitActions[provided.group] = MasterRequest{};
ProvidedObj.push_back(LocalSpitObj{.iD = provided.group, .groupName = provided.group, .name = provided.group});
ProvidedSpitActions[provided.startShow] = MasterRequest{.pos = 0};
ProvidedSpitActions[provided.startShow] = MasterRequest{};
ProvidedObj.push_back(LocalSpitObj{.iD = provided.startShow, .groupName = provided.group, .name = provided.startShow});
ExpectedObjects[expected.showDone] = "";
@@ -628,7 +603,7 @@ void app_main(void) {
// ESP_LOGI(TAG, "%s: %s", ConfigKeys.spitServer, store.getValue(ConfigKeys.spitServer).c_str());
ESP_LOGI(TAG, "## Starting : %s : %s",
CONFIG_LWIP_LOCAL_HOSTNAME, VERSION);
CONFIG_LWIP_LOCAL_HOSTNAME, VERSION);
while (true) {
fos::Task::delayMs(5000);