From 2dc98544696bc9781a70782a1654a7befd9e5c15 Mon Sep 17 00:00:00 2001 From: Wesley Ellis Date: Thu, 29 Dec 2022 11:32:25 -0500 Subject: [PATCH] WIP UV calibration via gdb / jlink --- make.mk | 2 ++ uv-calibration/dump-gdb | 16 ++++++++++++++++ uv-calibration/raw/trace_log | Bin 0 -> 182 bytes uv-calibration/unpack.py | 19 +++++++++++++++++++ 4 files changed, 37 insertions(+) create mode 100644 uv-calibration/dump-gdb create mode 100644 uv-calibration/raw/trace_log create mode 100644 uv-calibration/unpack.py diff --git a/make.mk b/make.mk index 8c8863bcb..4834f5213 100644 --- a/make.mk +++ b/make.mk @@ -243,3 +243,5 @@ endif ifdef CLOCK_FACE_24H_ONLY CFLAGS += -DCLOCK_FACE_24H_ONLY endif + +CFLAGS += -g diff --git a/uv-calibration/dump-gdb b/uv-calibration/dump-gdb new file mode 100644 index 000000000..8eda80ae5 --- /dev/null +++ b/uv-calibration/dump-gdb @@ -0,0 +1,16 @@ +set pagination off + +target remote :2331 +monitor halt +monitor reset 2 +file build/watch.elf +#load + +break ../watch_faces/sensor/si1133_uv_face.c:186 +command 1 +p new_reading +append value raw/trace_log new_reading +continue +end + +continue diff --git a/uv-calibration/raw/trace_log b/uv-calibration/raw/trace_log new file mode 100644 index 0000000000000000000000000000000000000000..a6f0462167c8c2c973dce9d090552d26f98d1e4c GIT binary patch literal 182 zcmZQzpdVmjU}NB7P-9R6LU{&p20;cP23ZCf27U%925AOv42SSC@B!7xfz`+X^(Zqa HLe&5OU-$xL literal 0 HcmV?d00001 diff --git a/uv-calibration/unpack.py b/uv-calibration/unpack.py new file mode 100644 index 000000000..01acc492a --- /dev/null +++ b/uv-calibration/unpack.py @@ -0,0 +1,19 @@ +""" +Turn gdb dump of uv readings from UV sensor watch into file +""" + +import argparse +import struct + +def main(filename: str): + with open(filename, "rb") as f: + buffer = f.read() + readings = [s[0] for s in struct.iter_unpack("