Skip to content

Commit

Permalink
Merge pull request #16 from spitzlbergerj/development
Browse files Browse the repository at this point in the history
Install Skript erweitert, Lage, Taster korrigiert, Platine V6 hinzugefügt, kleine Korrekturen
  • Loading branch information
spitzlbergerj authored Mar 15, 2024
2 parents 1cfb5ca + 213110e commit 4b30795
Show file tree
Hide file tree
Showing 24 changed files with 1,236 additions and 133 deletions.
8 changes: 8 additions & 0 deletions analogSignals/gassensorCheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@ def main():
cplib.writeCaravanPiConfigItem("caravanpiDefaults/gassensorAlarmActive", 1)
gassensorAlarmActive = True

cplib.handle_sensor_values(
args.screen, # Anzeige am Bildschirm?
"gassensor", # sensor_name = Datenbankname
"mq-2", # sensor_id = Filename und Spalte in der Datenbank
["parts_per_million", "alarm"], # Liste Spaltennamen
( channel.value, gasDetected) # Tupel Sensorwerte
)

time.sleep(delayAlarm if gasDetected else delay)

except Exception as e:
Expand Down
1 change: 0 additions & 1 deletion analogSignals/v12Check.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ def main():
cplib.writeCaravanPiConfigItem(f"caravanpiDefaults/{v12xmlItemAlarm}", 1)
v12CheckAlarmActive = True

