Comments (6)
You're right, but I'm not sure if I follow your solution. The problem only occurs when the local version equals the version of the updated packet, as far as I can see. Wouldn't just flipping the if
/else if
pair (with their blocks) at line 611 and 639 do the trick? That way, we would check for equality (and decide whether the data is conflicting or the same), and only if the versions are different we'll go and check the big if
for the lollipop.
For your solution, I think there's a missed case when the LOLLIPOP_LIMIT is 200, halfway is 400 max is 600 (to keep it simple), the new version is 405, and the old is 390. I don't think the value would get past halfway this way. Please correct me if I'm wrong.
Sorry about the delay by the way. The nRF51 side of the project has been in a slight hiatus as I have been finishing up my thesis, but it will be getting more attention in the following months:)
from nrf51-ble-bcast-mesh.
Hi Trond,
Yes, you're right! Reviewing it now I think you're right about using seperation, although I don't see why you'd need anything else than:
OV = own version (ch_md->version_number)
PV = packet version (version)
if (OV >= PV) seperation = OV - PV
if (PV < OV) seperation = PV - OV
if ov < pv && (ov < lolli || (ov > lolli && sep > hw)) --> new
if ov > pv && (pv > lolli && sep > hw) --> new
if uninitialized --> new
The seperation will only matter if both are over the lollipop start so the distance is always over the circle of the lollipop. I think: https://github.com/NordicSemiconductor/nRF51-ble-bcast-mesh/blob/master/nRF51/rbc_mesh/src/mesh_srv.c#L607 is wrong at the moment.
example:
LOLLIPOP_LIMIT = 200, max = 600
OV = 595, PV = 205
seperation = (-(595-200) + (205-200) - 200) = -395 + 5 - 200 = -590 but is uint so is 0 (which seems nasty) or does it flip the int? which would fail the check below
the if statement then sees OV > lolli && if 0 < halfway and ok it passes and accepts the new value. Hurray!
other example,
OV = 301, PV = 300
seperation = (-(301 - 200) + (300 - 200) - 200) = -101 + 100 - 200 = -201 but is 0 due to uint
the if statement then sees OV > lolli && if 0 < halfway and ok it passes and accepts the new value. Huh? that shoudnt happen.
Either I'm reading it wrong, but your solution would help for the case if there are no new messages. It would not help the case where the node sends a new message but hears the old one?
Am I overlooking something here?
from nrf51-ble-bcast-mesh.
Hi there,
I have also noticed an issue with the new version, here are my fixes:
a) separation:
was: uint16_t separation = (version >= ch_md->version_number)? ...
mod: uint16_t separation = (version > ch_md->version_number)? ...
b) comparison and decision:
was: if ((ch_md->version_number < MESH_VALUE_LOLLIPOP_LIMIT && version >= ch_md->version_number) ||
mod: if ((ch_md->version_number < MESH_VALUE_LOLLIPOP_LIMIT && version > ch_md->version_number) ||
and it seems to be ok.
Cheers
Oleh
from nrf51-ble-bcast-mesh.
Hi guys,
I've been looking some more into this issue, and have found and verified a solution. I've gone with the reversal of the if-statements, and also added another guard for an unmissed case where the new value is below the limit and the old is above UINT16_MAX - LIMIT/2
. I'll see if I can push the fix today.
@AlexDM0: I think your assumption about -201 in uint being 0 is wrong. Overflow in uint is defined behavior, and -201 is UINT16_MAX - 201 = 65334, so the int flips.
from nrf51-ble-bcast-mesh.
Hi Trond,
Should you also implement a check if the int has flipped when the limit is reached? So if 65536 is reached it now goes to 0, not to LOLLIPOP_LIMIT.
I think this should be done here: https://github.com/NordicSemiconductor/nRF51-ble-bcast-mesh/blob/master/nRF51/rbc_mesh/src/mesh_srv.c#L739 ?
Glad to hear you're looking into it!
Regards,
Alex
from nrf51-ble-bcast-mesh.
you're right, added 😄
from nrf51-ble-bcast-mesh.
Related Issues (20)
- Mesh encryption of data HOT 1
- Multiple frequencies and modulation types for RX and TX HOT 3
- OTA for mesh nodes HOT 2
- into module? HOT 2
- Notification not enabled for sdk13 and nRF52832 HOT 2
- hack HOT 1
- What does "radio_order" and "RADIO_EVENT_TYPE_RX_PREEMPTABLE" etc. do? HOT 1
- consider storing i_relative as log2(i_relative) to save 3 bytes per trickle
- it seems a bug! HOT 1
- Packet loss in mesh network HOT 1
- 3 Questions regarding migrating to Nrf52 platforms HOT 1
- GATT Service HOT 1
- DFU questions
- Mesh monitoring on a device HOT 1
- What is the hop delays and relevant solutions? HOT 1
- battery usage / fruity mesh HOT 2
- rbc_mesh_stop sometimes crashes my program HOT 3
- Timeslot SD crash fix only applicable for NRF52?
- P
- b16e1105f3da788022c24e75b8603f9f4426a636
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nrf51-ble-bcast-mesh.