InfiniTimeOrg / InfiniTimeOrg/InfiniTime

Event messaging is unsafe and rigid

Open
#1,644 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

maintenance
Dominant language
C
Stars
3.4k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

Verification
  • I searched for similar issues and found none was relevant.
Introduce the issue

With the PushMessage functions, there's a lot of opportunities for errors. Anything can push anything through that function. The classes, such as TimerController have a hard dependency on SystemTask and cannot be reused.

Preferred solution

I had the idea that we could use std::function to pass an event callback function to classes. This way classes can be made much more generic without SystemTask dependencies, and safer.

https://github.com/Riksu9000/InfiniTime/commit/e67451d15e10716bf9c0a4e30edd86d755068430 Here's how this could be used to make TimerController much more generic. The issue with this is that it seems to use more memory, and I'm not sure why that is. If you can, please review this idea and let me know what you think. Is this a good approach? Can it be improved?

Version

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the PushMessage functions and the TimerController classes, including their dependency on SystemTask. Then inspect the linked commit e67451d15e10716bf9c0a4e30edd86d755068430 and assess the proposed std::function callback approach and memory impact. Done would require an agreed event-messaging design and a defined scope for making the affected classes more generic.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
embedded-iot
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.