From 10812db5350fc46e1b8cc5fa9792bf6a6ef42054 Mon Sep 17 00:00:00 2001 From: a Date: Tue, 19 Dec 2023 03:40:38 -0500 Subject: [PATCH] Added lcd function thing for arduino-lcd-writer --- scripts/send_temps_to_lcd.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 scripts/send_temps_to_lcd.sh diff --git a/scripts/send_temps_to_lcd.sh b/scripts/send_temps_to_lcd.sh new file mode 100755 index 0000000..8dcd39b --- /dev/null +++ b/scripts/send_temps_to_lcd.sh @@ -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