new featres
This commit is contained in:
1 parent
92423c52de
commit
f93a8aaabd
6 files changed
+75
-13
No files matched your search
@@ -1,2 +1,3 @@
|
|||||||
build/
|
build/
|
||||||
.cache/
|
.cache/
|
||||||
|
deploy/
|
||||||
@@ -21,3 +21,12 @@ amixer sset Master 10%-
|
|||||||
|
|
||||||
|
|
||||||
apt install -y libpaho-mqttpp-dev
|
apt install -y libpaho-mqttpp-dev
|
||||||
|
|
||||||
|
## Reboot
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo crontab -e
|
||||||
|
```
|
||||||
|
```txt
|
||||||
|
0 3 * * * /sbin/reboot
|
||||||
|
```
|
||||||
@@ -2,16 +2,9 @@ build:
|
|||||||
cmake -B build -S .
|
cmake -B build -S .
|
||||||
cmake --build build --target SwordMain
|
cmake --build build --target SwordMain
|
||||||
|
|
||||||
run:
|
pack_sword:
|
||||||
build/src/SwordMain promo ./assets -b "mqtts://nerdyssey.de:8883" -t "outdoor/king-arthur/sword/" -p "awesomeexodusoutdooradventures" -u "exodususer" -l "log.nerdyssey.de" -k "uYpJC6WyZAbFK2MUgwNH"
|
@mkdir -p deploy/sword
|
||||||
|
@cp build/src/sword/SwordMain deploy/sword
|
||||||
test:
|
@cp -r assets deploy/sword
|
||||||
build/src/SwordMain promo ./assets -b "mqtts://nerdyssey.de:8883" -t "staging/outdoor/king-arthur/sword/" -p "awesomeexodusoutdooradventures" -u "exodususer" -l "log.nerdyssey.de" -k "uYpJC6WyZAbFK2MUgwNH"
|
@cd deploy && tar -czvf swordMain.tar.gz sword
|
||||||
|
@echo .. extract with "tar -xzvf"
|
||||||
# deploy:
|
|
||||||
# cp build/src/SwordMain .
|
|
||||||
# tar -cfz swordMain.tar.gz assets SwordMain
|
|
||||||
# curl --user your_username:your_access_token --upload-file ./swordMain.tar.gz git.nerdyssey.de/exodus/burg-stett-king-arth-sword/0.5.0/swordMain.tar.gz
|
|
||||||
|
|
||||||
# download:
|
|
||||||
# curl -O https://gitea.example.com/api/packages/my_organization/generic/my-app/1.0.0/my-app-linux-amd64.tar.gz
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
/home/gustice/workspace/swordStation/SwordMain \
|
||||||
|
promo /home/gustice/workspace/swordStation/assets \
|
||||||
|
-b mqtts://nerdyssey.de:8883 \
|
||||||
|
-t outdoor/king-arthur/sword/ \
|
||||||
|
-p awesomeexodusoutdooradventures \
|
||||||
|
-u exodususer \
|
||||||
|
-l "log.nerdyssey.de" \
|
||||||
|
-k "uYpJC6WyZAbFK2MUgwNH"
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
/home/gustice/workspace/swordStation/SwordMain \
|
||||||
|
test /home/gustice/workspace/swordStation/assets \
|
||||||
|
-b mqtts://nerdyssey.de:8883 \
|
||||||
|
-t staging/outdoor/king-arthur/sword/ \
|
||||||
|
-p awesomeexodusoutdooradventures \
|
||||||
|
-u exodususer \
|
||||||
|
-l "log.nerdyssey.de" \
|
||||||
|
-k "uYpJC6WyZAbFK2MUgwNH"
|
||||||
@@ -118,7 +118,14 @@ int main(int argc, char* argv[]) {
|
|||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum MuteState {
|
||||||
|
WaitForUnmute,
|
||||||
|
WaitForMute,
|
||||||
|
WaitForNextDay,
|
||||||
|
};
|
||||||
void processPromo(MqttChannel& mqtt, SeqLogger& log) {
|
void processPromo(MqttChannel& mqtt, SeqLogger& log) {
|
||||||
|
auto muterS = MuteState::WaitForUnmute;
|
||||||
|
Tick tmu(1min);
|
||||||
Tick tn(1s);
|
Tick tn(1s);
|
||||||
Tick tsf(30min);
|
Tick tsf(30min);
|
||||||
auto& serCmds = mqtt.getSerCommands();
|
auto& serCmds = mqtt.getSerCommands();
|
||||||
@@ -143,6 +150,40 @@ void processPromo(MqttChannel& mqtt, SeqLogger& log) {
|
|||||||
if (tn.tick()) {
|
if (tn.tick()) {
|
||||||
mqtt.sendStatusMessage(Mode);
|
mqtt.sendStatusMessage(Mode);
|
||||||
}
|
}
|
||||||
|
if (tmu.tick()) {
|
||||||
|
auto now = std::chrono::system_clock::now();
|
||||||
|
std::time_t time = std::chrono::system_clock::to_time_t(now);
|
||||||
|
std::tm* lTime = std::localtime(&time);
|
||||||
|
int current_hour = lTime->tm_hour;
|
||||||
|
|
||||||
|
switch (muterS) {
|
||||||
|
case WaitForUnmute:
|
||||||
|
if (current_hour >= 9) {
|
||||||
|
fmt::println("[09:00 Threshold] Unmute");
|
||||||
|
log.sendEvent("Unmute", "Time for unmute");
|
||||||
|
IoStat->Mute = false;
|
||||||
|
muterS = WaitForMute;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WaitForMute:
|
||||||
|
if (current_hour >= 21) {
|
||||||
|
fmt::println("[21:00 Threshold] Mute");
|
||||||
|
log.sendEvent("Mute", "Time for mute");
|
||||||
|
IoStat->Mute = true;
|
||||||
|
muterS = WaitForNextDay;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WaitForNextDay:
|
||||||
|
if (current_hour < 1) {
|
||||||
|
fmt::println("[01:00 Threshold] new day");
|
||||||
|
muterS = WaitForUnmute;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user