From 2a2f97c006e555c15f91b4f0f94ab3756275521d Mon Sep 17 00:00:00 2001 From: Joris van Rantwijk Date: Sun, 29 Sep 2024 20:39:30 +0200 Subject: [PATCH] Add script to manage calibration file Also rework the way config files are copied from SD card during boot. --- .../etc/init.d/S03read_config.sh | 21 +++++++++ .../opt/puzzlefw/bin/puzzle-calibration | 46 +++++++++++++++++++ .../opt/puzzlefw/bin/puzzle-ipcfg | 8 ++-- 3 files changed, 71 insertions(+), 4 deletions(-) create mode 100755 sw/buildroot_overlay/etc/init.d/S03read_config.sh create mode 100755 sw/buildroot_overlay/opt/puzzlefw/bin/puzzle-calibration diff --git a/sw/buildroot_overlay/etc/init.d/S03read_config.sh b/sw/buildroot_overlay/etc/init.d/S03read_config.sh new file mode 100755 index 0000000..55aba3d --- /dev/null +++ b/sw/buildroot_overlay/etc/init.d/S03read_config.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# +# Read configuration files from SD card. +# + +. /opt/puzzlefw/lib/functions.sh + +case "$1" in + start) + echo "Reading configuration files from SD card ..." + lock_config || exit 1 + read_config || exit 1 + ;; + stop|restart|reload) + true + ;; + *) + echo "Usage: $0 start" + exit 1 +esac + diff --git a/sw/buildroot_overlay/opt/puzzlefw/bin/puzzle-calibration b/sw/buildroot_overlay/opt/puzzlefw/bin/puzzle-calibration new file mode 100755 index 0000000..cdeddc6 --- /dev/null +++ b/sw/buildroot_overlay/opt/puzzlefw/bin/puzzle-calibration @@ -0,0 +1,46 @@ +#!/bin/sh +# +# Manage analog channel calibration. +# + +. /opt/puzzlefw/lib/functions.sh + +# Copy calibration file to the SD card. +cal_save() { + + # Lock to avoid conflicting changes. + lock_config || exit 1 + + echo "Copying changed calibration to SD card ..." + + sync_config calibration.conf || exit 1 +} + +case "$1" in + show) + cat ${CONFIG_DIR}/calibration.conf + ;; + save) + cal_save + ;; + *) + cat <