cplib = CaravanPiFiles()
cplib.handle_sensor_values(
args.screen, # Anzeige am Bildschirm?
"Spannung", # sensor_name = Datenbankname
Expand Down
8 changes: 8 additions & 0 deletions analogSignals/v230Check.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ def main():
cplib.writeCaravanPiConfigItem("caravanpiDefaults/v230CheckAlarmActive", 1)
v230CheckAlarmActive = True

cplib.handle_sensor_values(
args.screen, # Anzeige am Bildschirm?
"Spannung", # sensor_name = Datenbankname
"230v", # sensor_id = Filename und Spalte in der Datenbank
["spannung"], # Liste Spaltennamen
(230.0 if not v230DropDetected else 0.0 ) # Tupel Sensorwerte
)

time.sleep(delayAlarm if v230DropDetected else delay)

except Exception as e:
Expand Down
Binary file added circuit-board/V6/CaravanPi_V6_Board.pdf
Binary file not shown.
Binary file not shown.
Binary file added circuit-board/V6/CaravanPi_V6_Schaltplan.pdf
Binary file not shown.
Binary file added circuit-board/V6/CaravanPi_V6_mit_Masse.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added circuit-board/V6/CaravanPi_V6_oben.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
23 changes: 23 additions & 0 deletions circuit-board/V6/JLCPCB/CaravanPi_V6_front_bom.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"Qty";"Value";"Device";"Package";"Parts";"Description";"MF";"MPN";"OC_FARNELL";"OC_NEWARK";"POPULARITY";"SPICEPREFIX";
"2";"";"233-403";"233-403";"KüHLSCHR., RADAR";"WAGO Cage Clamp";"";"233-403";"1601354";"28K9076";"0";"";
"4";"";"233-404";"233-404";"ADX345, HX711-EXTERN, KLIMA1, KLIMA2";"WAGO Cage Clamp";"";"233-404";"1601355";"28K9077";"0";"";
"1";"";"233-406";"233-406";"GASFLASCHEN";"WAGO Cage Clamp";"";"233-406";"1601357";"28K9079";"0";"";
"2";"";"233-408";"233-408";"FRISCHWASSERTANK, FÄKALIENTANK";"WAGO Cage Clamp";"";"233-408";"1601358";"28K9080";"0";"";
"7";"";"233-504";"233-504";"LED-HL, LED-HR, LED-VD, LED-VL, LED-VR, LED-ZL, LED-ZR";"WAGO Cage Clamp";"Wago Corporation";"0233-0504";"1777098";"79K2050";"0";"";
"1";"";"233-516";"233-516";"GPIO_EXTENSION";"WAGO Cage Clamp";"Wago Corporation";"0233-0516";"1777103";"79K2056";"0";"";
"1";"";"CON10";"CON10";"I2C-EXTENSION";"CONNECTOR";"";"";"unknown";"unknown";"3";"";
"1";"";"CON16";"CON16";"GEHÄUSEDECKEL";"CONNECTOR";"";"";"unknown";"unknown";"0";"";
"1";"";"HX711A";"HX711";"HX711";"";"";"";"";"";"";"";
"1";"";"PINHD-2X20";"2X20";"RASPBERRY-PI";"PIN HEADER";"";"";"";"";"";"";
"5";"100n";"C-EUC1206";"C1206";"C3, C4, C5, C6, C7";"CAPACITOR, European symbol";"";"";"";"";"54";"C";
"2";"10k";"R-EU_M1206";"M1206";"R34, R35";"RESISTOR, European symbol";"";"";"";"";"17";"R";
"7";"150";"R-EU_M1206";"M1206";"R3, R6, R9, R12, R17, R20, R23";"RESISTOR, European symbol";"";"";"";"";"17";"R";
"4";"330";"R-EU_M1206";"M1206";"R30, R31, R32, R33";"RESISTOR, European symbol";"";"";"";"";"17";"R";
"5";"47k";"R-EU_M1206";"M1206";"R25, R26, R27, R28, R29";"RESISTOR, European symbol";"";"";"";"";"17";"R";
"1";"47u";"CPOL-EUSMCC";"SMC_C";"C1";"POLARIZED CAPACITOR, European symbol";"";"";"";"";"";"";
"3";"4k7";"R-EU_M1206";"M1206";"R13, R14, R24";"RESISTOR, European symbol";"";"";"";"";"17";"R";
"14";"82";"R-EU_M1206";"M1206";"R1, R2, R4, R5, R7, R8, R10, R11, R15, R16, R18, R19, R21, R22";"RESISTOR, European symbol";"";"";"";"";"17";"R";
"1";"CARAVAN_PI_LOGO";"CARAVAN_PI_LOGO";"CARAVAN_PI_LOGO";"U$1";"Caravan_PI_logo";"";"";"";"";"";"";
"2";"MCP23017SO";"MCP23017SO";"SO28W";"MCP23017_1, MCP23017_2";"http://ww1.microchip.com/downloads/en/DeviceDoc/21952a.pdf";"";"";"";"";"";"";
"2";"P82B715PN,112SOIC8";"P82B715PN,112SOIC8";"SOP127P600X175-8N";"I2EXT1, I2EXT2";"I2C-bus extender";"";"";"";"";"";"";
"1";"S1D";"DIODE-DO214AC";"DO214AC";"D1";"DIODE";"";"";"";"";"14";"";
46 changes: 46 additions & 0 deletions circuit-board/V6/JLCPCB/CaravanPi_V6_front_cpl.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
C1, 97.79, 48.26, 180.00, 47u, SMC_C
C3, 64.77, 44.45, 180.00, 100n, C1206
C4, 77.47, 44.45, 180.00, 100n, C1206
C5, 40.64, 48.26, 90.00, 100n, C1206
C6, 91.44, 48.26, 270.00, 100n, C1206
C7, 45.72, 31.75, 270.00, 100n, C1206
D1, 99.06, 26.67, 0.00, S1D, DO214AC
I2EXT1, 64.77, 39.37, 0.00, P82B715PN,112SOIC8, SOP127P600X175-8N
I2EXT2, 77.47, 39.37, 0.00, P82B715PN,112SOIC8, SOP127P600X175-8N
MCP23017_1, 27.30, 52.07, 0.00, MCP23017SO, SO28W
MCP23017_2, 78.11, 52.07, 0.00, MCP23017SO, SO28W
R1, 92.71, 62.23, 90.00, 82, M1206
R10, 62.23, 62.23, 90.00, 82, M1206
R11, 54.61, 62.23, 90.00, 82, M1206
R12, 50.80, 62.23, 90.00, 150, M1206
R13, 99.06, 19.05, 180.00, 4k7, M1206
R14, 99.06, 22.86, 180.00, 4k7, M1206
R15, 46.99, 62.23, 90.00, 82, M1206
R16, 43.18, 62.23, 90.00, 82, M1206
R17, 39.37, 62.23, 90.00, 150, M1206
R18, 35.56, 62.23, 90.00, 82, M1206
R19, 31.75, 62.23, 90.00, 82, M1206
R2, 88.90, 62.23, 90.00, 82, M1206
R20, 27.94, 62.23, 90.00, 150, M1206
R21, 24.13, 62.23, 90.00, 82, M1206
R22, 20.32, 62.23, 90.00, 82, M1206
R23, 16.51, 62.23, 90.00, 150, M1206
R24, 99.06, 30.48, 180.00, 4k7, M1206
R25, 99.06, 38.10, 0.00, 47k, M1206
R26, 99.06, 59.69, 0.00, 47k, M1206
R27, 99.06, 34.29, 0.00, 47k, M1206
R28, 99.06, 55.88, 0.00, 47k, M1206
R29, 99.06, 52.07, 0.00, 47k, M1206
R3, 85.09, 62.23, 90.00, 150, M1206
R30, 77.47, 17.78, 270.00, 330, M1206
R31, 81.28, 17.78, 270.00, 330, M1206
R32, 64.77, 17.78, 270.00, 330, M1206
R33, 68.58, 17.78, 270.00, 330, M1206
R34, 91.44, 54.61, 90.00, 10k, M1206
R35, 40.64, 54.61, 90.00, 10k, M1206
R4, 81.28, 62.23, 90.00, 82, M1206
R5, 77.47, 62.23, 90.00, 82, M1206
R6, 73.66, 62.23, 90.00, 150, M1206
R7, 69.85, 62.23, 90.00, 82, M1206
R8, 66.04, 62.23, 90.00, 82, M1206
R9, 58.42, 62.23, 90.00, 150, M1206
Empty file added circuit-board/V6/README.md
Empty file.
4 changes: 2 additions & 2 deletions defaults/caravanpiConfig.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
<v12CarCheckAlarmResume>1</v12CarCheckAlarmResume>
</caravanpiDefaults>
<adjustmentPosition>
<adjustX>-0.0392267</adjustX>
<adjustY>1.5298374</adjustY>
<adjustX>-0.2353596</adjustX>
<adjustY>1.3729310000000001</adjustY>
<adjustZ>8.9044382</adjustZ>
<toleranceX>0.2</toleranceX>
<toleranceY>0.2</toleranceY>
Expand Down
8 changes: 2 additions & 6 deletions html-flask/checks_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,6 @@ def check_crontab_pi():

# Titel für jede Prüfung
titles = {
'flask_main': 'flask wird gestartet',
'temp2file_regular': 'Temperatursensoren auslesen',
'position2file_regular': 'Lagesensor auslesen',
'tactileSwitches_boot': 'Taster aktivieren',
Expand All @@ -610,9 +609,8 @@ def check_crontab_pi():

checks_passed = []

checks = ['flask_main', 'temp2file_regular', 'position2file_regular', 'tactileSwitches_boot', 'systemstat2file_boot', 'RTCSerial_boot', 'scales', 'tanks', 'climates']
checks = ['temp2file_regular', 'position2file_regular', 'tactileSwitches_boot', 'systemstat2file_boot', 'RTCSerial_boot', 'scales', 'tanks', 'climates']
check_functions = {
'flask_main': lambda: is_script_present(crontab_lines, 'flask-main.py'),
'temp2file_regular': lambda: is_script_present(crontab_lines, 'temp2file.py'),
'position2file_regular': lambda: is_script_present(crontab_lines, 'position2file.py'),
'tactileSwitches_boot': lambda: is_script_present(crontab_lines, 'tactileSwitches.py'),
Expand Down Expand Up @@ -663,16 +661,14 @@ def check_crontab_root():
# Titel für jede Prüfung
titles = {
'backup': 'Backup Skript starten',
'pir': 'Bewegunssensor aktivieren',
'logrotate': 'Logdateien rotieren',
}

checks_passed = []

checks = ['backup', 'pir', 'logrotate']
checks = ['backup', 'logrotate']
check_functions = {
'backup': lambda: is_script_present(crontab_lines, 'backup.sh'),
'pir': lambda: is_script_present(crontab_lines, 'pir.py'),
'logrotate': lambda: is_script_present(crontab_lines, 'logrotate'),
}

Expand Down
5 changes: 1 addition & 4 deletions html-flask/templates/footer.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<div class="footer">
<p>Weitere Infos zum Projekt CaravanPi finden Sie unter</p>
<p><a href="https://www.caravanpi.de" target="_blank">CaravanPi-Website</a>
<p><a href="https://github.com/spitzlbergerj/CaravanPi" target="_blank">CaravanPi Programmcode (github)</a></p>
<p><a href="https://raw.githubusercontent.com/spitzlbergerj/CaravanPi/master/circuit-board/V5/CaravanPi_Platine_V5_Schaltplan_Page_1.png" target="_blank">CaravanPi Platine V5 Schaltplan (github)</a></br></br></p>

<p><a href="https://www.caravanpi.de" target="_blank">CaravanPi-Website</a>, GitHub <a href="https://github.com/spitzlbergerj/CaravanPi" target="_blank">Programmcode</a>, <a href="https://github.com/spitzlbergerj/CaravanPi/wiki" target="_blank">Wiki</a>, <a href="https://raw.githubusercontent.com/spitzlbergerj/CaravanPi/master/circuit-board/V5/CaravanPi_Platine_V5_Schaltplan_Page_1.png" target="_blank">Schaltplan V5</a></p>
<p>&copy; CaravanPi - Josef Spitzlberger - 2024</p>
</div>
83 changes: 78 additions & 5 deletions install_CaravanPi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ fi

BOOT_CONFIG_FILE_OLD="/boot/config.txt"
BOOT_CONFIG_FILE_NEW="/boot/firmware/config.txt"
BOOT_CONFIG_FILE="$BOOT_CONFIG_FILE_NEW"

STD_HOSTNAME="CaravanPi"

Expand Down Expand Up @@ -362,6 +363,32 @@ config_protocolls() {
run_cmd "echo \"# CaravanPi Temperatur Sensoren über 1-Wire auf GPIO Pin 18\" | sudo tee -a \"$BOOT_CONFIG_FILE\" > /dev/null"
run_cmd "echo \"dtoverlay=w1-gpio,gpiopin=18\" | sudo tee -a \"$BOOT_CONFIG_FILE\" > /dev/null"
fi

# Prüfung wegen Bildschirm Treiber, so dass vcgencmd den Bildschirm ein- und ausschalten kann
#!/bin/bash

SEARCH_STRING="dtoverlay=vc4-kms-v3d"
CHECK_STRING="# dtoverlay=vc4-kms-v3d"
REPLACE_STRING="# changed for CaravanPi so that vcgencmd could turn off monitor\n# dtoverlay=vc4-kms-v3d\ndtoverlay=vc4-fkms-v3d"

# Überprüfen, ob die Datei existiert
echo "Prüfung und ggf. Wechsel des Bildschirm Treibers"
if [ -f "$BOOT_CONFIG_FILE" ]; then
# Überprüfen, ob die Zeile vorhanden ist
if grep -q "$CHECK_STRING" "$CONFIG_FILE"; then
echo "Die Änderung wurde bereits vorgenommen. Keine weiteren Aktionen erforderlich."
elifif grep -q "$SEARCH_STRING" "$BOOT_CONFIG_FILE"; then
# Ersetze die Zeile durch den gewünschten Text
# Benutze sed, um eine Sicherungskopie vor dem Ersetzen zu erstellen (.bak)
sed -i.bak "/$SEARCH_STRING/c\\$REPLACE_STRING" "$BOOT_CONFIG_FILE"
echo "Die Konfiguration wurde erfolgreich geändert."
else
echo "Der Bildschirm Treiber $SEARCH_STRING wurde nicht gefunden. Keine Änderungen vorgenommen."
fi
else
echo "Die Datei $BOOT_CONFIG_FILE existiert nicht. Überspringe."
fi

}

# Funktion zum Klonen/Aktualisieren des CaravanPi Repositories
Expand Down Expand Up @@ -667,11 +694,6 @@ install_libraries() {

run_cmd "pip3 install netaddr --break-system-packages"

run_cmd "pip3 install board --break-system-packages"
run_cmd "pip3 install busio --break-system-packages"

run_cmd "pip3 install digitalio --break-system-packages"

run_cmd "pip3 install crontab --break-system-packages"

# outdated
Expand Down Expand Up @@ -818,6 +840,44 @@ install_backup() {

}

# Installation Python Module
install_stromPi3() {
echo "Python Modul für StromPi3 installieren ...."
run_cmd "sudo apt-get install python3-serial"

echo "Boot Config um Serielle Kommunikation erweitern ...."

# Zu appendende Zeilen
LINES_TO_APPEND=(
"dtoverlay=miniuart-bt"
"enable_uart=1"
"core_freq=250"
)

# Überprüfe, ob die Datei existiert
if [ -f "$BOOT_CONFIG_FILE" ]; then
for line in "${LINES_TO_APPEND[@]}"; do
# Überprüfe, ob die Zeile bereits existiert
if ! grep -qF -- "$line" "$BOOT_CONFIG_FILE"; then
# Füge die Zeile hinzu, wenn sie nicht existiert
run_cmd "echo \"$line\" | sudo tee -a \"$BOOT_CONFIG_FILE\" > /dev/null"
fi
done
echo "Konfiguration wurde erfolgreich aktualisiert."
fi

echo "Serielle Konfigurationen in raspi-config"
if [ "$SIMULATE" = false ]; then
sudo sed -i 's/console=serial0,115200 //g' /boot/cmdline.txt
sudo bash -c "echo 'enable_uart=1' >> /boot/config.txt"
sudo bash -c "echo 'dtoverlay=miniuart-bt' >> /boot/config.txt"
sudo apt-get install minicom
sudo minicom -D /dev/serial0 -b 38400
fi

}


next_steps() {

note "Abschluss und nächste Schritte" "cyan"
Expand Down Expand Up @@ -886,6 +946,7 @@ echo
echo "Die einzelnen Kommados geben sehr viele Daten aus. Um die Übersicht zu erhöhen folge ich diesen Farb-Codex:"
echo_colored "cyan" "CYAN für Kapitelüberschriften und Abfragen an Sie"
echo_colored "magenta" "MAGENTA für wichtige Informationen"
echo_colored "red" "ROT für die Kommandos, die dieses Skript ausführt"
echo
echo

Expand Down Expand Up @@ -1245,6 +1306,18 @@ python3 $CARAVANPI_DIR/installation/caravanPiLibInit.py

cd "$HOME"

# --------------------------------------------------------------------------
# StromPi3 installieren
# --------------------------------------------------------------------------
note "StromPi3 installieren" "cyan"

read_colored "cyan" "Möchten Sie die Software für den StromPi3 installieren? (j/N): " answer
if [[ "$answer" =~ ^[Jj]$ ]]; then
install_stromPi3
fi

cd "$HOME"

# --------------------------------------------------------------------------
# nächste Schritte
# --------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 4b30795

Please sign in to comment.