Checkpoint EEPROM, firmware analysis and instrument protocol updates

This commit is contained in:
2026-10-08 21:51:44 +03:00
parent b0c0c05cfa
commit fe9b5a246e
24 changed files with 848 additions and 62 deletions
+10 -1
View File
@@ -24,7 +24,8 @@ def sample(time_ms, period_ms=20, *, repeat=True):
else:
current = 4
words = [0] * codec.WORDS
# Extended logger record includes both DC-link voltage measurements.
words = [0] * 42
words[0], words[1] = time_ms & 65535, (time_ms >> 16) & 65535
words[2] = 1 | (0x100 if 5000 <= phase < 5000 + period_ms else 0)
words[3] = (int(started) << 7) | (int(reset) << 6)
@@ -42,6 +43,14 @@ def sample(time_ms, period_ms=20, *, repeat=True):
words[18:24] = [0xE07F, words[3], 6, 16, (time_ms // 100) & 65535, 0]
words[24:31] = [6, 16, 500, 3500, 2000, 500, 3500]
words[31:36] = [ramp if started else 0, 2500, 60, 160, round(ramp * 1000 / 2500)]
if started:
charge = min(1.0, (phase - 1000) / 1500)
elif phase >= 5000:
charge = max(0.0, 1 - (phase - 5000) / 800)
else:
charge = 0.0
words[40] = round(charge * (600 + 3 * math.sin(phase / 80)))
words[41] = round(charge * (590 + 4 * math.sin(phase / 95 + .7)))
return codec.sample(words)