--- /dev/null
+#! /bin/sh
+
+set -e
+
+bin_dir="$(dirname $(realpath $0))"
+
+. "$bin_dir/khatus_x4_lib_common_sensor.sh"
+
+sensor() {
+ free | awk '
+ $1 == "Mem:" {
+ total = $2
+ used = $3
+ percent_used = int(((used / total) * 100) + 0.5) # Average
+ print("percent_used", percent_used)
+ }
+ '
+}
+
+run_as_poller
./bin/khatus_x4_sensor_bluetooth&
./bin/khatus_x4_sensor_mpd &
./bin/khatus_x4_sensor_energy &
+ ./bin/khatus_x4_sensor_memory &
}
sensor_read_one() {
bluetooth_devices="$(sensor_read_one ${dir}/khatus_x4_sensor_bluetooth/out/count_connected_devices)"
datetime="$(sensor_read_one ${dir}/khatus_x4_sensor_datetime/out/datetime)"
mpd="$(sensor_read_one ${dir}/khatus_x4_sensor_mpd/out/status)"
- echo "E[${battery_state} ${battery_percentage}] [${mpd}] [$bluetooth_controllers $bluetooth_devices] ${datetime}"
+ mem="$(sensor_read_one ${dir}/khatus_x4_sensor_memory/out/percent_used)"
+ echo "E[${battery_state} ${battery_percentage}] M:${mem}% [${mpd}] [$bluetooth_controllers $bluetooth_devices] ${datetime}"
sleep 1
done
}