Skip to content

Commit

Permalink
WIP UV calibration via gdb / jlink
Browse files Browse the repository at this point in the history
  • Loading branch information
tahnok committed Jun 28, 2024
1 parent 328a72e commit 2dc9854
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
2 changes: 2 additions & 0 deletions make.mk
Original file line number Diff line number Diff line change
Expand Up @@ -243,3 +243,5 @@ endif
ifdef CLOCK_FACE_24H_ONLY
CFLAGS += -DCLOCK_FACE_24H_ONLY
endif

CFLAGS += -g
16 changes: 16 additions & 0 deletions uv-calibration/dump-gdb
Original file line number Diff line number Diff line change
@@ -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
Binary file added uv-calibration/raw/trace_log
Binary file not shown.
19 changes: 19 additions & 0 deletions uv-calibration/unpack.py
Original file line number Diff line number Diff line change
@@ -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("<H", buffer)]
print(*readings, sep="\n")

if __name__ == '__main__':
parser = argparse.ArgumentParser(prog = 'ProgramName')
parser.add_argument('filename') # positional argument
args = parser.parse_args()
main(args.filename)

0 comments on commit 2dc9854

Please sign in to comment.