#!/bin/sh
## Retrieve Temperatures
##
##	Read the different temperature sensor at the end of the test
##
##	Future Improvements:
##	- There are no communications between the FPGA and CPU, the test s
##	should read automatically temperature.
##
##
## Authors: 
##	- Benoit Rat (Seven Solutions, www.sevensols.com)
##
## GNU Lesser General Public License Usage
## This file may be used under the terms of the GNU Lesser
## General Public License version 2.1 as published by the Free Software
## Foundation and appearing in the file LICENSE.LGPL included in the
## packaging of this file.  Please review the following information to
## ensure the GNU Lesser General Public License version 2.1 requirements
## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
#######################################################################################################

printf "======: $0\n"
. 000-functions.sh

alarm;
${APTS_SWITCH_DIR}/bin/shw_tool --fan 40

user_echoasking "y/n" "Do you see temperature message on UART?" "UART temp"
ret0=-$?
if [ $ans == "y" ]; then
	user_echoasking "num" "Number of iteration. " "num-iter"
	user_echoasking "num" "System Monitor Temp. " "temp-sysmon"
	user_echoasking "num" "System Monitor Temp Max. " "temp-sysmon"
	user_echoasking "num" "Temp. Sensor Power PLLs & LDOs:" "tmp-plls"
	user_echoasking "num" "Temp. Sensor Power Supply Left:" "tmp-powsupL"
	user_echoasking "num" "Temp. Sensor Power Supply Right:" "tmp-powsupR"
	user_echoasking "num" "Temp. Below FPGA:" "temp-fpga"
fi

echo "Starting WhiteRabbit Switch: !!! Look at the SFP LEDs !!!"
sleep 5

##Start White Rabbit
/wr/sbin/startup-mb.sh

user_echoasking "y/n" "Do you have WhiteRabbit sweeping LEDs?" "wrs-led"
ret1=-$?

user_echoasking "y/n" "Do you hear WhiteRabbit PWM you might wait 10s?" "wrs-pwm"
ret2=-$?

exit_multierr $ret0 $ret1 $ret2
