Skip to content

Conversation

@FredM67
Copy link
Contributor

@FredM67 FredM67 commented Jan 9, 2026

Summary

  • Replace two-step convert+append with single strnCatFloat/strnCatInt functions
  • Remove unused strConv static variable and strnLen function
  • Clean up initFields() - remove side effect of initializing strConv
  • Simplify code: -33 lines, -40 bytes flash

Before:

(void)strnFtoa(&strConv, value);
strn.n += strnCat(&strn, &strConv);

After:

strn.n += strnCatFloat(&strn, value);

Test plan

  • Verify serial output format unchanged (MSG:1,V1:xxx,P1:xxx,...)
  • Verify JSON output format unchanged

Closes #42

🤖 Generated with Claude Code

- Replace two-step convert+append with single strnCatFloat/strnCatInt functions
- Remove unused strConv static variable and strnLen function
- Clean up initFields() - remove side effect of initializing strConv
- Simplify code: -33 lines, -40 bytes flash

Before:
  (void)strnFtoa(&strConv, value);
  strn.n += strnCat(&strn, &strConv);

After:
  strn.n += strnCatFloat(&strn, value);

Closes openenergymonitor#42

Co-Authored-By: Claude <[email protected]>
@awjlogan awjlogan merged commit 615baa5 into openenergymonitor:main Jan 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor strConv pattern in dataPack.c

2 participants