#!/bin/sh

# vcgencmd_throttled.sh
# 2021-06-09
# by Gernot Walzl

# https://www.raspberrypi.org/documentation/raspbian/applications/vcgencmd.md

eval $(vcgencmd get_throttled)
if [ $((throttled & 0x1)) -ne 0 ]; then
  echo "Under-voltage detected"
fi
if [ $((throttled & 0x2)) -ne 0 ]; then
  echo "Arm frequency capped"
fi
if [ $((throttled & 0x4)) -ne 0 ]; then
  echo "Currently throttled"
fi
if [ $((throttled & 0x8)) -ne 0 ]; then
  echo "Soft temperature limit active"
fi
if [ $((throttled & 0x10000)) -ne 0 ]; then
  echo "Under-voltage has occurred"
fi
if [ $((throttled & 0x20000)) -ne 0 ]; then
  echo "Arm frequency capping has occurred"
fi
if [ $((throttled & 0x40000)) -ne 0 ]; then
  echo "Throttling has occurred"
fi
if [ $((throttled & 0x80000)) -ne 0 ]; then
  echo "Soft temperature limit has occurred"
fi