Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define timings for known master devices #86

Open
eigenein opened this issue Jan 17, 2020 · 0 comments
Open

Define timings for known master devices #86

eigenein opened this issue Jan 17, 2020 · 0 comments

Comments

@eigenein
Copy link

eigenein commented Jan 17, 2020

Hi @orgua,

I can see that quite often people have to tweak the timings for their specific master devices and so had I. If I want to distribute a source code of my project, I'd need to provide a patch and instructions for building the project. This is not really handy and couldn't be easily put under a source control.

What if we used #ifdefs in order to store the timings in one central place? For instance, in OneWireHub_config.h:

#if defined(LIVOLO_C701TM_11)
// Contributed by someone who debugged this particular master.
constexpr timeOW_t ONEWIRE_TIME_RESET_MAX[2]         = {   50000_us, 80_us };
#elif defined(…)
// Another device(s)
…
#else
// Here we have the standard defaults.
constexpr timeOW_t ONEWIRE_TIME_RESET_MAX[2]         = {   960_us, 80_us }; // from ds2413
#endif

It's much easier to set -D while building, some platforms such as PlatformIO allow to put them into a project configuration file (platformio.inibuild_flags), so that an end user won't have to patch anything. Also, they will get reasonable values from someone who already spent time figuring them out.

I'm not experienced in C++, so the implementation may be not so pretty, especially overriding individual timings for different masters, but what do you think overall?

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

No branches or pull requests

1 participant