#!/bin/sh

if [ -f /rw/test ]; then
        sleep 20

        ntpdate -u pool.ntp.org

        a10-tpr3-scan /rw/ "480MHz" &
	sleep 5

	SERIAL=$(fw_printenv -c /etc/fw_env.config.spi sn -n || fw_printenv sn -n)

	while true; do
#		echo 10 > /sys/devices/platform/backlight/backlight/backlight/brightness
	        a10-tpr3-html-report /rw/ > /tmp/report.html
		curl -u "nesis:M2cYuwBQaV" -T /tmp/report.html "https://nextcloud.kanardia.eu/remote.php/dav/files/nesis/dram/report-${SERIAL}.html"
		sleep 60
	done
fi

