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
|
||||
- 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
|
||||
- [ ]
|
||||
|
||||
|
||||
------
|
||||
# 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
|
||||
fi
|
||||
|
||||
echo "Creating user if not exists"
|
||||
adduser itender || true
|
||||
|
||||
echo "Updating indexes"
|
||||
apt update
|
||||
|
||||
@ -42,13 +45,13 @@ ufw allow 3000/tcp
|
||||
ufw allow 3015/tcp
|
||||
ufw --force enable
|
||||
|
||||
echo "Updating indexes and installing mongodb and yarn..."
|
||||
echo "Updating indexes..."
|
||||
# Final update
|
||||
apt update
|
||||
echo "Installing mongodb and yarn..."
|
||||
apt install nodejs yarn mongodb-org -y
|
||||
apt upgrade -y
|
||||
|
||||
|
||||
echo "Installing autostart..."
|
||||
# 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/" &
|
||||
EOT
|
||||
|
||||
echo "Setting to console autologin..."
|
||||
raspi-config nonint do_boot_behaviour B2
|
||||
|
||||
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"
|
||||
#cat <<EOT >>/home/itender/start.sh
|
||||
@ -132,7 +139,6 @@ WantedBy=multi-user.target
|
||||
EOT
|
||||
#sh -c "git pull --quiet || true"
|
||||
|
||||
|
||||
echo "Activating systemctl daemons..."
|
||||
systemctl daemon-reload
|
||||
systemctl enable mongod
|
||||
@ -156,6 +162,21 @@ fi
|
||||
if ! grep -w "disable_splash=1" /boot/config.txt; then
|
||||
echo "disable_splash=1" >>/boot/config.txt
|
||||
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..."
|
||||
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
|
||||
sed -i "1 s|$| vt.global_cursor_default=0|" /boot/cmdline.txt
|
||||
sed -i '1 i\avoid_warnings=1' /boot/config.txt
|
||||
sed -i 's/console=tty0/console=tty3/' /boot/cmdline.txt
|
||||
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/
|
||||
adduser itender gpio
|
||||
adduser itender sudo
|
||||
|
||||
reboot now
|
||||
|
@ -1,6 +1,7 @@
|
||||
import GPIO from "rpi-gpio";
|
||||
import Container from "./database/Container";
|
||||
import debug from "debug";
|
||||
|
||||
const log = debug("itender:gpio");
|
||||
|
||||
// Package is raspi-gpio in raspberrypi
|
||||
|
@ -41,7 +41,6 @@ router.ws('/', async (ws, req, next) => {
|
||||
}
|
||||
|
||||
|
||||
|
||||
switch (msg.event) {
|
||||
case WebSocketEvent.TARE: {
|
||||
if (msg.data["state"] == true) {
|
||||
@ -52,14 +51,14 @@ router.ws('/', async (ws, req, next) => {
|
||||
break;
|
||||
}
|
||||
case WebSocketEvent.CONTAINERS: {
|
||||
let data = msg.data as { pumpPin: number; sensorType: SensorType; sensor1: number; sensor2: number; volume: number; }[];
|
||||
await Container.deleteMany({});
|
||||
let data = msg.data as { pumpPin: number; sensorType: SensorType; sensor1: number; sensor2: number; }[];
|
||||
await Container.deleteMany({}); // V2: Remove this and check every container based on id if changes occurs
|
||||
|
||||
let i = 0;
|
||||
for (let c of data) {
|
||||
let container = new Container();
|
||||
container.slot = i;
|
||||
container.volume = c.volume;
|
||||
//container.volume = c.volume; // V2: Removed
|
||||
container.pumpPin = c.pumpPin;
|
||||
container.sensorType = c.sensorType;
|
||||
container.sensorPin1 = c.sensor1;
|
||||
@ -83,6 +82,7 @@ router.ws('/', async (ws, req, next) => {
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
await container.save();
|
||||
@ -94,7 +94,7 @@ router.ws('/', async (ws, req, next) => {
|
||||
case WebSocketEvent.CONFIG: {
|
||||
// ToDo
|
||||
console.log("New Settings:", msg.data);
|
||||
// Danach setup modus us
|
||||
// Danach setup modus aus
|
||||
for (const [key, value] of Object.entries(msg.data)) {
|
||||
Settings.set(key, value);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user