Repository navigation
suunto_eonsteel: Don't report a zero ceiling as a deco stop with a valid NDL - #155
metman-oss wants to merge 1 commit into
Conversation
…lid NDL sample_ceiling() reported every Ceiling field as a DC_DECO_DECOSTOP sample, including a zero ceiling outside of deco. As the ceiling follows the NoDecTime field in the sample groups of the EON Steel/Core, the deco stop arrived right after the NDL sample. Subsurface takes a deco stop as the end of the no-deco limit and keeps an NDL of zero for every sample it creates for an event between two samples. In 50 EON Core dives without any deco, 1359 such samples got an NDL of zero. Collect the NDL and the ceiling of each sample group and report the deco stop once the group has been parsed. Skip it when the ceiling is zero and the group has a valid NDL, which already says that there is no deco obligation. A positive ceiling, and a zero ceiling without a valid NDL at the end of deco, are still reported as before. Upstream libdivecomputer likewise reports a deco stop only without a valid NDL. Add a synthetic test that covers no deco, deco, the end of deco and a group with the ceiling before the NDL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: metasch-oss <rene.metasch@gmail.com>
|
No actionable comments were generated in the recent review. WalkthroughThe Suunto EON Steel parser now retains NDL and ceiling values while parsing each sample, then reports deco stops after parsing. A new registered test checks the emitted values for four NDL and ceiling combinations. ChangesSuunto EON Steel deco-stop handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Suggested reviewers: Merge Risk:
|
mikeller
left a comment
There was a problem hiding this comment.
AI-drafted; reviewed by Michael.
Please keep this changeset focused on restoring upstream’s NDL precedence: when a sample group contains valid NDL and an explicit zero ceiling, report the NDL without emitting a zero stop, regardless of field order.
Please don’t restore the upstream EON logic wholesale. When NDL is unavailable, keep the explicit zero-ceiling callback so Subsurface can clear the previous deco state. Leave the fork’s separate TTS callback and positive-ceiling stop duration unchanged here; any changes to those belong in separate changesets.
Please keep regression coverage for both cases: valid NDL with a zero ceiling, and a zero ceiling with no valid NDL. If valid NDL resumes directly after a positive ceiling, Subsurface can retain the previous stop duration. That needs separate importer coverage and should not be worked around by emitting a zero stop that resets the carried NDL.
|
Thanks for the review. As far as I can tell, the change already does what you describe, so I may have phrased the description badly. Point by point:
The sentence about upstream in the description only referred to the NDL precedence, not to the rest of the upstream deco logic. I have reworded it. CI: I enabled the workflows in my fork and pushed the commit of this PR as 🤖 Generated with Claude Code |
|
AI-drafted; reviewed by Michael. You’re right: the patch already makes the distinction I asked for. It suppresses the zero stop when NDL is valid in either field order, keeps the zero-ceiling reset when NDL is unavailable, and leaves the separate TTS callback and positive-ceiling duration intact. The fixture covers both zero-ceiling cases, and the linked CI run passed on this commit. I’m not asking for a parser change on those points. The stale duration when NDL resumes directly after a positive ceiling is a separate Subsurface importer issue. It shouldn’t be worked around by reintroducing a zero stop here. |
Stops the EON Steel/Core parser from reporting a zero ceiling as a deco stop when the same sample has a valid NDL. Subsurface currently shows an NDL of zero for every event between two samples of these dives.
What changes
sample_ceiling()used to report every Ceiling field as aDC_DECO_DECOSTOPsample, including a zero ceiling outside of deco (time 0, depth 0). In the EON sample groups the ceiling followsNoDecTime, so this deco stop arrived right after the NDL sample. Subsurface'ssample_cb()treats a deco stop as the end of the no-deco limit and keeps an NDL of zero, which it then uses for the samples it creates for events between two regular samples.sample_ceiling()now only stores the ceiling, and the newsample_deco_stop()reports it once the whole sample group has been parsed (fromtraverse_samples()). It skips a zero ceiling when the group has a valid NDL. A positive ceiling is reported as before (with the assumed one-minute stop), and so is a zero ceiling without a valid NDL, which clears the deco state at the end of deco.Testing
New synthetic test
test/test_suunto_eonsteel_deco.c(no device data). It builds a minimal SBEM dive file with two sample groups and checks:Without this change it fails on the two "no deco stop" checks. I built and ran it with MSVC (
contrib/msvc/libdivecomputer.vcxproj, x64 Release). The autotoolsmake distcheckrun is left to CI.Real logs: 50 EON Core dives from a libdivecomputer log of a full download. Apart from the 14164 zero deco stops that are no longer reported, the sample output is identical before and after the change. Replaying Subsurface's handling of the NDL gives 1359 samples with an NDL of zero before the change, exactly the number in my imported log, and none after it. None of these dives had any deco, so the deco cases are covered by the synthetic test only.
This change and #154 both add a test to the same lines of
test/Makefile.am. Whichever is merged second needs a small rebase, which I'm happy to do.Once merged, Subsurface needs only a submodule update.
The change and test were written with Claude.
🤖 Generated with Claude Code