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