Added lcd function thing for arduino-lcd-writer

This commit is contained in:
j4nk 2023-12-19 03:40:38 -05:00
parent 527329e8d8
commit ff70c79b68
1 changed files with 25 additions and 0 deletions

25
scripts/send_temps_to_lcd.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/sh
# Temperature printing function
print_temp(){
temp="CPU: $(sensors | grep 'Tccd1' | awk '{print substr($2, 2)}')?GPU: $(sensors | grep "edge" | awk '{print substr($2, 2)}')"
echo "$temp"
}
# The device should be set with the LCD_SERIAL_DEVICE environment variable
# Sets the baud to 115200 which is what the arduino is set to communicate on
#stty -F $LCD_SERIAL_DEVICE 115200
# make reset to set up all the options for serial correctly
cd $LCD_PROGRAM_LOCATION && make reset && cd ~
# Leave a process running in the background that keeps the serial connection alive
tail -f $LCD_SERIAL_DEVICE > /dev/null &
sleep 1
# Update the temps once per second
while true
do
echo "CPU: $(sensors | grep 'Tccd1' | awk '{print substr($2, 2)}')?GPU: $(sensors | grep "edge" | awk '{print substr($2, 2)}')" | awk '{ gsub("\xc2\xb0", "\xdf", $0); print }' > $LCD_SERIAL_DEVICE
sleep 5
done