Bugfix stmApp.cpp : double idx++ skips half of 1-Wire sensors#5
Open
hubertciebiada wants to merge 1 commit into
Open
Bugfix stmApp.cpp : double idx++ skips half of 1-Wire sensors#5hubertciebiada wants to merge 1 commit into
hubertciebiada wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In
software_esp32/src/stmApp.cppthe parsers that read the 1-Wire sensor ID lists from STM32 increment the loop index twice per iteration — once in theforclause and once in the body:Same pattern in the
voltsparser around line 728.For
tempsPrivCount = N, the loop terminates afterN/2iterations and writes only odd-indexed slots:tempsId[0]andtempsId[2], drops the third sensor entirelyWhy it matters
Anyone using more than one DS18B20 on
X18(e.g. for hydraulischer Abgleich — flow/return temperature per manifold loop) sees only half of the sensors. The other half stays empty and the WebUI / MQTT gets no data for them.The bug is silent — no error, just missing values. Easy to miss until you count sensors and realise.
Verification
tempsId[]struct holds a single fieldchar id[25](software_esp32/include/stmApp.h:70-71) — one ID per slot, no pairinggonec 255is<count> id1,id2,id3,...with one ID per comma-separated token (software_stm32/src/communication.cpp:416-443)tempsPrivCountis set from the count field, equals the number of IDsidx++per element is correctExisted since the initial commit of this function (
5e497f33, 2022-01-25). The volts parser was added later as a copy of the temps parser and inherited the same bug.Fix
Remove the redundant
idx++from both loop bodies. No other change. Theforloop's own increment now correctly advances by one per element.