From 41e0475c938bfd4a824ee412011c4912664851ba Mon Sep 17 00:00:00 2001 From: jebbatime build server Date: Sat, 12 Jun 2021 15:14:59 -0600 Subject: [PATCH] Set time scriptlets --- README.md | 1 + config/jebbatime.conf | 3 +++ scripts/jebbatime-dev-settime | 35 +++++++++++++++++++++++++++++++++++ scripts/jebbatime-settime | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 74 insertions(+) create mode 100755 scripts/jebbatime-dev-settime create mode 100755 scripts/jebbatime-settime diff --git a/README.md b/README.md index 7d834bf..c0517ff 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ sudo apt install \ pkg-config \ bluez \ ntpdate \ + sudo \ gcc-arm-none-eabi ccache \ fonts-lobstertwo ``` diff --git a/config/jebbatime.conf b/config/jebbatime.conf index 84a510e..d7a40de 100644 --- a/config/jebbatime.conf +++ b/config/jebbatime.conf @@ -14,3 +14,6 @@ JEBBATIMEDEVMAC=AA:BB:CC:DD:EE:40 # Bluetooth MAC of development unsealed watch DFU. One larger than main dev MAC. JEBBATIMEDEVDFUMAC=AA:BB:CC:DD:EE:41 +# NTP Server +JEBBATIMENTPSERVER=192.168.1.1 + diff --git a/scripts/jebbatime-dev-settime b/scripts/jebbatime-dev-settime new file mode 100755 index 0000000..1d4e98f --- /dev/null +++ b/scripts/jebbatime-dev-settime @@ -0,0 +1,35 @@ +#!/bin/bash + +# Get config +. ~/.config/jebbatime.conf + +cd $JEBBATIMEGITROOT + +./tools/wasptool \ + --battery \ + --device $JEBBATIMEDEVMAC + +echo "Connecting Bluetooth" +sudo bluetoothctl connect $JEBBATIMEDEVMAC + +echo "Setting host `hostname` time via NTP" +sudo ntpdate $JEBBATIMENTPSERVER + +echo "Checking time on watch" +./tools/wasptool \ + --check-rtc \ + --device $JEBBATIMEDEVMAC + +echo "Setting time on watch" +./tools/wasptool \ + --rtc \ + --device $JEBBATIMEDEVMAC + +echo "Checking time on watch" +./tools/wasptool \ + --check-rtc \ + --device $JEBBATIMEDEVMAC + +echo "Disconnecting Bluetooth" +sudo bluetoothctl disconnect $JEBBATIMEDEVMAC + diff --git a/scripts/jebbatime-settime b/scripts/jebbatime-settime new file mode 100755 index 0000000..438cc6f --- /dev/null +++ b/scripts/jebbatime-settime @@ -0,0 +1,35 @@ +#!/bin/bash + +# Get config +. ~/.config/jebbatime.conf + +cd $JEBBATIMEGITROOT + +./tools/wasptool \ + --battery \ + --device $JEBBATIMEMAC + +echo "Connecting Bluetooth" +sudo bluetoothctl connect $JEBBATIMEMAC + +echo "Setting host `hostname` time via NTP" +sudo ntpdate $JEBBATIMENTPSERVER + +echo "Checking time on watch" +./tools/wasptool \ + --check-rtc \ + --device $JEBBATIMEMAC + +echo "Setting time on watch" +./tools/wasptool \ + --rtc \ + --device $JEBBATIMEMAC + +echo "Checking time on watch" +./tools/wasptool \ + --check-rtc \ + --device $JEBBATIMEMAC + +echo "Disconnecting Bluetooth" +sudo bluetoothctl disconnect $JEBBATIMEMAC +