Git Product home page Git Product logo

Comments (4)

trond-snekvik avatar trond-snekvik commented on August 16, 2024

This works, but you'll have to be on guard for new nodes in the mesh. Consider a mesh that has been running for some time, and made it to version 64000 (right below overflow). Then, a new node joins the mesh, making enquieries about the variable by broadcasting its version 0-variable. The rest of the mesh would then assume that this new node knows more than they do, and change their values to the new, useless version, erasing any previous state in the mesh.

Treating the 0-version specially would solve this pretty fast, but I think a Lollipop sequencing scheme might be a better fit, where we treat the first N versions as beginner-versions, that will never be able to overwrite any larger ones. Then we can cycle at N+1 and up (the yummy, round part of the lollipop). That would cover cases where a new node has been assigned a value by some setup-system or something, bumping its version number before it's introduced to the mesh.

uint16_t separation = (new_ver >= old_ver)?
    (new_ver - old_ver) : 
    (-(old_ver - N) + (new_ver - N) - N);



if ((old_ver < N && new_ver >= old_ver) || 
    (old_ver >= N && separation < (UINT16_MAX - N)/2) || 
    uninitialized)
{

Any thoughts?

from nrf51-ble-bcast-mesh.

victorpasse avatar victorpasse commented on August 16, 2024

This seems to be a better solution,
I will use your variant

from nrf51-ble-bcast-mesh.

olskyy avatar olskyy commented on August 16, 2024

sounds good!

+1!

from nrf51-ble-bcast-mesh.

trond-snekvik avatar trond-snekvik commented on August 16, 2024

The solution I proposed is now part of the master branch (as of release v0.6.2), and version should now cycle like I described above. Thank you @victorpasse for reporting :)

from nrf51-ble-bcast-mesh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.