#!/bin/sh
# Used by profeth to flash LED(s), only a dummy for now

if [ $# -ne 2 ]; then
   echo "Usage: ${0} led_number led_state"
   echo "   where:"
   echo "       led_number:      LED number. Number 1 for sample app data LED"
   echo "                                    Number 2 for mandatory Profinet signal LED"
   echo "       led_state:       1 for on, 0 for off"
   echo "   Exit code:           0 on success, 1 on error"
   exit 1
fi

LED_NUMBER=$1
LED_STATE=$2

if ! [ "${LED_STATE}" = "0" -o "${LED_STATE}" = "1" ]; then
   echo "Wrong LED state: ${LED_STATE}"
   exit 1
fi

echo ${LED_STATE} > "/tmp/pnet_led_${LED_NUMBER}.txt"

exit 0
