Skip to content

Widen approvals and denials counters to uint32_t#25

Open
Swissola wants to merge 3 commits into
anthropics:mainfrom
Swissola:fix/stats-overflow
Open

Widen approvals and denials counters to uint32_t#25
Swissola wants to merge 3 commits into
anthropics:mainfrom
Swissola:fix/stats-overflow

Conversation

@Swissola
Copy link
Copy Markdown

Summary

  • Stats::approvals and Stats::denials: uint16_t to uint32_t
  • NVS load/save: getUShort/putUShort to getUInt/putUInt
  • Local copies in statsMood(): uint16_t to uint32_t

Motivation

uint16_t caps at 65,535. A user who approves ~30 tool calls a day would hit the ceiling in under 6 years; at higher usage rates, much sooner. Overflow silently corrupts the mood calculation in statsMood() which uses the approval/denial ratio to adjust the pet's emotional state tier.

Migration

Existing NVS data migrates cleanly — getUInt() reading a key previously written by putUShort() zero-extends the value correctly on ESP32. No factory reset required.

Test plan

  • Flash, confirm existing approval/denial counts are preserved after update
  • Pet mood state unchanged after update with existing data

🤖 Generated with Claude Code

Swissola and others added 3 commits May 22, 2026 17:37
sleep=Donald Duck, idle=Bongo Cat, busy=SpongeBob multitasking,
attention=Surprised Pikachu (Nouns glasses), celebrate=Peanuts party,
dizzy=Powerpuff Girls spiral eyes, heart=heart eyes ghost.

Source GIFs in characters/memes-src/, device-ready pack in characters/memes/.
Built with prep_character.py at 96x98px, 64 colours per frame.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Track the current peer BD address in onConnect (extended overload).
bleRemoveCurrentBond() removes only that peer's LTK from NVS. The
"unpair" JSON command now calls this instead of bleClearBonds(), so
each host unpairs itself independently. bleClearBonds() is reserved
for factory reset only.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
uint16_t caps at 65535. A user approving ~30 tool calls a day hits the
ceiling in under 6 years; overflow silently corrupts the mood calculation
in statsMood() which uses the ratio to adjust the pet state tier.

- Stats::approvals and Stats::denials: uint16_t -> uint32_t
- NVS load/save: getUShort/putUShort -> getUInt/putUInt
- Local copies in statsMood(): uint16_t -> uint32_t

Existing NVS data migrates cleanly: getUInt reads a key previously
written by putUShort and zero-extends the value correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant