update
Took 1 hour 16 minutes
This commit is contained in:
parent
b1fe4e0953
commit
9c63516ab8
13
ToDo.md
13
ToDo.md
@ -8,4 +8,15 @@
|
|||||||
- [ ] Container option "Auto tare" hinzufügen
|
- [ ] Container option "Auto tare" hinzufügen
|
||||||
- Heißt, sobald ein Inhalt in einen Container eingestellt wird und das Volumen angegeben ist, werden die Sensoren auf den aktuellen Füllstand als 100% gesetzt
|
- Heißt, sobald ein Inhalt in einen Container eingestellt wird und das Volumen angegeben ist, werden die Sensoren auf den aktuellen Füllstand als 100% gesetzt
|
||||||
- [ ] Nach Speichern des Setups und bei Einmessen auf Schließen, Setup verlassen
|
- [ ] Nach Speichern des Setups und bei Einmessen auf Schließen, Setup verlassen
|
||||||
- [ ]
|
|
||||||
|
|
||||||
|
------
|
||||||
|
# New
|
||||||
|
|
||||||
|
- Gesamtvolumen des Containers komplett entfernen
|
||||||
|
- Bei Behälter aktualisieren wird das Volumen des neu zu stellendes Behälters eingestellt, welches dann als 100% interpretiert wird
|
||||||
|
- Im Setup kommt ein neues Feature, tarieren von Wägezelle (also der 0-Wert der Wägezelle) nach Speicherung, anstatt aktueller 2-Wege-Tarierung
|
||||||
|
- Ultraschallsensor wird entfernt
|
||||||
|
- Wenn Sensorik für Behälter vorhanden ist, nutze Wägezelle des Containers und messe anhand dessen Inhaltsmenge
|
||||||
|
- 1G=1ML
|
||||||
|
- Bei Einstellung neues Inhalts wird das Gewicht als ml übersetzt, danach wird Gewicht-Eingestellte Millitier gerechnet, das Ergebnis ist das Gewicht des Behälters
|
@ -5,6 +5,9 @@ if [ "$EUID" -ne 0 ]; then
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Creating user if not exists"
|
||||||
|
adduser itender || true
|
||||||
|
|
||||||
echo "Updating indexes"
|
echo "Updating indexes"
|
||||||
apt update
|
apt update
|
||||||
|
|
||||||
@ -42,13 +45,13 @@ ufw allow 3000/tcp
|
|||||||
ufw allow 3015/tcp
|
ufw allow 3015/tcp
|
||||||
ufw --force enable
|
ufw --force enable
|
||||||
|
|
||||||
echo "Updating indexes and installing mongodb and yarn..."
|
echo "Updating indexes..."
|
||||||
# Final update
|
# Final update
|
||||||
apt update
|
apt update
|
||||||
|
echo "Installing mongodb and yarn..."
|
||||||
apt install nodejs yarn mongodb-org -y
|
apt install nodejs yarn mongodb-org -y
|
||||||
apt upgrade -y
|
apt upgrade -y
|
||||||
|
|
||||||
|
|
||||||
echo "Installing autostart..."
|
echo "Installing autostart..."
|
||||||
# Autostart
|
# Autostart
|
||||||
cat <<EOT >/etc/xdg/openbox/autostart
|
cat <<EOT >/etc/xdg/openbox/autostart
|
||||||
@ -64,8 +67,12 @@ sed -i 's/"exited_cleanly":false/"exited_cleanly":true/; s/"exit_type":"[^"]\+"/
|
|||||||
/usr/bin/chromium-browser --disable-infobars --kiosk --incognito --disable-pinch --overscroll-history-navigation=0 "http://127.0.0.1:3000/" &
|
/usr/bin/chromium-browser --disable-infobars --kiosk --incognito --disable-pinch --overscroll-history-navigation=0 "http://127.0.0.1:3000/" &
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
|
echo "Setting to console autologin..."
|
||||||
|
raspi-config nonint do_boot_behaviour B2
|
||||||
|
|
||||||
echo "Installing bashrc"
|
echo "Installing bashrc"
|
||||||
echo "[[ -z \$DISPLAY && \$XDG_VTNR -eq 1 ]] && startx -- -nocursor" >> /home/itender/.bashrc
|
echo "clear" >>/home/itender/.bashrc
|
||||||
|
echo "[[ -z \$DISPLAY && \$XDG_VTNR -eq 1 ]] && startx -- -nocursor >/dev/null 2>&1" >>/home/itender/.bashrc
|
||||||
#
|
#
|
||||||
#echo "Installing start.sh"
|
#echo "Installing start.sh"
|
||||||
#cat <<EOT >>/home/itender/start.sh
|
#cat <<EOT >>/home/itender/start.sh
|
||||||
@ -101,14 +108,14 @@ yarn run compile
|
|||||||
|
|
||||||
echo "Updating Cron..."
|
echo "Updating Cron..."
|
||||||
# Add line to cron
|
# Add line to cron
|
||||||
echo "@reboot sudo chmod g+rw /dev/tty?" > /tmp/currentCron
|
echo "@reboot sudo chmod g+rw /dev/tty?" >/tmp/currentCron
|
||||||
#echo "@reboot cd /home/itender/itender/ && /usr/bin/yarn run start &" >> /tmp/currentCron
|
#echo "@reboot cd /home/itender/itender/ && /usr/bin/yarn run start &" >> /tmp/currentCron
|
||||||
chown itender:itender /tmp/currentCron
|
chown itender:itender /tmp/currentCron
|
||||||
#install new cron file
|
#install new cron file
|
||||||
sudo -u itender crontab /tmp/currentCron
|
sudo -u itender crontab /tmp/currentCron
|
||||||
|
|
||||||
echo "Installing systemd service..."
|
echo "Installing systemd service..."
|
||||||
cat <<EOT > /etc/systemd/system/itender.service
|
cat <<EOT >/etc/systemd/system/itender.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=iTender App
|
Description=iTender App
|
||||||
After=network.target mongod.service
|
After=network.target mongod.service
|
||||||
@ -132,7 +139,6 @@ WantedBy=multi-user.target
|
|||||||
EOT
|
EOT
|
||||||
#sh -c "git pull --quiet || true"
|
#sh -c "git pull --quiet || true"
|
||||||
|
|
||||||
|
|
||||||
echo "Activating systemctl daemons..."
|
echo "Activating systemctl daemons..."
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl enable mongod
|
systemctl enable mongod
|
||||||
@ -156,6 +162,21 @@ fi
|
|||||||
if ! grep -w "disable_splash=1" /boot/config.txt; then
|
if ! grep -w "disable_splash=1" /boot/config.txt; then
|
||||||
echo "disable_splash=1" >>/boot/config.txt
|
echo "disable_splash=1" >>/boot/config.txt
|
||||||
fi
|
fi
|
||||||
|
if ! grep -w "vc4-fkms-v3d" /boot/config.txt; then
|
||||||
|
sed -i 's/dtoverlay=vc4-kms-v3d/dtoverlay=vc4-fkms-v3d,disable-bt/' /boot/config.txt
|
||||||
|
fi
|
||||||
|
if ! grep -w "boot_delay=0" /boot/config.txt; then
|
||||||
|
echo "boot_delay=0" >>/boot/config.txt
|
||||||
|
fi
|
||||||
|
if ! grep -w "over_voltage=6" /boot/config.txt; then
|
||||||
|
echo "over_voltage=6" >>/boot/config.txt
|
||||||
|
fi
|
||||||
|
if ! grep -w "arm_freq=1300" /boot/config.txt; then
|
||||||
|
echo "arm_freq=1300" >>/boot/config.txt
|
||||||
|
fi
|
||||||
|
if ! grep -w "gpu_freq=700" /boot/config.txt; then
|
||||||
|
echo "gpu_freq=700" >>/boot/config.txt
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Setting no-logo..."
|
echo "Setting no-logo..."
|
||||||
systemctl disable getty@tty1.service
|
systemctl disable getty@tty1.service
|
||||||
@ -167,9 +188,17 @@ if ! grep -w "logo.nologo" /boot/cmdline.txt; then
|
|||||||
#cp /tmp/cmdline.txt /boot/cmdline.txt
|
#cp /tmp/cmdline.txt /boot/cmdline.txt
|
||||||
sed -i "1 s|$| vt.global_cursor_default=0|" /boot/cmdline.txt
|
sed -i "1 s|$| vt.global_cursor_default=0|" /boot/cmdline.txt
|
||||||
sed -i '1 i\avoid_warnings=1' /boot/config.txt
|
sed -i '1 i\avoid_warnings=1' /boot/config.txt
|
||||||
|
sed -i 's/console=tty0/console=tty3/' /boot/cmdline.txt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "iTender 2022
|
||||||
|
Programmed by Tobias Hopp" >/etc/motd
|
||||||
|
|
||||||
|
echo "[Service]
|
||||||
|
ExecStart=/usr/sbin/dhcpcd -q" >/etc/systemd/system/dhcpcd.service.d/wait.conf
|
||||||
|
|
||||||
chown itender:itender -R /home/itender/
|
chown itender:itender -R /home/itender/
|
||||||
adduser itender gpio
|
adduser itender gpio
|
||||||
|
adduser itender sudo
|
||||||
|
|
||||||
reboot now
|
reboot now
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import GPIO from "rpi-gpio";
|
import GPIO from "rpi-gpio";
|
||||||
import Container from "./database/Container";
|
import Container from "./database/Container";
|
||||||
import debug from "debug";
|
import debug from "debug";
|
||||||
|
|
||||||
const log = debug("itender:gpio");
|
const log = debug("itender:gpio");
|
||||||
|
|
||||||
// Package is raspi-gpio in raspberrypi
|
// Package is raspi-gpio in raspberrypi
|
||||||
|
@ -78,7 +78,7 @@ export class WebSocketHandler {
|
|||||||
|
|
||||||
let stats = {
|
let stats = {
|
||||||
"drinks_finished": (await Job.countDocuments({successful: true})),
|
"drinks_finished": (await Job.countDocuments({successful: true})),
|
||||||
"drink_most": ( counts.length == 0 ) ? "Keiner" : counts[0].name,
|
"drink_most": (counts.length == 0) ? "Keiner" : counts[0].name,
|
||||||
"count_ingredients": (await Ingredient.countDocuments()),
|
"count_ingredients": (await Ingredient.countDocuments()),
|
||||||
"count_cocktails": (await Drink.countDocuments())
|
"count_cocktails": (await Drink.countDocuments())
|
||||||
};
|
};
|
||||||
|
@ -41,7 +41,6 @@ router.ws('/', async (ws, req, next) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
switch (msg.event) {
|
switch (msg.event) {
|
||||||
case WebSocketEvent.TARE: {
|
case WebSocketEvent.TARE: {
|
||||||
if (msg.data["state"] == true) {
|
if (msg.data["state"] == true) {
|
||||||
@ -52,14 +51,14 @@ router.ws('/', async (ws, req, next) => {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WebSocketEvent.CONTAINERS: {
|
case WebSocketEvent.CONTAINERS: {
|
||||||
let data = msg.data as { pumpPin: number; sensorType: SensorType; sensor1: number; sensor2: number; volume: number; }[];
|
let data = msg.data as { pumpPin: number; sensorType: SensorType; sensor1: number; sensor2: number; }[];
|
||||||
await Container.deleteMany({});
|
await Container.deleteMany({}); // V2: Remove this and check every container based on id if changes occurs
|
||||||
|
|
||||||
let i = 0;
|
let i = 0;
|
||||||
for (let c of data) {
|
for (let c of data) {
|
||||||
let container = new Container();
|
let container = new Container();
|
||||||
container.slot = i;
|
container.slot = i;
|
||||||
container.volume = c.volume;
|
//container.volume = c.volume; // V2: Removed
|
||||||
container.pumpPin = c.pumpPin;
|
container.pumpPin = c.pumpPin;
|
||||||
container.sensorType = c.sensorType;
|
container.sensorType = c.sensorType;
|
||||||
container.sensorPin1 = c.sensor1;
|
container.sensorPin1 = c.sensor1;
|
||||||
@ -83,6 +82,7 @@ router.ws('/', async (ws, req, next) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
container.filled = parseInt(msg.data["filled"]);
|
container.filled = parseInt(msg.data["filled"]);
|
||||||
|
container.volume = parseInt(msg.data["filled"]); // V2: Volume is now being updated after change of ingredient
|
||||||
container.content = ingredient;
|
container.content = ingredient;
|
||||||
|
|
||||||
await container.save();
|
await container.save();
|
||||||
@ -94,7 +94,7 @@ router.ws('/', async (ws, req, next) => {
|
|||||||
case WebSocketEvent.CONFIG: {
|
case WebSocketEvent.CONFIG: {
|
||||||
// ToDo
|
// ToDo
|
||||||
console.log("New Settings:", msg.data);
|
console.log("New Settings:", msg.data);
|
||||||
// Danach setup modus us
|
// Danach setup modus aus
|
||||||
for (const [key, value] of Object.entries(msg.data)) {
|
for (const [key, value] of Object.entries(msg.data)) {
|
||||||
Settings.set(key, value);
|
Settings.set(key, value);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user